diff options
| author | Cody Robibero <cody@robibe.ro> | 2026-08-05 19:04:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-05 19:04:05 -0400 |
| commit | cd5962df50ab493cc3739e6a81f66627670b7c8b (patch) | |
| tree | 86ffd9af27d1ecec2cc74abdb1118454321f1d3d | |
| parent | 9d99164c199e6fd9029daf068de7461aeba2367b (diff) | |
| parent | f6f0fed2d133481ba225fed06d18a656125b7948 (diff) | |
Parse ReplayGain album gain field
| -rw-r--r-- | CONTRIBUTORS.md | 1 | ||||
| -rw-r--r-- | MediaBrowser.Providers/MediaInfo/AudioFileProber.cs | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index edcff2b996..d61f1703b2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -236,6 +236,7 @@ - [Lampan-git](https://github.com/Lampan-git) - [elio42](https://github.com/elio42) - [rwebster85](https://github.com/rwebster85) + - [Florin-Popescu](https://github.com/Florin-Popescu) # Emby Contributors diff --git a/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs b/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs index b70cba5b3b..81d4b640a3 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs @@ -468,6 +468,24 @@ namespace MediaBrowser.Providers.MediaInfo } } + if (audio.AlbumEntity is not null && !audio.AlbumEntity.NormalizationGain.HasValue) + { + TryGetSanitizedAdditionalFields(track, "REPLAYGAIN_ALBUM_GAIN", out var trackAlbumGainTag); + + if (trackAlbumGainTag is not null) + { + if (trackAlbumGainTag.EndsWith("db", StringComparison.OrdinalIgnoreCase)) + { + trackAlbumGainTag = trackAlbumGainTag[..^2].Trim(); + } + + if (float.TryParse(trackAlbumGainTag, NumberStyles.Float, CultureInfo.InvariantCulture, out var value) && float.IsFinite(value)) + { + audio.AlbumEntity.NormalizationGain = value; + } + } + } + if (options.ReplaceAllMetadata || !audio.TryGetProviderId(MetadataProvider.MusicBrainzArtist, out _)) { if ((TryGetSanitizedAdditionalFields(track, "MUSICBRAINZ_ARTISTID", out var musicBrainzArtistTag) |
