From 43ba5302e07f5d7c2cc682e6fde3c6c0ded2cc76 Mon Sep 17 00:00:00 2001 From: ali Date: Thu, 19 Nov 2026 20:14:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(parser):=20=E6=94=AF=E6=8C=81=20Exx=20?= =?UTF-8?q?=E9=9B=86=E5=8F=B7=E5=86=99=E6=B3=95=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20E01/E02=20=E5=85=A8=E9=83=A8=E8=A7=A3=E6=9E=90=E6=88=90=2001?= =?UTF-8?q?=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 苍兰诀这类命名 Love.Between.Fairy.and.Devil.2022.E01.V2… 没有 SxxEyy, 旧的 TARGET_EP 会先命中靠左的年份 2022,两个分组都为空 → 全部退化成 01, 触发「同剧集重复集号」安全拦截 - 重写 _episode_of:SxxEyy → EPx/Exx → 第x集/话/期 → 裸数字兜底 - 裸数字兜底排除:年份 19xx/20xx、分辨率/编码(720/1080/265…)、 AAC.2.0 / DDP5.1 这类声道写法,避免把 05.1080p 的 .1 误判成声道 - 实测:苍兰诀 E01~E07 正确映射为 S01E01~S01E07 --- media/src/services/parser.py | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/media/src/services/parser.py b/media/src/services/parser.py index 216dacb..bd042fc 100644 --- a/media/src/services/parser.py +++ b/media/src/services/parser.py @@ -97,18 +97,40 @@ class ParserService: @staticmethod def _episode_of(stem: str) -> str: - """取集号:优先 SxxEyy,其次 第x集/EPx,最后兜底 01。 + """取集号,按可靠性依次尝试: - 不能直接用 TARGET_EP 的第一个分组——它会先命中裸数字(比如年份 2026)。 + 1. SxxEyy —— 标准写法 + 2. EPxx / Exx —— 很多国漫/网剧用 Love.Between.Fairy.and.Devil.2022.E01 + 3. 第x集/话/期 —— 中文写法 + 4. 裸数字兜底 —— 排除年份(19xx/20xx)、分辨率/编码(720/1080/265…)、 + 以及 AAC.2.0 / DDP5.1 这类声道写法 + + 不能直接用 TARGET_EP 的第一个分组:它会先命中靠左的年份。 """ sxe = re.search(r"S(\d{1,2})E(\d{1,4})", stem, re.I) if sxe: return sxe.group(2).zfill(2) - match = RegexPatterns.TARGET_EP.search(stem) - if match: - value = match.group(1) or match.group(2) - if value: - return value.zfill(2) + + epx = re.search(r"(?