From 3eed518f839b64d6c079ce22b4d40c4cb5aaabeb Mon Sep 17 00:00:00 2001 From: naughtyGitCat Date: Sat, 8 Aug 2026 14:56:57 +0800 Subject: [PATCH] fix(transhandler): suppress noisy error notification for TV special and extra sample files without episode numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BD-BOX releases for Anime and TV shows frequently contain extra non-episode video files (such as NCOP, NCED, Menu, PV, CM, SP, Event, Logo, etc.). When transferring these single files, the lack of an episode number previously logged a warning and triggered a noisy '整理失败:未识别到文件集数' notification to users. This change identifies known special/extra file patterns when begin_episode is None, logs them at INFO level, and suppresses the error notification while returning success to avoid false-positive failure alerts. --- app/modules/filemanager/transhandler.py | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/modules/filemanager/transhandler.py b/app/modules/filemanager/transhandler.py index 4bacbbc8a..e96fc3b60 100644 --- a/app/modules/filemanager/transhandler.py +++ b/app/modules/filemanager/transhandler.py @@ -191,6 +191,21 @@ class TransHandler: return True return False + def __is_special_extra_file(_fileitem: FileItem) -> bool: + """ + 判断是否为特典/附加视频文件(如 NCOP/NCED/Menu/CM/PV/Event/Logo 等无集数编号的视频/样本) + """ + file_name = _fileitem.name or "" + return bool( + re.search( + r"(?:^|[\s_.\-\[【(])(" + r"NC(?:OP|ED)|NCOP|NCED|OP|ED|MENU|PV|CM|TRAILER|TV\s*SPOT|SP|OVA|OAD|EVENT|IV|INTERVIEW|LOGO|PRODUCER\s*LOGO|BEHIND\s*THE\s*SCENES|FEATURETTE" + r")(?:\d*|[\s_.\-\]】)]|$)", + file_name, + re.IGNORECASE, + ) + ) + # 整理结果 result = TransferInfo() @@ -300,6 +315,17 @@ class TransHandler: if mediainfo.type == MediaType.TV: # 电视剧 if in_meta.begin_episode is None: + if __is_special_extra_file(fileitem): + logger.info(f"文件 {fileitem.path} 未识别到文件集数,识别为特典/附加视频文件,跳过正片集数整理") + self.__update_result( + result=result, + success=True, + fileitem=fileitem, + transfer_type=transfer_type, + need_notify=False, + ) + return result + logger.warn(f"文件 {fileitem.path} 整理失败:未识别到文件集数") self.__update_result( result=result,