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

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`.