PreCache artist images

This commit is contained in:
Deluan
2023-01-13 14:30:26 -05:00
committed by Deluan Quintão
parent cbe3adf987
commit 3f2d24695e
8 changed files with 51 additions and 20 deletions
+5 -3
View File
@@ -8,6 +8,7 @@ import (
"time"
"github.com/lestrrat-go/jwx/v2/jwt"
"github.com/navidrome/navidrome/core"
"github.com/navidrome/navidrome/core/auth"
"github.com/navidrome/navidrome/core/ffmpeg"
"github.com/navidrome/navidrome/log"
@@ -20,14 +21,15 @@ type Artwork interface {
Get(ctx context.Context, id string, size int) (io.ReadCloser, time.Time, error)
}
func NewArtwork(ds model.DataStore, cache cache.FileCache, ffmpeg ffmpeg.FFmpeg) Artwork {
return &artwork{ds: ds, cache: cache, ffmpeg: ffmpeg}
func NewArtwork(ds model.DataStore, cache cache.FileCache, ffmpeg ffmpeg.FFmpeg, em core.ExternalMetadata) Artwork {
return &artwork{ds: ds, cache: cache, ffmpeg: ffmpeg, em: em}
}
type artwork struct {
ds model.DataStore
cache cache.FileCache
ffmpeg ffmpeg.FFmpeg
em core.ExternalMetadata
}
type artworkReader interface {
@@ -96,7 +98,7 @@ func (a *artwork) getArtworkReader(ctx context.Context, artID model.ArtworkID, s
} else {
switch artID.Kind {
case model.KindArtistArtwork:
artReader, err = newArtistReader(ctx, a, artID)
artReader, err = newArtistReader(ctx, a, artID, a.em)
case model.KindAlbumArtwork:
artReader, err = newAlbumArtworkReader(ctx, a, artID)
case model.KindMediaFileArtwork: