跳到正文
Skillpedia
API 与服务器(后端)8.3k · #12465

autobangumi-plugin

它能做什么

这项技能指导使用其 Python 工具包为 AutoBangumi 应用构建附加插件。适合希望添加新的下载、通知、搜索或重命名功能的开发者。

适用场景

  • ✓当你想为 AutoBangumi 添加新的下载器、通知器或搜索源的时候。
  • ✓当你想为 AutoBangumi 设置自定义重命名模板的时候。
  • ✓当插件在安装之前需要测试、验证或打包的时候。

技能链接

https://github.com/EstrellaXD/Auto_Bangumi/blob/main/skills/autobangumi-plugin/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/EstrellaXD/Auto_Bangumi/blob/main/skills/autobangumi-plugin/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我编写一个 AutoBangumi 插件,在下载到新一集时发送通知。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会根据模板创建插件包,编写插件代码,运行测试,然后进行验证和打包。每个插件都扩展应用中的某一个特定位置。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

AutoBangumi plugin authoring

AB plugins are Python packages (optional Web Component UI) that run inside the AB process. They import only ab_sdk, never module.*. SDK is 0.x during 4.0: pin sdk = ">=0.5,<1" in the manifest.

Workflow

  1. Pick the extension point (table below). If unsure, read references/extension-points.md.
  2. Scaffold: ab-plugin new <id> --kind rename|notifier|search (ids: lowercase, digits, hyphens; core and local are reserved). For other points, copy the closest example from examples/plugins/ in the AB repo.
  3. Write the plugin: one Plugin[Options] subclass, config_model = Options, decorated methods.
  4. Test first: uv run pytest. Provider points have contract suites in ab_sdk.testing (subclass, implement create()). Other behavior: create_plugin(Cls, options) plus asyncio.run.
  5. ab-plugin validate . then ab-plugin dev . (links into config/plugins/local/, enables hot reload; restart AB once) then ab-plugin pack ..

Install the tooling from the GitHub release wheel (autobangumi_sdk-<ver>-py3-none-any.whl), not PyPI.

Skeleton

from pydantic import BaseModel, Field
from ab_sdk import Plugin, points, provider, hook, subscribe, secret_field

class Options(BaseModel):
    url: str = Field("", title="URL")             # title/description become the WebUI form labels
    token: str = secret_field(title="Token")      # password box; masked on read

class MyPlugin(Plugin[Options]):
    config_model = Options                         # self.config is a validated Options

    @provider(points.NOTIFIER, id="my-push")      # Provider: the thing the user selects by id
    def channel(self): ...

    @hook(points.TORRENT_FILTER, priority=50)     # Hook: runs in the AB pipeline
    def check(self, torrent, release, bangumi): ...

    @subscribe("torrent.organized", timeout=600)  # Event subscriber ("*" = all events)
    async def on_organized(self, event): ...

self.ctx: plugin_id, config, log, kv (async get/set/delete, JSON values), data_dir, bus (publish, subscribe).

Extension points

Point constant Kind Returns / signature
DOWNLOADER provider DownloaderFactory: (DownloaderConnection) -> client with capabilities, auth, logout, add_torrents
NOTIFIER provider NotifierFactory: (NotifierSettings) -> Notifier (send -> bool, test -> (bool, str))
LLM_PROVIDER provider LLMProviderAdapter subclass; id must equal info.id
SEARCH_SITE provider SearchSite(url_with_%s, parser="tmdb"|"mikan")
SCHEDULED_TASK provider ScheduledTask(run, interval, initial_delay, enabled)
METADATA_PROVIDER provider object with async enrich(MetadataRequest) -> Metadata | None
RENAME_STRATEGY provider object with target_name(RenameInput) -> str; raise RenameSkipped for bad input
MEDIA_FILES provider classify(path) -> "media"|"subtitle"|"ignore"
CONFLICT_POLICY provider decide(ConflictRequest) -> ConflictDecision("hold"|"replace", reason)
API_ROUTER provider fastapi.APIRouter, mounted at /api/v1/plugins/<id>/, login required
MCP_TOOL / MCP_RESOURCE provider McpTool / McpResource
TORRENT_FILTER filter hook (torrent, release, bangumi) -> Verdict
TITLE_PARSED transform hook (release) -> release | None
TORRENT_ADDING transform hook (AddRequest) -> AddRequest | None
HTTP_REQUEST transform hook (HttpRequest) -> HttpRequest | None (headers only)
MESSAGE_TEMPLATE transform hook (RenderedMessage, event, channel) -> RenderedMessage | None

Details, imports and field lists: references/extension-points.md.

Rules that prevent most bugs

  • Hooks get frozen snapshots. Return dataclasses.replace(obj, ...); return None for "no change". A wrong return type counts as a failure.
  • Five consecutive failures trip the circuit breaker and disable the plugin. RenameSkipped is not a failure. Never fall back to another naming method after a failure.
  • Filter hooks fail open (a crash accepts the torrent). Notifier send returns False on a backend refusal; it does not raise.
  • Events: plugin event kind must start with <plugin-id>.. Subclass SystemEvent to make a notifiable event. torrent.organized is delivered at least once: make handlers idempotent. Event paths are downloader-side paths; map them to local paths before touchi
常见问题

我需要懂 Python 吗?

需要。插件是 Python 包,因此一些 Python 知识会有所帮助。

我应该在哪里测试插件?

这项技能先运行测试,然后把插件链接到应用中,以便在开发时热重载。

它使用哪个 SDK 版本?

它将 SDK 锁定在 0.5 到 1.0 之前的版本范围内(不含 1.0)。

详情

作者的原始描述

Write, test, pack and debug AutoBangumi (AB) 4.0 plugins with the ab_sdk Python SDK and the ab-plugin CLI. Use when the user asks to "write an AutoBangumi plugin", "add a downloader / notifier / search site / rename strategy / RSS site to AutoBangumi", "hook into AutoBangumi", mentions ab_sdk, ab-plugin, plugin.toml, @provider, @hook, @subscribe, secret_field, or wants a custom rename template, webhook on torrent.organized, nfo writer, private tracker Cookie, or a plugin web component for the AutoBangumi WebUI.

repo: EstrellaXD/Auto_Bangumi

热度

GitHub 星标
8.3k
排名
#12465
许可证
MIT
更新时间
2026/10/26

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

相似技能