Skip to content

Conversation

@RetricSu
Copy link
Owner

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

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

This pull request introduces a new lyrics display feature, allowing users to view synchronized or plain lyrics for the currently playing track. It integrates an asynchronous lyrics fetching service with the application's UI and player controls, enhancing the user experience by providing immediate access to song lyrics.

Highlights

  • Lyrics Display UI: A new LyricsComponent and a toggleable right-side panel have been added to display lyrics, supporting both synchronized and plain text formats, as well as indicating instrumental tracks.
  • Asynchronous Lyrics Fetching: An lrclib.net-powered LyricsService runs in a separate thread, fetching lyrics for the current track using ureq and urlencoding without blocking the main UI thread.
  • Player Integration: Lyrics fetching is automatically triggered upon track selection (from playlist, search, or next/previous controls) and when restoring a previously played track on app startup.
  • UI Controls: A dedicated "lyrics" button in the player controls and a new "View" menu option allow users to easily toggle the visibility of the lyrics panel.
  • Internationalization: New UI strings for the lyrics feature have been added to the English and Chinese language files.
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

@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

This pull request successfully implements a lyrics fetching and display feature. It introduces a LyricsService that runs in a background thread to fetch lyrics from an external API without blocking the UI, and a new LyricsComponent to display them. The changes are well-integrated across the application, with lyrics being fetched automatically on track changes. My review focuses on improving code clarity, maintainability by reducing duplication, and ensuring the UI respects theming conventions.

Comment on lines +60 to +80
if let Some(lyrics_data) = &self.current_lyrics {
if lyrics_data.instrumental
|| !lyrics_data.lines.is_empty()
|| lyrics_data.plain_lyrics.is_some()
{
self.show_lyrics_panel = true;
}
}
if let Some(lyrics_data) = &self.current_lyrics {
if lyrics_data.instrumental {
tracing::info!("✅ Found instrumental track");
} else if !lyrics_data.lines.is_empty()
|| lyrics_data.plain_lyrics.is_some()
{
tracing::info!("✅ Lyrics loaded successfully");
} else {
tracing::warn!("⚠️ Lyrics record found but no content available");
}
} else {
tracing::warn!("❌ No lyrics found");
}

Choose a reason for hiding this comment

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

medium

The logic to handle the received lyrics can be simplified by merging the two if let Some(lyrics_data) = &self.current_lyrics blocks. This improves readability and reduces redundancy.

                    if let Some(lyrics_data) = &self.current_lyrics {
                        let has_content = lyrics_data.instrumental
                            || !lyrics_data.lines.is_empty()
                            || lyrics_data.plain_lyrics.is_some();

                        if has_content {
                            self.show_lyrics_panel = true;
                            if lyrics_data.instrumental {
                                tracing::info!("✅ Found instrumental track");
                            } else {
                                tracing::info!("✅ Lyrics loaded successfully");
                            }
                        } else {
                            tracing::warn!("⚠️  Lyrics record found but no content available");
                        }
                    } else {
                        tracing::warn!("❌ No lyrics found");
                    }

Comment on lines +25 to +30
ui.add(egui::Label::new(
egui::RichText::new("♪ Instrumental ♪")
.color(egui::Color32::from_rgb(150, 150, 150))
.size(16.0)
.italics(),
));

Choose a reason for hiding this comment

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

medium

Hardcoding colors like egui::Color32::from_rgb(150, 150, 150) and egui::Color32::BLACK prevents the UI from adapting to different themes (e.g., a dark theme). It's better to use theme-aware colors from ui.style().visuals. For example, use ui.style().visuals.text_color() for standard text and ui.style().visuals.weak_text_color() for subdued text. This applies to several places in this file.

Suggested change
ui.add(egui::Label::new(
egui::RichText::new("♪ Instrumental ♪")
.color(egui::Color32::from_rgb(150, 150, 150))
.size(16.0)
.italics(),
));
ui.add(egui::Label::new(
egui::RichText::new("♪ Instrumental ♪")
.color(ui.style().visuals.weak_text_color())
.size(16.0)
.italics(),
));

Comment on lines +79 to +83
let label = if line.text.trim().is_empty() {
"♪".to_string()
} else {
line.text.clone()
};

Choose a reason for hiding this comment

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

medium

In the loop for displaying synced lyrics, line.text.clone() creates a new String on every iteration. This is inefficient. You can avoid the allocation by passing a string slice &line.text to egui::RichText::new(), as it accepts any type that implements Into<WidgetText>.

Suggested change
let label = if line.text.trim().is_empty() {
"♪".to_string()
} else {
line.text.clone()
};
let label: &str = if line.text.trim().is_empty() {
"♪"
} else {
&line.text
};

Comment on lines +135 to +139
let search_url = format!(
"https://lrclib.net/api/search?artist_name={}&track_name={}",
urlencoding::encode(artist),
urlencoding::encode(title)
);

Choose a reason for hiding this comment

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

medium

The API URL is hardcoded inside the fetch_from_api function. It's good practice to define this as a constant at the module level. This makes it easier to find and change if the API endpoint ever moves.

For example, you could add this at the top of the file:

const LRC_API_SEARCH_URL: &str = "https://lrclib.net/api/search";

And then use it here.

@RetricSu RetricSu merged commit b44af21 into develop Oct 20, 2025
4 checks passed
@RetricSu RetricSu deleted the add-lyrics branch October 20, 2025 08:30
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