Show country flag for artist

This commit is contained in:
Claudio Ortolina
2025-04-29 09:58:06 +01:00
parent 91a00fab94
commit f1dd45e438
10 changed files with 79 additions and 7 deletions
+6
View File
@@ -28,6 +28,12 @@ defmodule MusicLibrary.Records.ArtistInfo do
|> generate_image_hash()
end
def country(artist_info) do
%{"area" => area} = artist_info.musicbrainz_data
[country_code | _rest] = area["iso-3166-1-codes"]
%{name: area["name"], code: country_code}
end
def generate_image_hash(%__MODULE__{image_data: image_data} = artist_info) do
change(artist_info, image_data_hash: Cover.hash(image_data))
end