mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Fix ReplayGain values not being retrieved from DB
This commit is contained in:
parent
814161d78d
commit
e50382e3bf
4 changed files with 18 additions and 14 deletions
|
@ -67,10 +67,10 @@ type MediaFile struct {
|
|||
MbzAlbumArtistID string `structs:"mbz_album_artist_id" json:"mbzAlbumArtistId,omitempty"`
|
||||
MbzAlbumType string `structs:"mbz_album_type" json:"mbzAlbumType,omitempty"`
|
||||
MbzAlbumComment string `structs:"mbz_album_comment" json:"mbzAlbumComment,omitempty"`
|
||||
RGAlbumGain float64 `structs:"rg_album_gain" json:"rgAlbumGain"`
|
||||
RGAlbumPeak float64 `structs:"rg_album_peak" json:"rgAlbumPeak"`
|
||||
RGTrackGain float64 `structs:"rg_track_gain" json:"rgTrackGain"`
|
||||
RGTrackPeak float64 `structs:"rg_track_peak" json:"rgTrackPeak"`
|
||||
RgAlbumGain float64 `structs:"rg_album_gain" json:"rgAlbumGain"`
|
||||
RgAlbumPeak float64 `structs:"rg_album_peak" json:"rgAlbumPeak"`
|
||||
RgTrackGain float64 `structs:"rg_track_gain" json:"rgTrackGain"`
|
||||
RgTrackPeak float64 `structs:"rg_track_peak" json:"rgTrackPeak"`
|
||||
|
||||
CreatedAt time.Time `structs:"created_at" json:"createdAt"` // Time this entry was created in the DB
|
||||
UpdatedAt time.Time `structs:"updated_at" json:"updatedAt"` // Time of file last update (mtime)
|
||||
|
|
|
@ -63,8 +63,12 @@ var (
|
|||
songDayInALife = model.MediaFile{ID: "1001", Title: "A Day In A Life", ArtistID: "3", Artist: "The Beatles", AlbumID: "101", Album: "Sgt Peppers", Genre: "Rock", Genres: model.Genres{genreRock}, Path: P("/beatles/1/sgt/a day.mp3"), FullText: " a beatles day in life peppers sgt the"}
|
||||
songComeTogether = model.MediaFile{ID: "1002", Title: "Come Together", ArtistID: "3", Artist: "The Beatles", AlbumID: "102", Album: "Abbey Road", Genre: "Rock", Genres: model.Genres{genreRock}, Path: P("/beatles/1/come together.mp3"), FullText: " abbey beatles come road the together"}
|
||||
songRadioactivity = model.MediaFile{ID: "1003", Title: "Radioactivity", ArtistID: "2", Artist: "Kraftwerk", AlbumID: "103", Album: "Radioactivity", Genre: "Electronic", Genres: model.Genres{genreElectronic}, Path: P("/kraft/radio/radio.mp3"), FullText: " kraftwerk radioactivity"}
|
||||
songAntenna = model.MediaFile{ID: "1004", Title: "Antenna", ArtistID: "2", Artist: "Kraftwerk", AlbumID: "103", Genre: "Electronic", Genres: model.Genres{genreElectronic, genreRock}, Path: P("/kraft/radio/antenna.mp3"), FullText: " antenna kraftwerk"}
|
||||
testSongs = model.MediaFiles{
|
||||
songAntenna = model.MediaFile{ID: "1004", Title: "Antenna", ArtistID: "2", Artist: "Kraftwerk",
|
||||
AlbumID: "103", Genre: "Electronic", Genres: model.Genres{genreElectronic, genreRock},
|
||||
Path: P("/kraft/radio/antenna.mp3"), FullText: " antenna kraftwerk",
|
||||
RgAlbumGain: 1.0, RgAlbumPeak: 2.0, RgTrackGain: 3.0, RgTrackPeak: 4.0,
|
||||
}
|
||||
testSongs = model.MediaFiles{
|
||||
songDayInALife,
|
||||
songComeTogether,
|
||||
songRadioactivity,
|
||||
|
|
|
@ -68,10 +68,10 @@ func (s MediaFileMapper) ToMediaFile(md metadata.Tags) model.MediaFile {
|
|||
mf.MbzAlbumArtistID = md.MbzAlbumArtistID()
|
||||
mf.MbzAlbumType = md.MbzAlbumType()
|
||||
mf.MbzAlbumComment = md.MbzAlbumComment()
|
||||
mf.RGAlbumGain = md.RGAlbumGain()
|
||||
mf.RGAlbumPeak = md.RGAlbumPeak()
|
||||
mf.RGTrackGain = md.RGTrackGain()
|
||||
mf.RGTrackPeak = md.RGTrackPeak()
|
||||
mf.RgAlbumGain = md.RGAlbumGain()
|
||||
mf.RgAlbumPeak = md.RGAlbumPeak()
|
||||
mf.RgTrackGain = md.RGTrackGain()
|
||||
mf.RgTrackPeak = md.RGTrackPeak()
|
||||
mf.Comment = utils.SanitizeText(md.Comment())
|
||||
mf.Lyrics = md.Lyrics()
|
||||
mf.Bpm = md.Bpm()
|
||||
|
|
|
@ -178,10 +178,10 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
|
|||
child.MediaType = responses.MediaTypeSong
|
||||
child.MusicBrainzId = mf.MbzRecordingID
|
||||
child.ReplayGain = responses.ReplayGain{
|
||||
TrackGain: mf.RGTrackGain,
|
||||
AlbumGain: mf.RGAlbumGain,
|
||||
TrackPeak: mf.RGTrackPeak,
|
||||
AlbumPeak: mf.RGAlbumPeak,
|
||||
TrackGain: mf.RgTrackGain,
|
||||
AlbumGain: mf.RgAlbumGain,
|
||||
TrackPeak: mf.RgTrackPeak,
|
||||
AlbumPeak: mf.RgAlbumPeak,
|
||||
}
|
||||
return child
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue