🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Fix resized image cache key
Deluan17eab6a88db5
diff --git a/consts/consts.go b/consts/consts.goindex 3c38ad42b..9bad1ee46 100644--- a/consts/consts.go+++ b/consts/consts.go@@ -57,8 +57,8 @@ const (PlaceholderArtistArt = "artist-placeholder.webp"PlaceholderAlbumArt = "placeholder.png"PlaceholderAvatar = "logo-192x192.png"-- DefaultUIVolume = 100+ UICoverArtSize = 300+ DefaultUIVolume = 100DefaultHttpClientTimeOut = 10 * time.Seconddiff --git a/core/artwork/cache_warmer.go b/core/artwork/cache_warmer.goindex df6a85e4b..5e0e6029f 100644--- a/core/artwork/cache_warmer.go+++ b/core/artwork/cache_warmer.go@@ -8,6 +8,7 @@ import ("time""github.com/navidrome/navidrome/conf"+ "github.com/navidrome/navidrome/consts""github.com/navidrome/navidrome/log""github.com/navidrome/navidrome/model""github.com/navidrome/navidrome/model/request"@@ -106,7 +107,7 @@ func (a *cacheWarmer) doCacheImage(ctx context.Context, id string) error {ctx, cancel := context.WithTimeout(ctx, 10*time.Second)defer cancel()- r, _, err := a.artwork.Get(ctx, id, 0)+ r, _, err := a.artwork.Get(ctx, id, consts.UICoverArtSize)if err != nil {return fmt.Errorf("error cacheing id='%s': %w", id, err)}diff --git a/core/artwork/image_cache.go b/core/artwork/image_cache.goindex 524ca7b38..2d59ee9ec 100644--- a/core/artwork/image_cache.go+++ b/core/artwork/image_cache.go@@ -15,7 +15,6 @@ import (type cacheKey struct {artID model.ArtworkID- size intlastUpdate time.Time}diff --git a/core/artwork/reader_resized.go b/core/artwork/reader_resized.goindex be0066596..aca9cdfd5 100644--- a/core/artwork/reader_resized.go+++ b/core/artwork/reader_resized.go@@ -20,28 +20,32 @@ import ()type resizedArtworkReader struct {- cacheKey- a *artwork+ artID model.ArtworkID+ cacheKey string+ lastUpdate time.Time+ size int+ a *artwork}func resizedFromOriginal(ctx context.Context, a *artwork, artID model.ArtworkID, size int) (*resizedArtworkReader, error) {r := &resizedArtworkReader{a: a}- r.cacheKey.artID = artID- r.cacheKey.size = size+ r.artID = artID+ r.size = size- // Get lastUpdated from original artwork+ // Get lastUpdated and cacheKey from original artworkoriginal, err := a.getArtworkReader(ctx, artID, 0)if err != nil {return nil, err}- r.cacheKey.lastUpdate = original.LastUpdated()+ r.cacheKey = original.Key()+ r.lastUpdate = original.LastUpdated()return r, nil}func (a *resizedArtworkReader) Key() string {return fmt.Sprintf("%s.%d.%d",- a.cacheKey.Key(),+ a.cacheKey,a.size,conf.Server.CoverJpegQuality,)