No description
  • Python 63.5%
  • Go 29.1%
  • Shell 6.1%
  • Batchfile 0.8%
  • Makefile 0.5%
Find a file
2026-02-24 04:04:26 +08:00
cmd test(parity): add full dataset parity harness and improve order extraction/normalization 2026-02-24 03:39:19 +08:00
internal fix(scan): use rune-safe prefix/suffix heuristics for subtitle parsing 2026-02-24 04:04:26 +08:00
rule 重命名规则改写 2023-05-24 16:28:23 +08:00
scripts test(parity): add full dataset parity harness and improve order extraction/normalization 2026-02-24 03:39:19 +08:00
setting .5集字幕无法识别修正 2023-05-24 11:14:34 +08:00
test 重命名规则改写 2023-05-24 16:28:23 +08:00
tools .5集字幕无法识别修正 2023-05-24 11:14:34 +08:00
utils 自动匹配规则优化 2023-05-15 14:06:18 +08:00
.gitignore 细节修改 2023-02-16 16:18:37 +08:00
auto_test.cmd 命令自动测试脚本 2023-05-16 10:12:46 +08:00
go.mod rewrite: implement Go version with clean modular architecture 2026-02-24 02:52:23 +08:00
LICENSE Initial commit 2023-02-01 09:53:07 +08:00
Makefile chore: bootstrap local Go dev environment and stdlib-first workflow 2026-02-24 02:53:08 +08:00
match_subtitles.py -n 参数找不到bug修正 2023-06-07 16:59:28 +08:00
README.md rewrite: implement Go version with clean modular architecture 2026-02-24 02:52:23 +08:00
rule.csv 字幕翻译部分完成 2023-02-12 12:30:38 +08:00

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/            # 文件操作执行