Skip to content

Conversation

@awsl1414
Copy link
Contributor

@awsl1414 awsl1414 commented Jan 1, 2026

随机播放按钮只能开启或关闭,不能切换为心动模式
大概率修复 #694

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @awsl1414, 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

  • 修复本地播放模式逻辑: 解决了当播放列表中包含本地歌曲时,随机播放按钮无法正确切换模式的问题,特别是避免了进入“心动模式”。
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.

@awsl1414 awsl1414 changed the title fix: 🐛 修复本地播放模式逻辑 #694 fix: 🐛 修复本地播放模式逻辑 Jan 1, 2026
Copy link
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

你好,感谢你的贡献!这次的修改解决了本地播放模式下随机播放无法跳过心动模式的问题。代码逻辑是正确的,通过检查播放列表中是否存在本地歌曲来决定是否跳过心动模式。我有一个关于代码结构的建议,将这部分逻辑移到 PlayModeManager 中可能会使代码职责更清晰。具体请看我的评论。

Comment on lines +962 to +970
const hasLocalSongs = dataStore.playList.some((song) => song.path);

// 预判下一个模式
const nextMode = mode ?? this.playModeManager.calculateNextShuffleMode(currentMode);
let nextMode = mode ?? this.playModeManager.calculateNextShuffleMode(currentMode);

// 如果播放列表包含本地歌曲,跳过心动模式
if (hasLocalSongs && nextMode === "heartbeat") {
nextMode = "off";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这部分逻辑正确地实现了当播放列表包含本地歌曲时跳过心动模式的功能。

从代码结构和职责分离的角度来看,这部分关于播放模式的判断逻辑更适合放在 PlayModeManager 中。PlayModeManager 专门负责处理播放模式相关的逻辑,将这个判断移入其中可以使 PlayerController 的职责更纯粹(作为协调者),也让播放模式的管理更加内聚。

虽然目前的实现能够正常工作,但未来如果还有其他与播放模式相关的特殊逻辑,将它们都集中在 PlayModeManager 中会更易于维护。

这是一个关于代码组织结构的建议,你可以考虑在未来的重构中进行调整。

@imsyy imsyy merged commit 4606856 into imsyy:dev Jan 1, 2026
1 check failed
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