mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
fix(artwork): fall back to disc art, not the album, for multi-disc tracks
serveMediaFile delegated an absent/ineligible track straight to AlbumCoverArtID, skipping the disc-specific lookup that MediaFile.CoverArtID (and the deleted legacy reader) use. On multi-disc albums with per-disc images that served the album cover instead of the configured disc artwork. Delegate through DiscCoverArtID.
This commit is contained in:
parent
d15d85ad0c
commit
f4e14e9c1a
@ -244,7 +244,9 @@ func (s *service) serveMediaFile(ctx context.Context, artID model.ArtworkID, siz
|
||||
if noRow && conf.Server.EnableMediaFileCoverArt && mf.HasCoverArt {
|
||||
return s.provisionalEmbedded(ctx, artID, *mf, size, square)
|
||||
}
|
||||
return s.Get(ctx, mf.AlbumCoverArtID(), size, square)
|
||||
// Mirror MediaFile.CoverArtID's fallback: a multi-disc track defers to its disc art
|
||||
// (which itself falls back to the album), not straight to the album.
|
||||
return s.Get(ctx, mf.DiscCoverArtID(), size, square)
|
||||
}
|
||||
|
||||
// provisionalEmbedded extracts a track's embedded art for an immediate serve and always
|
||||
|
||||
@ -253,6 +253,19 @@ var _ = Describe("Service", func() {
|
||||
_, err = artRepo.GetItemArtwork("mf", "mf4", model.ImageTypePrimary)
|
||||
Expect(err).To(MatchError(model.ErrNotFound))
|
||||
})
|
||||
|
||||
It("delegates a multi-disc track to its disc art, not straight to the album", func() {
|
||||
// Not embedded-eligible: the fallback must mirror CoverArtID (disc first, then album).
|
||||
folderRepo.result = []model.Folder{{Path: "tests/fixtures/artist/an-album", ImageFiles: []string{"cover.jpg"}}}
|
||||
albumRepo.SetData(model.Albums{{ID: "aldd", Name: "Album", FolderIDs: []string{"f1"}}})
|
||||
seedFoundStore("al", "aldd", []byte("album-art-distinct")) // album's own found art differs
|
||||
mfRepo.SetData(model.MediaFiles{{ID: "mf5", AlbumID: "aldd", DiscNumber: 1, HasCoverArt: false}})
|
||||
|
||||
img, err := svc.Get(ctx, model.MustParseArtworkID("mf-mf5"), 0, false)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
// The disc-folder image wins over the album's found art, proving it routed via serveDisc.
|
||||
Expect(readAll(img)).To(Equal(coverBytes))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("disc", func() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user