Files
Auto_Bangumi/docs/en/dev/plugins/points/metadata-provider.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

1.3 KiB

Metadata Provider (metadata_provider)

Before a new series rule is saved, AB selects a metadata source with the "parser" value of the RSS subscription. The source completes the official title, season, year and poster. mikan and tmdb are built in. @provider(points.METADATA_PROVIDER, id=...) adds a new value. The "parser" list shows it when the user adds a subscription.

from dataclasses import replace

from ab_sdk import Plugin, points, provider
from ab_sdk.ingest import Metadata, MetadataRequest


class BangumiTv:
    async def enrich(self, request: MetadataRequest) -> Metadata | None:
        info = await search(request.current.official_title)  # your own code
        if info is None:
            return None  # no change
        return replace(request.current, official_title=info.name, poster_link=info.cover)


class MyPlugin(Plugin):
    @provider(points.METADATA_PROVIDER, id="bangumi-tv")
    def bgm(self):
        return BangumiTv()
  • request.kind separates a series (bangumi) from a movie (movie). request.torrent.homepage is the detail page of the torrent. request.language is the language setting.
  • Return a complete new Metadata, usually changed from request.current. None means no change.
  • On a failure or a timeout AB keeps the old value, and the failure counts toward the breaker.