Skip to content

🦄 refactor: 更换更好的 LRC 解析器#813

Merged
apoint123 merged 2 commits into
SPlayer-Dev:devfrom
apoint123:refactor/refine-lrc-parser
Feb 3, 2026
Merged

🦄 refactor: 更换更好的 LRC 解析器#813
apoint123 merged 2 commits into
SPlayer-Dev:devfrom
apoint123:refactor/refine-lrc-parser

Conversation

@apoint123
Copy link
Copy Markdown
Member

更换一个更好的 LRC 解析器,支持:

@apoint123 apoint123 marked this pull request as ready for review February 3, 2026 05:35
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @apoint123, 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!

本次拉取请求通过引入一个自定义的、功能更强大的 LRC 歌词解析器来重构歌词解析机制。主要目标是改进歌词处理,通过在遇到空行时自动确定歌词行的结束时间,并智能识别具有相同时间戳的多行歌词中的翻译和音译行。此增强功能旨在提供更丰富、更准确的歌词显示体验。

Highlights

  • 引入新的 LRC 解析器: 在 src/utils/parseLrc.ts 中引入了一个新的 parseLrc 函数,用于更灵活和强大的歌词解析。
  • 增强的解析功能: 新的解析器支持自动将空行识别为前一行的结束时间,并能自动识别具有相同时间戳的歌词行中的翻译和音译内容。
  • 集成新解析器: LyricManagerlyricParser.ts 文件已更新,以使用这个新的本地 parseLrc 函数,替换了原有的 @applemusic-like-lyrics/lyric 库中的解析器。
Changelog
  • src/core/player/LyricManager.ts
    • 更新了 parseLrc 的导入路径,指向新的本地工具函数。
    • 调整了 SongLyricSongType 的类型导入方式。
    • 移动了 applyBracketReplacement 的导入位置。
  • src/utils/lyric/lyricParser.ts
    • 移除了从 @applemusic-like-lyrics/lyric 导入 parseLrc
    • 添加了对新的本地 parseLrc 函数的导入。
  • src/utils/parseLrc.ts
    • 新增文件,实现了一个自定义的 parseLrc 函数。
    • 此函数负责解析 LRC 内容,处理时间标签,对事件进行排序,并构建 LyricLine 对象。
    • 它包含了自动设置歌词行 endTime 的逻辑,并根据具有相同时间戳的多行歌词来分配 translatedLyricromanLyric
Activity
  • 目前没有人工活动。
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

你好,感谢你的贡献!这次重构引入了一个新的 LRC 解析器,增强了对翻译和音译行的自动识别,以及对空行时间戳的处理,这是一个很棒的改进。

代码整体结构清晰,新解析器的逻辑也比较完善。我提出了一些具体的建议,主要集中在新创建的 src/utils/parseLrc.ts 文件中,旨在提高代码的健壮性和可维护性:

  • 建议使用整数运算来处理时间戳,以避免潜在的浮点数精度问题。
  • 建议通过提取辅助函数来减少代码重复。

请查看我的具体评论。期待这些修改能让代码质量更上一层楼!

Comment thread src/utils/parseLrc.ts Outdated
Comment thread src/utils/parseLrc.ts
@apoint123 apoint123 force-pushed the refactor/refine-lrc-parser branch from ac728bf to 1f31e65 Compare February 3, 2026 07:02
@apoint123 apoint123 merged commit 21fda85 into SPlayer-Dev:dev Feb 3, 2026
@apoint123 apoint123 deleted the refactor/refine-lrc-parser branch February 3, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants