Files
Auto_Bangumi/docs/ja/dev/plugins/examples.md
Estrella Pan 776abfa896 docs(4.0): 更新 API 参考与开发者文档,新增获取 SDK 页
- API 参考按实际路由重写,修正认证方式、请求方法与设置向导端点
- 数据库指南改为异步 Database 与 MIGRATIONS
- E2E 指南改为指向 e2e/README.md
- 插件快速上手补上安装 SDK 轮子的步骤,ab-plugin dev 加 --config-dir
- 发布流程改为手动推送标签触发
2026-10-08 17:36:53 +02:00

33 lines
2.3 KiB
Markdown
Raw 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.
# サンプルプラグイン
サンプルはリポジトリの [`examples/plugins/`](https://github.com/EstrellaXD/Auto_Bangumi/tree/main/examples/plugins) にあります。Docker イメージには含まれません。各サンプルに README とテストがあり、CI が 1 つずつ実行します。
| サンプル | 内容 |
| --- | --- |
| `webhook-on-event` | `@subscribe("*")`、設定フォーム、`secret_field`。選んだイベントを URL に POST します。HMAC 署名は任意です |
| `custom-rss-site` | `search_site` Provider と `http.request` フック。プライベートサイトのリクエストに Cookie を付けます。`SearchSiteContract` |
| `template-rename` | `rename_strategy` Provider。独自フィルター付きのファイル名テンプレート。`RenameSkipped`。`RenameStrategyContract` |
| `nfo-writer` | `torrent.organized` を購読し、本編の隣に `.nfo` を書きます。パス変換。冪等 |
| `ntfy-notifier` | `notifier` Provider。バックエンドが拒否したときは `False` を返します。`NotifierContract` |
| `manual-pick` | フロントエンドスロット `bangumi.detail.tab`、プラグインのルート、プラグイン KV、イベント |
## サンプルをインストールする
```bash
cp -r examples/plugins/ntfy-notifier config/plugins/local/
```
設定 → プラグインで「未署名プラグインを許可」をオンにし、プラグインを有効にします。
## サンプルのテストを実行する
リポジトリのルートで実行します。スクリプトは各サンプルのマニフェストを検証し、そのテストを実行します(CI と同じ)。
```bash
scripts/test_example_plugins.sh
```
スクリプトは `backend/` の環境で動き、そこには SDK が編集可能モードでインストールされています。サンプルの `pyproject.toml` は `autobangumi-sdk` に依存しますが、このパッケージは PyPI にありません。サンプルをリポジトリの外にコピーして単独でテストする場合は、先にサンプルのディレクトリで `uv add <wheel のパス>` を実行してから `uv run pytest` を実行します。
Jellyfin / Emby / Plex のライブラリ更新にプラグインを書く必要はありません。組み込みプラグイン `media-server-refresh` が対応しています。