No description
- Python 63.5%
- Go 29.1%
- Shell 6.1%
- Batchfile 0.8%
- Makefile 0.5%
| cmd | ||
| internal | ||
| rule | ||
| scripts | ||
| setting | ||
| test | ||
| tools | ||
| utils | ||
| .gitignore | ||
| auto_test.cmd | ||
| go.mod | ||
| LICENSE | ||
| Makefile | ||
| match_subtitles.py | ||
| README.md | ||
| rule.csv | ||
MatchSubtitles (Go Rewrite)
目标:保持核心能力(字幕与媒体自动匹配/重命名),去掉花哨功能,优先代码质量与工程结构。
核心功能
- 按剧集序号匹配 媒体文件 与 字幕文件
- 支持两种输入:
-m普通媒体目录-b蓝光原盘目录(自动读取BDMV/STREAM/*.m2ts)
- 支持输出到目标目录(
-t)或就地处理 - 支持执行模式:移动(默认)/复制(
-c)/硬链接(-l) - 支持 dry-run(
-p)
构建
go build ./cmd/matchsubtitles
用法
1) 普通媒体 + 字幕匹配
./matchsubtitles -s /path/subtitles -m /path/media
2) 原盘 + 字幕匹配(自动)
./matchsubtitles -s /path/subtitles -b /path/disc1 -b /path/disc2
3) 原盘强制分配(每盘固定数量)
./matchsubtitles -s /path/subtitles -b /path/disc1 -b /path/disc2 -f -e 2
4) 输出到目标目录(只打印计划,不落盘)
./matchsubtitles -s /path/subtitles -m /path/media -t /path/target -p
参数
-s, --subtitle字幕目录(必填)-m, --media媒体目录(与-b二选一)-b, --bdmv原盘目录,可重复-t, --target目标目录-f, --force强制分配模式(原盘)-e, --each每盘固定数量(需配合-f)-r, --reverse反向分配(原盘平均模式)-c, --copy复制字幕-l, --hardlink硬链接字幕-p, --print仅打印计划(dry-run)-pf, --prefix自定义文件名前缀-sf, --suffix自定义文件名后缀
项目结构
cmd/matchsubtitles/ # 程序入口
internal/cli/ # 参数解析
internal/scan/ # 扫描/提取剧集号
internal/match/ # 匹配与分配策略
internal/plan/ # 目标路径规划
internal/ops/ # 文件操作执行