Add function to backfill missing data in scrobbled tracks

This commit is contained in:
Claudio Ortolina
2025-06-19 17:38:51 +03:00
parent 25634f5ee7
commit 35e060613b
2 changed files with 46 additions and 0 deletions
+10
View File
@@ -31,6 +31,16 @@ defmodule MusicLibrary.Artists do
end
end
def name_id_pairs(names) do
q =
from ar in ArtistRecord,
distinct: true,
where: fragment("artist ->> '$.name'") in ^names,
select: {fragment("artist ->> '$.name'"), ar.musicbrainz_id}
Repo.all(q)
end
def get_all_artist_ids do
q = from ar in ArtistRecord, distinct: true, select: ar.musicbrainz_id