From dc6d228603b67983e7d0a46d9d22c05a50fa6c41 Mon Sep 17 00:00:00 2001 From: ali Date: Fri, 20 Nov 2026 00:37:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(variety):=20=E6=95=A3=E5=9C=A8=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=9A=84=E6=AD=A3=E7=89=87=E6=8C=89=E5=AD=A3?= =?UTF-8?q?=E5=BD=92=E4=BD=8D=20Season=20XX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 之前只在原地改名,哈哈哈哈哈 的 24 集正片都堆在剧集根目录; 现在根目录的文件会按季号移进 Season 06 / Season 00 - 已在子目录里的文件保持原位(你好星期六 的 Season 04/05 不动) - 目标与源同名时直接跳过,不再计入「跳过」统计 - 实测:哈哈哈哈哈 根目录清空,Season 06 = 24 集、Season 00 = 24 个特典 --- media/src/services/variety.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/media/src/services/variety.py b/media/src/services/variety.py index 7d533fa..ed65777 100644 --- a/media/src/services/variety.py +++ b/media/src/services/variety.py @@ -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"]: