Improve meta and error handling for background cover refreshing

This commit is contained in:
Claudio Ortolina
2025-04-14 17:41:33 +01:00
parent a3be37e86e
commit f6d1d3431a
2 changed files with 11 additions and 7 deletions
+6 -3
View File
@@ -200,9 +200,12 @@ defmodule MusicLibrary.Records do
end
end
def refresh_cover_async(record_id) do
%{"id" => record_id}
|> Worker.RefreshCover.new()
def refresh_cover_async(record) do
meta = %{title: record.title, artists: Enum.map(record.artists, & &1.name)}
params = %{"id" => record.id}
params
|> Worker.RefreshCover.new(meta: meta)
|> BackgroundRepo.insert()
end