diff --git a/media/src/core/config.py b/media/src/core/config.py index eee9260..37040a4 100644 --- a/media/src/core/config.py +++ b/media/src/core/config.py @@ -136,6 +136,13 @@ SUPPORTED_EXTS = set(_parser.get('Media', 'supported_exts', fallback='.mkv,.mp4, SIDECAR_EXTS = set(_parser.get('Media', 'sidecar_exts', fallback='.nfo,.jpg,.jpeg,.png,.bif,.xml,.srt,.ass,.ssa,.vtt').lower().split(',')) EXCLUDE_DIRS = [d.strip() for d in _parser.get('Media', 'exclude_dirs', fallback='').split(',') if d.strip()] + +# 额外内容目录(Jellyfin 命名约定):这些目录里的视频不是正片,扫描阶段直接跳过。 +# 否则 extras/ 下的文件会被当成正片去搜 TMDB(曾把「extras」搜成 2024 年的同名电影)。 +EXTRAS_DIRS = [d.strip().lower() for d in _parser.get( + 'Media', 'extras_dirs', + fallback='extras,featurettes,behind the scenes,deleted scenes,interviews,scenes,shorts,trailers,samples' +).split(',') if d.strip()] AD_KEYWORDS = _parser.get('Ads', 'keywords', fallback='推广信息').split(',') # 3. 运行默认参数(CLI 未给出时生效) diff --git a/media/src/core/pipeline.py b/media/src/core/pipeline.py index fb664bf..96760ac 100644 --- a/media/src/core/pipeline.py +++ b/media/src/core/pipeline.py @@ -63,6 +63,12 @@ class MediaPipeline: if any(part.startswith('.') for part in f.relative_to(self.target_dir).parts): continue + # Jellyfin 的额外内容目录(extras/trailers/featurettes…)不算正片 + parents = {p.lower() for p in f.relative_to(self.target_dir).parts[:-1]} + if parents & set(config.EXTRAS_DIRS): + log.debug(f"⏭ [额外内容] 跳过: {f.parent.name}/{f.name}") + continue + # 黑名单拦截 if any(excl in str(f) for excl in config.EXCLUDE_DIRS): log.debug(f"🛑 [黑名单拦截] 命中排除规则,跳过扫描: {f.parent.name}/{f.name}")