fix(transhandler): suppress noisy error notification for TV special and extra sample files without episode numbers

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.
This commit is contained in:
naughtyGitCat
2026-08-08 14:56:57 +08:00
committed by jxxghp
parent 2bf2d89c52
commit 3eed518f83

View File

@@ -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,