refactor(music): 音乐识别核心下沉 MetaMusic 并优化 MusicBrainz 检索

- 标题解析核心从 app/helper/music.py 迁移到 MetaMusic(apply_title),
  删除 music helper,metainfo/chain 调用点切换
- 解析增强:全角归一、场景点分命名、年份区间双模式、日期前缀、
  视频标记剔除、VA 合辑署名归一、尾部年份提取、CJK 连字符拆分
- MusicBrainz 性能:全局 Session keep-alive 复用(6.3s→0.35s/请求),
  无艺术家线索时跳过专辑回退检索
- 候选挑选支持冒号副标题弱匹配,检索式剥离尾部年份减少无效检索
- 测试:test_metamusic 32 案例、musicbrainz 弱匹配/检索式新用例
This commit is contained in:
jxxghp
2026-08-11 08:18:27 +08:00
parent a15b8542ea
commit f09f81df72
11 changed files with 1614 additions and 399 deletions
+3 -2
View File
@@ -12,7 +12,6 @@ from app.core.meta.infopath import (
should_use_parent_title_for_file_stem,
)
from app.core.meta.words import WordsMatcher
from app.helper.music import MusicNameParser
from app.log import logger
from app.schemas.types import MediaType
from app.utils import rust_accel
@@ -437,6 +436,7 @@ def MetaInfo(title: str, subtitle: Optional[str] = None, custom_words: List[str]
org_string=title,
title=Path(title).stem,
audio_format=audio_suffix.lstrip(".").upper() or None,
parse_title=True,
)
rust_meta = None
if not _requires_python_metainfo(title, custom_words):
@@ -468,9 +468,10 @@ def MetaInfoPath(path: Path, custom_words: List[str] = None, force_video: bool =
org_string=path.name,
title=path.stem,
audio_format=audio_suffix.lstrip(".").upper() or None,
parse_title=True,
)
# 无标签音频只能依靠文件名和目录结构,补充曲序、碟号、歌手和专辑线索
return MusicNameParser.apply_path_context(music_meta, path)
return music_meta.apply_path_context(path)
path_context = " ".join(
[path.name, path.parent.name, path.parent.parent.name]
)