Repository navigation
refactor(lyricParser): 修正并移动 alignLocalLyrics - #995
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在通过将歌词对齐逻辑从 Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
本 PR 将 LyricManager 内的本地歌词对齐逻辑抽离到 lyricParser,并重命名为 alignLyricLines,用于按时间戳将同一时间的多行歌词合并为“主句 + 翻译 + 音译”。
Changes:
- 新增
alignLyricLines:支持逐字歌词的时间字段读取,并新增endTime/maxTimeDiff参数以控制结束时间与时间差匹配策略 - 移除
LyricManager#alignLocalLyrics,并在本地歌词解析/覆盖等路径改用alignLyricLines - 修正(意图)注释单位与默认阈值策略(默认严格匹配)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/utils/lyric/lyricParser.ts | 新增 alignLyricLines,承载本地多行歌词的翻译/音译合并逻辑,并引入结束时间与时间差策略参数 |
| src/core/player/LyricManager.ts | 删除旧的 alignLocalLyrics,在本地歌词与覆盖歌词处理链路中切换为调用 alignLyricLines |
You can also share your feedback on Copilot code review. Take the survey.
| if (baseLine.words?.length) { | ||
| const lastWord = baseLine.words[baseLine.words.length - 1]; | ||
| const lastWordEndTime = lastWord.endTime; | ||
| if (lastWordEndTime === oldEndTime) { | ||
| lastWord.endTime = addEndTime; | ||
| } |
将 LyricManager 的 alignLocalLyrics 移动到了 lyricParser 并重命名为 alignLyricLines 修了一下,使之考虑了逐字歌词,设置结束时间时也考虑 `words`;增加了两个参数 `endTime` 和 `maxTimeDiff` 用于指定是否考虑结束时间和允许的时间差
0.6 ms 没必要比了,直接 0 吧
将 LyricManager 的 alignLocalLyrics 移动到了 lyricParser 并重命名为 alignLyricLines
修了一下,使之考虑了逐字歌词,设置结束时间时也考虑
words;增加了两个参数endTime和maxTimeDiff用于指定是否考虑结束时间和允许的时间差同时修复了 alignLyricLines 注释中的单位错误,更改 maxTimeDiff 默认值为 0(0.6 ms 没必要比了,直接 0 吧)