CLI tool for searching and downloading Chinese subtitles via Xunlei API
Project description
Thunder Subtitle
迅雷字幕 CLI 工具 — 搜索、下载中文字幕,支持 Jellyfin 媒体库自动扫描。
安装
pip install thunder-subtitle
或开发模式安装:
git clone <repo>
cd thunder-subtitle-py
pip install -e ".[dev]"
使用方法
搜索字幕
# 基本搜索
thunder-subtitle search "Movie Name"
# 仅中文字幕
thunder-subtitle search "Movie Name" --chinese-only
# 按视频时长筛选 (过滤时长不匹配的字幕)
thunder-subtitle search "Movie Name" --max-duration 1h30m
# 下载全部结果
thunder-subtitle search "Movie Name" --all -o ./subs/
# 按序号下载
thunder-subtitle search "Movie Name" --index 1,3,5
全量下载(dump)
下载所有匹配的中文字幕,自动跳过之前已拒绝的字幕(基于 gcid 记录在 .rejected 文件中)。
# 直接搜索下载
thunder-subtitle dump "Movie Name"
# 从目录读取 movie.nfo 自动获取时长
thunder-subtitle dump --dir /path/to/movie
# 清空 .rejected 文件以重新下载所有字幕
rm /path/to/movie/.rejected
注意:已拒绝的字幕(gcid 或 url hash 记录在
.rejected)在后续下载中自动跳过。手动删除.rejected文件可清空拒绝列表。scan 模式下的--reset-fail会自动清空.rejected和审查失败标记,实现完全暴力刷新。
Jellyfin 目录扫描
扫描演员/电影目录结构,自动搜索并下载缺失的字幕。支持断点续扫、并行下载。
# 基础扫描
thunder-subtitle scan /path/to/jellyfin/media
# 预览模式(不实际下载)
thunder-subtitle scan /path/to/jellyfin/media --dry-run
# 并行处理(4线程)
thunder-subtitle scan /path/to/jellyfin/media --parallel 4
# 过滤特定电影
thunder-subtitle scan /path/to/jellyfin/media --filter "电影名"
# 断点续扫
thunder-subtitle scan /path/to/jellyfin/media --resume
# 仅处理 N 天前发布的电影
thunder-subtitle scan /path/to/jellyfin/media --min-age 7
# 全量下载模式(每部电影下载所有匹配字幕)
thunder-subtitle scan /path/to/jellyfin/media --dump
# 强制重试标记失败的电影(但跳过已拒绝的字幕)
thunder-subtitle scan /path/to/jellyfin/media --dump --force
# 暴力刷新:清除标记失败状态和所有拒绝记录,重新下载
thunder-subtitle scan /path/to/jellyfin/media --dump --force --reset-fail
字幕审查
审查已下载字幕质量,给出百分制评分。
# 审查目录
thunder-subtitle review /path/to/jellyfin/media
# 标记审查状态
thunder-subtitle review --mark "电影名" # 标记通过
thunder-subtitle review --mark-fail "电影名" # 标记失败(不再尝试下载)
thunder-subtitle review --unmark "电影名" # 取消标记
thunder-subtitle review --mark-all # 全部标记
配置管理
# 查看配置
thunder-subtitle config
# 设置配置项
thunder-subtitle config --set media_paths /path1,/path2
thunder-subtitle config --set rate_limit 5
thunder-subtitle config --set preferred_groups "KitaujiSub,DMG"
# 重置为默认
thunder-subtitle config --reset
配置项:
| 键 | 类型 | 默认值 | 说明 |
|---|---|---|---|
output_dir |
str | "" |
默认下载目录 |
timeout |
int | 30 |
API 超时(秒) |
rate_limit |
int | 3 |
扫描模式查询间隔(秒) |
retry_count |
int | 3 |
下载失败重试次数 |
retry_delay |
int | 2 |
重试基础间隔(秒,指数退避) |
preferred_groups |
str | "" |
偏好字幕组(逗号分隔) |
media_paths |
str | "" |
默认媒体库路径(逗号分隔) |
直接下载
thunder-subtitle download "https://..." "filename.srt"
Jellyfin 目录结构
媒体库/
├── 演员A/
│ ├── 电影1/
│ │ ├── movie.nfo
│ │ └── 视频文件
│ └── 电影2/
│ └── movie.nfo
└── 演员B/
└── 电影3/
└── movie.nfo
开发
pip install -e ".[dev]" # 安装开发依赖
pytest tests/ -v # 运行测试(196 用例)
ruff check . # 代码检查
CI/CD
- CI:push/PR 时自动运行 ruff lint + 编译检查 + pytest
- 发布:推送
v*tag 自动构建 wheel 并发布到 PyPI
要求
- Python >= 3.10
requests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thunder_subtitle_srt-1.0.0.tar.gz.
File metadata
- Download URL: thunder_subtitle_srt-1.0.0.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a641f738ac68de91fd9e3dacbba7b18ed914c002b34d396b873e110d673f3f2e
|
|
| MD5 |
c4ce501218a664157b08525f63e668de
|
|
| BLAKE2b-256 |
793eb65111e3a9c85ab17ec34e328a51ae867ba0b8fabb1c5e8f4f5817d79dcb
|
Provenance
The following attestation bundles were made for thunder_subtitle_srt-1.0.0.tar.gz:
Publisher:
publish.yml on IAmKings/thunder_subtitle_srt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thunder_subtitle_srt-1.0.0.tar.gz -
Subject digest:
a641f738ac68de91fd9e3dacbba7b18ed914c002b34d396b873e110d673f3f2e - Sigstore transparency entry: 1590968524
- Sigstore integration time:
-
Permalink:
IAmKings/thunder_subtitle_srt@2c9f34acb731dae0cd9346dce57931ee0b7f86ee -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/IAmKings
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2c9f34acb731dae0cd9346dce57931ee0b7f86ee -
Trigger Event:
push
-
Statement type:
File details
Details for the file thunder_subtitle_srt-1.0.0-py3-none-any.whl.
File metadata
- Download URL: thunder_subtitle_srt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 42.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a19481a063a3490016c5d89e895063d08a10b786eb354cd6654b6bca65734ab5
|
|
| MD5 |
507f026a00179b53466a95ca172b2d7c
|
|
| BLAKE2b-256 |
81ec659e6437befec0d2a3562bf33769f8cccf2d95b564ad87bd7b11fabe1200
|
Provenance
The following attestation bundles were made for thunder_subtitle_srt-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on IAmKings/thunder_subtitle_srt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thunder_subtitle_srt-1.0.0-py3-none-any.whl -
Subject digest:
a19481a063a3490016c5d89e895063d08a10b786eb354cd6654b6bca65734ab5 - Sigstore transparency entry: 1590968547
- Sigstore integration time:
-
Permalink:
IAmKings/thunder_subtitle_srt@2c9f34acb731dae0cd9346dce57931ee0b7f86ee -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/IAmKings
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2c9f34acb731dae0cd9346dce57931ee0b7f86ee -
Trigger Event:
push
-
Statement type: