feat: 支持本地 TTML 歌词三档匹配强度与设置选项 - #238
Open
kid141252010 wants to merge 1 commit into
Open
Conversation
kid141252010
force-pushed
the
feat/local-ttml-match-level
branch
from
September 5, 2026 06:02
2d07e72 to
8f438a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动类型
是否包含破坏性变更
改动说明
背景与动机
此前本地 TTML 歌词库(
localLyricRepo)在按标题匹配时,将艺术家仅作为“软性消歧”而非硬门槛(同名文件只有 1 首时直接命中;有多首且艺术家都不符合时依然兜底返回第 1 首)。由于本地 TTML 库具有最高覆盖优先级(Override),这会导致“同名异曲”(例如不同歌手但歌名相同的情况)被强制错误匹配并置顶展示,同时打断了后续在线正确歌词的检索流程。主要改动
LocalLyricMatchLevel):strict):必须通过网易云/QQ 平台 ID 精确命中,或歌名与艺术家完全一致;不接受子串包含,元数据缺失时不匹配;彻底杜绝误匹。standard,默认推荐):歌名必须一致,且艺术家必须匹配(支持完全一致、多歌手拆分、合唱、feat.包含关系);单方缺失艺术家元数据时允许容错;双方均有明确艺术家但互不相干时坚决拒绝兜底,避免同名异曲误匹配。loose):保持原先行为,歌名一致即可强行匹配,适合本地文件标签极不规范的用户。electron/main/apis/common/lyric/utils.ts中的artistMatches与normalizeTrackArtists;zh-CN与en-US多语言翻译。关联 Issue
测试情况
pnpm typecheck(Node 与 Web 端类型编译)均通过。pnpm test:web,10 个测试文件(57 个用例)全部通过。周杰伦 / 五月天阿信):标准模式与严格模式均能正常精确命中。feat.包含场景:标准模式正常命中,严格模式拒绝模糊匹配。截图 / 录屏
呃懒
自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交