Some refactor, log message changes

This commit is contained in:
Deluan
2023-01-17 17:26:48 -05:00
parent 1324a16fc5
commit 5564f00838
4 changed files with 31 additions and 26 deletions
+2 -2
View File
@@ -44,13 +44,13 @@ func (a *playlistArtworkReader) LastUpdated() time.Time {
func (a *playlistArtworkReader) Reader(ctx context.Context) (io.ReadCloser, string, error) {
ff := []sourceFunc{
a.fromGeneratedTile(ctx),
a.fromGeneratedTiledCover(ctx),
fromAlbumPlaceholder(),
}
return selectImageReader(ctx, a.artID, ff...)
}
func (a *playlistArtworkReader) fromGeneratedTile(ctx context.Context) sourceFunc {
func (a *playlistArtworkReader) fromGeneratedTiledCover(ctx context.Context) sourceFunc {
return func() (io.ReadCloser, string, error) {
tiles, err := a.loadTiles(ctx)
if err != nil {
+2 -1
View File
@@ -28,7 +28,8 @@ func selectImageReader(ctx context.Context, artID model.ArtworkID, extractFuncs
start := time.Now()
r, path, err := f()
if r != nil {
log.Trace(ctx, "Found artwork", "artID", artID, "path", path, "source", f, "elapsed", time.Since(start))
msg := fmt.Sprintf("Found %s artwork", artID.Kind)
log.Debug(ctx, msg, "artID", artID, "path", path, "source", f, "elapsed", time.Since(start))
return r, path, nil
}
log.Trace(ctx, "Failed trying to extract artwork", "artID", artID, "source", f, "elapsed", time.Since(start), err)