diff --git a/core/artwork/housekeeping.go b/core/artwork/housekeeping.go index 33eeea66a..aa444642d 100644 --- a/core/artwork/housekeeping.go +++ b/core/artwork/housekeeping.go @@ -123,3 +123,16 @@ func EnqueueMissingAll(ctx context.Context, ds model.DataStore) error { } return nil } + +// Refresh clears an item's resolved artwork state and re-queues it at Bump priority, so a +// deliberate refresh (image upload or manual re-resolve) drops the current pick and re-resolves it. +func Refresh(ctx context.Context, ds model.DataStore, kind model.Kind, id string) error { + if err := ds.Artwork(ctx).DeleteForItem(kind, id); err != nil { + return fmt.Errorf("clearing artwork state: %w", err) + } + item := model.ArtworkQueueItem{ItemKind: kind.Prefix(), ItemID: id, ImageType: model.ImageTypePrimary, Priority: model.ArtworkPriorityBump} + if err := ds.ArtworkQueue(ctx).Enqueue(item); err != nil { + return fmt.Errorf("enqueuing artwork refresh: %w", err) + } + return nil +} diff --git a/core/artwork/refresh.go b/core/artwork/refresh.go deleted file mode 100644 index e5aa68bb9..000000000 --- a/core/artwork/refresh.go +++ /dev/null @@ -1,21 +0,0 @@ -package artwork - -import ( - "context" - "fmt" - - "github.com/navidrome/navidrome/model" -) - -// Refresh clears an item's resolved artwork state and re-queues it at Bump priority, so a -// deliberate refresh (image upload or manual re-resolve) drops the current pick and re-resolves it. -func Refresh(ctx context.Context, ds model.DataStore, kind model.Kind, id string) error { - if err := ds.Artwork(ctx).DeleteForItem(kind, id); err != nil { - return fmt.Errorf("clearing artwork state: %w", err) - } - item := model.ArtworkQueueItem{ItemKind: kind.Prefix(), ItemID: id, ImageType: model.ImageTypePrimary, Priority: model.ArtworkPriorityBump} - if err := ds.ArtworkQueue(ctx).Enqueue(item); err != nil { - return fmt.Errorf("enqueuing artwork refresh: %w", err) - } - return nil -}