Files
Auto_Bangumi/docs/ja/dev/plugins/points/title-parsed.md
Estrella Pan 3258fcca4b docs(4.0-P7): 插件开发文档拆分为总览加每个扩展点一页,补齐中英日三语
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/
- 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页
- 每个扩展点一页,侧边栏由页面表生成
- 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
2026-10-08 14:51:00 +02:00

24 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 解析結果の補正 (title.parsed)
transform フックです。AB は、決定的な解析の後(LLM 解析が有効ならその後)、受け入れ判定の前にこれを呼びます。フックは凍結された解析結果を受け取ります。`dataclasses.replace` で作った変更後のコピーを返します。`None` は変更なしです。他の型の戻り値は無視され、ブレーカーに数えられます。
```python
from dataclasses import replace
from ab_sdk import Plugin, hook, points
ALIASES = {"LoliHouse": "Lolihouse"}
class GroupAlias(Plugin):
@hook(points.TITLE_PARSED)
def fix(self, release):
if release.group in ALIASES:
return replace(release, group=ALIASES[release.group])
return None
```
- 読めるフィールド:`raw`、`title_en`、`title_zh`、`title_jp`、`group`、`season`、`episode`、`resolution`、`source`、`subtitle`、`year`。これ以外の属性(`media_type`、`release_kind` など)も読めますが、SDK 1.0 までは安定性が保証されません。
- 新しいルールの作品名、シーズン、字幕グループは、この結果に由来します。そのため、ここでの変更は新しく作られるルールに影響します。
- 種別を PV や合集などに変えると、AB はそのリソースを取り込みません。