From f4e14e9c1a8dbcbfdf13bcd51fbbdb82e38cf52b Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 23 Jul 2026 00:43:04 -0400 Subject: [PATCH] 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. --- core/artwork/serving.go | 4 +++- core/artwork/serving_test.go | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/artwork/serving.go b/core/artwork/serving.go index 109d0033d..97c46fc9b 100644 --- a/core/artwork/serving.go +++ b/core/artwork/serving.go @@ -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 diff --git a/core/artwork/serving_test.go b/core/artwork/serving_test.go index 529cd5e24..b71ae1e05 100644 --- a/core/artwork/serving_test.go +++ b/core/artwork/serving_test.go @@ -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() {