Enable artists maintenance tasks

This commit is contained in:
Claudio Ortolina
2025-11-07 17:14:45 +00:00
parent 3911ea05bf
commit 4a5ed2de1a
8 changed files with 140 additions and 6 deletions
@@ -3,7 +3,8 @@ defmodule MusicLibraryWeb.MaintenanceLive.Index do
require Logger
alias MusicLibrary.Records.Batch
alias MusicLibrary.Artists
alias MusicLibrary.Records
alias MusicLibrary.Repo
def mount(_params, _session, socket) do
@@ -16,7 +17,7 @@ defmodule MusicLibraryWeb.MaintenanceLive.Index do
end
def handle_event("refresh_records_musicbrainz_data", _params, socket) do
Batch.refresh_musicbrainz_data()
Records.Batch.refresh_musicbrainz_data()
{:noreply,
socket
@@ -24,7 +25,23 @@ defmodule MusicLibraryWeb.MaintenanceLive.Index do
end
def handle_event("generate_record_embeddings", _params, socket) do
Batch.generate_embeddings()
Records.Batch.generate_embeddings()
{:noreply,
socket
|> put_toast(:info, gettext("Operation started in the background."))}
end
def handle_event("refresh_artists_musicbrainz_data", _params, socket) do
Artists.Batch.refresh_musicbrainz_data()
{:noreply,
socket
|> put_toast(:info, gettext("Operation started in the background."))}
end
def handle_event("refresh_artists_discogs_data", _params, socket) do
Artists.Batch.refresh_discogs_data()
{:noreply,
socket
@@ -48,7 +48,6 @@
<ul class="mt-4">
<li class="space-y-4">
<.button
disabled
type="button"
phx-click="refresh_artists_musicbrainz_data"
data-confirm={
@@ -60,7 +59,6 @@
{gettext("Refresh MusicBrainz data")}
</.button>
<.button
disabled
type="button"
phx-click="refresh_artists_discogs_data"
data-confirm={