fix(renamer): 跳过已按目标名生成的字幕,避免复跑把 internal 字幕改名
复跑时 scan_existing_subtitles 会把流水线自己产出的 *.internal.und.srt 当成外挂字幕, 改名成 <目标名>.zh-CN.2.srt(并随每次复跑不断追加 .3/.4 后缀)。 现对 <target_stem>.* 开头的字幕直接跳过,保持幂等。
This commit is contained in:
@@ -15,6 +15,10 @@ class RenamerService:
|
|||||||
has_external_sub = False
|
has_external_sub = False
|
||||||
for sub in f_path.parent.glob("*"):
|
for sub in f_path.parent.glob("*"):
|
||||||
if sub.is_file() and sub.suffix.lower() in {'.srt', '.ass', '.ssa'}:
|
if sub.is_file() and sub.suffix.lower() in {'.srt', '.ass', '.ssa'}:
|
||||||
|
# 🛡️ 幂等保护:本工具已按目标名生成过的字幕(含 *.internal.<lang>.srt 与去重用的 .2/.3 后缀)
|
||||||
|
# 不再参与"外挂字幕规范化",否则复跑时会被改名成 <目标名>.zh-CN.2.srt,丢掉 internal 标识且不断产生新后缀。
|
||||||
|
if sub.name.startswith(f"{target_stem}."):
|
||||||
|
continue
|
||||||
is_match = False
|
is_match = False
|
||||||
if f_path.stem in sub.name: is_match = True
|
if f_path.stem in sub.name: is_match = True
|
||||||
elif m_type == "tv":
|
elif m_type == "tv":
|
||||||
|
|||||||
Reference in New Issue
Block a user