mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-10-30 04:06:04 +08:00
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/ - 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页 - 每个扩展点一页,侧边栏由页面表生成 - 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
1.3 KiB
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.kindseparates a series (bangumi) from a movie (movie).request.torrent.homepageis the detail page of the torrent.request.languageis the language setting.- Return a complete new
Metadata, usually changed fromrequest.current.Nonemeans no change. - On a failure or a timeout AB keeps the old value, and the failure counts toward the breaker.