feat(pipeline): 跳过 extras 等额外内容目录,不再当正片处理
- Jellyfin 命名约定下的 extras/featurettes/trailers/samples 等目录里的视频 不是正片,扫描阶段直接跳过 - 此前 extras/ 里的文件会拿目录名去搜 TMDB,结果把「extras」搜成了 2024 年的同名电影,还要人工选候选 - 目录名不区分大小写;可用 config.ini 的 [Media] extras_dirs 覆盖默认列表 - 实测:Quark-Down/夏目友人帐 (2008)/extras 下 13 个文件全部跳过, 只剩 Season 00 的 6 个 OVA 参与处理
This commit is contained in:
@@ -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 未给出时生效)
|
||||
|
||||
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user