Account for no artist country or area

This commit is contained in:
Claudio Ortolina
2025-05-21 22:35:45 +01:00
parent cd3448cd64
commit d38fcd6fee
3 changed files with 9 additions and 7 deletions
+3 -1
View File
@@ -38,9 +38,11 @@ defmodule MusicLibrary.Records.ArtistInfo do
nil -> artist_info.musicbrainz_data["country"]
end
%{name: area["name"], code: keep_alpha_2(country_code)}
%{name: area["name"] || "World", code: keep_alpha_2(country_code) || "XW"}
end
defp keep_alpha_2(nil), do: nil
defp keep_alpha_2(country_code) do
String.slice(country_code, 0..1)
end