feat(variety): 散在根目录的正片按季归位 Season XX

- 之前只在原地改名,哈哈哈哈哈 的 24 集正片都堆在剧集根目录;
  现在根目录的文件会按季号移进 Season 06 / Season 00
- 已在子目录里的文件保持原位(你好星期六 的 Season 04/05 不动)
- 目标与源同名时直接跳过,不再计入「跳过」统计
- 实测:哈哈哈哈哈 根目录清空,Season 06 = 24 集、Season 00 = 24 个特典
This commit is contained in:
ali
2026-11-20 00:37:14 +08:00
parent 1d5b4653da
commit dc6d228603
+6 -1
View File
@@ -296,13 +296,18 @@ class VarietyService:
for file, candidate in plan["renames"]:
target = file.with_name(cls._target_name(file, candidate, media_title, season_years))
# 散在剧集根目录的正片按季归位:根目录 → Season XX
if file.parent == folder and candidate["season"]:
target = folder / f"Season {candidate['season']}" / target.name
if target == file:
continue
if target.exists():
log.warning(f"⚠️ 目标已存在,跳过: {target.name}")
stats["skipped"] += 1
continue
target.parent.mkdir(parents=True, exist_ok=True)
file.rename(target)
log.info(f"✅ 改名: {file.name} → {target.name}")
log.info(f"✅ 改名: {file.name} → {target.relative_to(folder)}")
stats["renamed"] += 1
for file in plan["extras"]: