feat(cli): 新增 --rename-only,并把综艺期名尾巴做成改名时保留

- --rename-only:只做重命名,跳过字幕抽取/广告清理/音轨扫描。
  整库改名时 auto 模式会顺带抽内嵌 ASS(每个 2 分钟),本次回溯因此中断过一次
- renamer 保留 <规范名>-YYYYMMDD.期名 的尾巴:技术标签变化会重算前缀,
  之前会把期名整段丢掉(WEB-DL 里的连字符不能当作分隔符)
- 已按新标签回溯全库:动漫电影 117、动漫节目 92、电影 404、电视节目 3309、
  综艺 603 条重命名,0 错误、0 冲突副本
This commit is contained in:
ali
2026-11-20 00:23:29 +08:00
parent b04f9b060c
commit 1d5b4653da
3 changed files with 14 additions and 5 deletions
+4 -2
View File
@@ -222,7 +222,7 @@ class MediaPipeline:
else:
log.debug(f"✨ [完美豁免] {f.name} 已达最高工业标准,直接放行~")
if self.args.mode != "clean-ads":
if self.args.mode != "clean-ads" and not getattr(self.args, "rename_only", False):
# 文本字幕(ASS / SRT)外置化只对必须转码的片源做:
# 直传片源的内嵌字幕客户端能直接渲染,不需要外挂副本。
# 显式 extract-subs 或 --extract-internal 视为强制,不受此限制。
@@ -264,7 +264,9 @@ class MediaPipeline:
if config.EXTRACT_FONTS and want_text_subs:
SubtitleService.scan_fonts(f, self.task_mgr, dest_dir)
if self.args.mode != "extract-subs" and not skip_heavy:
if (self.args.mode != "extract-subs" and not skip_heavy
and not getattr(self.args, "rename_only", False)):
MetadataService.scan_ads(f, self.task_mgr)
MetadataService.scan_audio_tracks(f, self.task_mgr)
+2
View File
@@ -23,6 +23,8 @@ def main():
help="强制指定媒体类型 (tv 或 movie),解决正则误判")
parser.add_argument("--show", type=int, default=None,
help="综艺整理:直接指定 TMDB 剧集 id(默认从目录名 [tmdbid-xxx] 推断)")
parser.add_argument("--rename-only", action="store_true",
help="只做重命名,跳过字幕抽取/广告清理等重活(整库改名用)")
parser.add_argument("--yes", action="store_true",
help="非交互确认:直接执行生成的计划,不再询问(批处理用)")
args = parser.parse_args()
+8 -3
View File
@@ -108,12 +108,17 @@ class RenamerService:
@staticmethod
def scan_rename(f_path: Path, target_stem: str, m_type: str, dest_dir: Path, target_season_folder: str, root_dir_path: Path, target_root_folder: str, task_mgr):
# 「<目标名>-说明」视为已规范:综艺整理会在技术标签后用「-期名」补充描述,
# 综艺命名约定:<规范名>-<YYYYMMDD>.<期名>。技术标签变化时这段说明要保留,
# 否则整库整理会把期名抹掉(WEB-DL 里也有连字符,不能简单按 "-" 切)。
tail_match = re.search(r"(-\d{8}\..+)$", f_path.stem)
tail = tail_match.group(1) if tail_match else ""
# 「<目标名>-说明」视为已规范:综艺整理会加这段说明,
# 整库扫描不应把它当作错名再改回去。
if f_path.stem == target_stem or f_path.stem.startswith(f"{target_stem}-"):
if f_path.stem == target_stem or f_path.stem == f"{target_stem}{tail}":
reserved_new_path = f_path
else:
new_path = dest_dir / f"{target_stem}{f_path.suffix.lower()}"
new_path = dest_dir / f"{target_stem}{tail}{f_path.suffix.lower()}"
reserved_new_path = task_mgr.reserve_path(new_path, source_path=f_path)
if f_path.resolve() != reserved_new_path.resolve():