feat(artwork): add UIThumbnailSize constant and update cache warmer to pre-cache thumbnails

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan
2026-03-18 07:59:10 -04:00
parent 31d94acfe7
commit 00b8fbd789
3 changed files with 40 additions and 9 deletions
+9 -8
View File
@@ -142,14 +142,15 @@ func (a *cacheWarmer) doCacheImage(ctx context.Context, id model.ArtworkID) erro
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
r, _, err := a.artwork.Get(ctx, id, consts.UICoverArtSize, true)
if err != nil {
return fmt.Errorf("caching id='%s': %w", id, err)
}
defer r.Close()
_, err = io.Copy(io.Discard, r)
if err != nil {
return err
for _, size := range []int{consts.UICoverArtSize, consts.UIThumbnailSize} {
r, _, err := a.artwork.Get(ctx, id, size, true)
if err != nil {
return fmt.Errorf("caching id='%s', size=%d: %w", id, size, err)
}
defer r.Close()
if _, err = io.Copy(io.Discard, r); err != nil {
return err
}
}
return nil
}