-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(ui,scanner,subsonic): Allow nullable replaygain and support 0.0 #4239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolves navidrome#4236. Makes the replaygain columns (track/album gain/peak) nullable. Converts the type to a pointer, allowing for 0.0 (a valid value) to be returned from Subsonic. Updates tests for this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @kgarner7, 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 addresses a long-standing issue where replaygain values of 0.0
were not correctly distinguished from missing values. By introducing nullable fields for replaygain in the data model and database, and updating the entire processing pipeline from metadata extraction to API responses, the system can now accurately represent and communicate explicit zero replaygain values, improving data integrity and client compatibility.
Highlights
- Data Model Update: The
RGAlbumGain
,RGAlbumPeak
,RGTrackGain
, andRGTrackPeak
fields in theMediaFile
model (and related structs likedbMediaFile
andReplayGain
in Subsonic responses) have been changed fromfloat64
to*float64
. This allows these replaygain values to benil
(representing missing data) or0.0
(representing an explicit zero value), resolving an issue where0.0
was indistinguishable from missing data. - Database Migration: A new database migration (
20250701010104_make_replaygain_fields_nullable.go
) has been added to alter themedia_file
table, making therg_album_gain
,rg_album_peak
,rg_track_gain
, andrg_track_peak
columns nullable. Existing data is preserved during this migration. - Metadata Extraction Logic: The metadata extraction logic (
model/metadata/map_mediafile.go
andmodel/metadata/metadata.go
) has been updated to correctly parse and map replaygain values from tags to the new*float64
fields. This includes a newFloatPointer
helper and modifications tomapGain
to returnnil
for invalid or missing values, and a pointer tofloat64
for valid ones, including0.0
. - Subsonic API Compatibility: The Subsonic API response serialization (
server/subsonic/responses/responses.go
) has been adjusted. TheReplayGain
element will now be omitted from XML/JSON responses only if all its fields arenil
. If any replaygain value is explicitly0.0
, it will be included in the response, ensuring correct behavior for clients that expect0.0
as a valid value. - Test Coverage: Extensive updates have been made to end-to-end tests, metadata tests, persistence tests, and Subsonic API tests to validate the new nullable and
0.0
handling for replaygain fields across the application stack.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
There was a problem hiding this 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 modifies the system to handle nullable ReplayGain values. The most significant point for improvement is the implementation of the down
migration to ensure schema rollback capability.
Signed-off-by: Deluan <deluan@navidrome.org>
Resolves #4236.
Makes the replaygain columns (track/album gain/peak) nullable. Converts the type to a pointer, allowing for 0.0 (a valid value) to be returned from Subsonic. Updates tests for this behavior.