feat(naming): 技术标签加入 HDR / 高帧率 / 隔行

- HDR:DV > HDR10+ > HDR10 > HLG(看 ffprobe 的 side_data 与 color_transfer),SDR 不写
- 高帧率:avg_frame_rate >= 49 时写 50fps / 60fps
- 隔行:仅当 field_order 明确为 tt/bb 时把 1080p 写成 1080i;
  ffprobe 对三分之二的文件返回 unknown,读不到一律按逐行处理
- 标签顺序:分辨率.来源.编码.位深[.HDR][.帧率].音频
  例:骄阳似我.S01E01.2025.2160p.WEB-DL.HEVC.10bit.HDR10.50fps.FLAC.2.0.5Audio.mkv
- 综艺命名同步支持(variety 也带 HDR/帧率,来源改为读文件名)
- docs/naming.md 补充 HDR/帧率/隔行与标签顺序说明
- 实测样本:50fps、60fps、HDR10、DV 均有真实文件命中
This commit is contained in:
ali
2026-11-19 23:54:28 +08:00
parent 9cb3fe6be9
commit b04f9b060c
4 changed files with 85 additions and 3 deletions
+39 -1
View File
@@ -49,7 +49,7 @@ class MediaInfoService:
"""
tags = {
"res": "1080p", "v_codec": "H264", "bits": "8bit",
"a_info": "AAC.2.0", "is_remux": False
"a_info": "AAC.2.0", "is_remux": False, "hdr": "", "fps": ""
}
# 💡 重构:直接调用 FFprobeUtil
@@ -76,6 +76,10 @@ class MediaInfoService:
tags['v_codec'] = MediaInfoService.video_codec_name(v_stream.get('codec_name', ''))
tags['bits'] = MediaInfoService.bit_depth(v_stream)
tags['hdr'] = MediaInfoService.hdr_tag(v_stream)
tags['fps'] = MediaInfoService.fps_tag(v_stream)
if MediaInfoService.is_interlaced(v_stream) and tags['res'] == '1080p':
tags['res'] = '1080i'
tags['a_info'] = MediaInfoService.describe_audio(data.get('streams', []))
@@ -188,6 +192,40 @@ class MediaInfoService:
return label
return "BluRay.REMUX" if tags.get("is_remux") else "WEB-DL"
@staticmethod
def hdr_tag(stream: dict) -> str:
"""HDR 标记:DV > HDR10+ > HDR10 / HLG;SDR 返回空串。"""
sides = stream.get("side_data_list") or []
joined = " ".join((s.get("side_data_type") or "") for s in sides).lower()
if "dovi" in joined or "dolby vision" in joined or "dolby_vision" in joined:
return "DV"
if "smpte2094-40" in joined or "hdr10+" in joined:
return "HDR10+"
transfer = (stream.get("color_transfer") or "").lower()
if transfer == "smpte2084":
return "HDR10"
if transfer == "arib-std-b67":
return "HLG"
return ""
@staticmethod
def fps_tag(stream: dict) -> str:
"""高帧率才写进文件名:>=49 记 50fps / 60fps,其余不写。"""
raw = stream.get("avg_frame_rate") or stream.get("r_frame_rate") or "0/0"
try:
num, den = raw.split("/")
fps = float(num) / float(den) if float(den) else 0.0
except (ValueError, ZeroDivisionError):
return ""
if fps >= 49:
return f"{round(fps)}fps"
return ""
@staticmethod
def is_interlaced(stream: dict) -> bool:
"""明确标注为隔行(tt/bb)才算;unknown 不能当隔行,否则会大面积误标。"""
return (stream.get("field_order") or "").lower() in ("tt", "bb")
@staticmethod
def describe_audio(streams: list) -> str:
"""把音轨信息压成一个标签:`TrueHD.5.1` / `DTS.5.1.2Audio`。
+6 -1
View File
@@ -189,7 +189,12 @@ class ParserService:
tid = f"[tmdbid-{tmdb['tmdb_id']}]" if (tmdb and config.INCLUDE_TMDB_ID) else ""
source = MediaInfoService.detect_source(f_path.name, tags)
tech = f"{tags['res']}.{source}.{tags['v_codec']}.{tags['bits']}.{tags['a_info']}"
# HDR 与高帧率只在有值时出现,插在位深之后、音频之前
extra = '.'.join(p for p in (tags.get('hdr'), tags.get('fps')) if p)
tech = '.'.join(p for p in (tags['res'], source, tags['v_codec'], tags['bits'], extra, tags['a_info']) if p)
folder_title = title.replace('.', ' ')
# 剧集根目录年份用「剧集首播年」:综艺每集年份不同(2022~2025),
+3 -1
View File
@@ -249,7 +249,9 @@ class VarietyService:
@staticmethod
def _target_name(file: Path, candidate: dict, media_title: str, season_years: dict) -> str:
tags = MediaInfoService.get_scene_tags(file)
tech = f"{tags['res']}.WEB-DL.{tags['v_codec']}.{tags['bits']}.{tags['a_info']}"
source = MediaInfoService.detect_source(file.name, tags)
extra = '.'.join(p for p in (tags.get('hdr'), tags.get('fps')) if p)
tech = '.'.join(p for p in (tags['res'], source, tags['v_codec'], tags['bits'], extra, tags['a_info']) if p)
season = candidate["season"]
# S00(特别篇)按「本集」播出年份,其余按季年份 —— 与常规整理保持一致
year = (candidate.get("air_year") if season == "00" else season_years.get(season)) or ""