feat(subtitle): 文本字幕外置化仅限 TRANSCODE 源;右键菜单合并为级联子菜单
- 内嵌 ASS 抽取与字体抽取挂到 verdict == TRANSCODE(extract-subs / --extract-internal 仍可强制),直传片源不再生成外挂副本 - 外挂 SRT 兜底仅在 [Subtitles] export 不含 ass 时启用,避免同语言双份 - 新增同语言判重(含旧命名 <stem>.<lang>.srt),重复抽取不再产生重复字幕 - 识别中英双语轨为 zh-en,语言白名单加入 zh-en - 外挂字幕统一 <stem>.internal.<lang>.srt 命名 - 右键菜单合并为 SceneMarshal 级联子菜单(ExtendedSubCommandsKey), 四项:媒体整理 / 媒体归档 / 补外挂字幕 / 入库校验,图标 assets/menu 自绘 - HANDOFF 补右键菜单说明;新增 docs/movie-duplicates.md 记录电影库清理
This commit is contained in:
+20
-11
@@ -141,8 +141,16 @@ class MediaPipeline:
|
||||
log.debug(f"✨ [完美豁免] {f.name} 已达最高工业标准,直接放行~")
|
||||
|
||||
if self.args.mode != "clean-ads":
|
||||
# 必须转码的片源:补外挂文本字幕,避免客户端选内嵌字幕时投递失败
|
||||
if config.EXPORT_TEXT_SUBS and pf.verdict == TRANSCODE:
|
||||
# 文本字幕(ASS / SRT)外置化只对必须转码的片源做:
|
||||
# 直传片源的内嵌字幕客户端能直接渲染,不需要外挂副本。
|
||||
# 显式 extract-subs 或 --extract-internal 视为强制,不受此限制。
|
||||
forced_subs = bool(self.args.extract_internal) or self.args.mode == "extract-subs"
|
||||
want_text_subs = forced_subs or pf.verdict == TRANSCODE
|
||||
|
||||
# 外挂 SRT 兜底:只在没配置 ASS 导出时启用,
|
||||
# 否则同一语言会同时出现 .internal.<lang>.ass 和 .srt 两份。
|
||||
if (want_text_subs and config.EXPORT_TEXT_SUBS and pf.verdict == TRANSCODE
|
||||
and 'ass' not in config.SUBTITLE_EXPORT):
|
||||
text_subs = [s for s in pf.info.get("subs", [])
|
||||
if (s.get("codec") or "").lower() in SubtitleService.TEXT_SUB_CODECS]
|
||||
if text_subs:
|
||||
@@ -151,26 +159,27 @@ class MediaPipeline:
|
||||
SubtitleService.export_text_sidecars,
|
||||
(f, dest_dir, target_stem),
|
||||
)
|
||||
|
||||
if config.PREFER_INTERNAL:
|
||||
# 🎯 内嵌字幕优先:先看内嵌,有就不再处理外挂
|
||||
internal_subs = 0
|
||||
if not skip_heavy or self.args.extract_internal or self.args.mode == "extract-subs":
|
||||
internal_subs = SubtitleService.scan_subtitles(f, self.task_mgr, target_stem, dest_dir)
|
||||
elif SubtitleService.has_internal_sub(dest_dir, target_stem):
|
||||
# 完美文件名豁免时不做 ffprobe,但仍需识别"已有内嵌字幕"
|
||||
internal_subs = 1
|
||||
if want_text_subs:
|
||||
if not skip_heavy or forced_subs:
|
||||
internal_subs = SubtitleService.scan_subtitles(f, self.task_mgr, target_stem, dest_dir)
|
||||
elif SubtitleService.has_internal_sub(dest_dir, target_stem):
|
||||
# 完美文件名豁免时不做 ffprobe,但仍需识别"已有内嵌字幕"
|
||||
internal_subs = 1
|
||||
|
||||
if internal_subs == 0:
|
||||
RenamerService.scan_existing_subtitles(f, target_stem, m_type, dest_dir, self.task_mgr)
|
||||
else:
|
||||
# 旧行为:外挂优先,没有外挂(或强制)时才提取内嵌
|
||||
has_ext_sub = RenamerService.scan_existing_subtitles(f, target_stem, m_type, dest_dir, self.task_mgr)
|
||||
if (not has_ext_sub or self.args.extract_internal or self.args.mode == "extract-subs") and (
|
||||
not skip_heavy or self.args.extract_internal or self.args.mode == "extract-subs"):
|
||||
if want_text_subs and (not has_ext_sub or forced_subs) and (not skip_heavy or forced_subs):
|
||||
SubtitleService.scan_subtitles(f, self.task_mgr, target_stem, dest_dir)
|
||||
|
||||
# 内嵌字体附件(ASS 特效字体还原)
|
||||
if config.EXTRACT_FONTS:
|
||||
# 内嵌字体附件(ASS 特效字体还原):只有抽了 ASS 才有意义
|
||||
if config.EXTRACT_FONTS and want_text_subs:
|
||||
SubtitleService.scan_fonts(f, self.task_mgr, dest_dir)
|
||||
|
||||
if self.args.mode != "extract-subs" and not skip_heavy:
|
||||
|
||||
Reference in New Issue
Block a user