mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-01 21:26:08 +08:00
- docs/dev/plugins.md 改为总览与导航,旧内容拆入 docs/dev/plugins/ - 新增核心概念、配置表单、事件、前端挂载点、命令行、签名与分发、内置插件、示例页 - 每个扩展点一页,侧边栏由页面表生成 - 改正旧文档中下载器配置、hardlink path_map 与补链按钮的过时描述
20 lines
886 B
Markdown
20 lines
886 B
Markdown
# Media Files (media_files)
|
|
|
|
Decides which files in a torrent AB renames as media, which as subtitles, and which AB ignores. `@provider(points.MEDIA_FILES, id=...)` returns a `MediaFiles`.
|
|
|
|
```python
|
|
from ab_sdk.rename import MediaFiles, MediaKind
|
|
|
|
class ByExtension:
|
|
def classify(self, path: str) -> MediaKind:
|
|
if path.endswith((".mkv", ".mp4")):
|
|
return "media"
|
|
if path.endswith((".ass", ".srt")):
|
|
return "subtitle"
|
|
return "ignore"
|
|
```
|
|
|
|
- Return `media` (rename as media), `subtitle` (renamed together with the media) or `ignore` (not processed).
|
|
- The host implementation `default` uses the extension: `.mp4` and `.mkv` are media, `.ass` and `.srt` are subtitles.
|
|
- `plugins.slots.media_files` selects the Provider id (default `default`). If the selected id is not registered (the plugin is disabled or tripped), AB uses `default`.
|