Use custom country module to resolve flags more accurately

Ported from https://github.com/wojtekmaj/country-code-to-flag-emoji
(MIT)
This commit is contained in:
Claudio Ortolina
2026-02-24 08:57:30 +00:00
parent ec131498e7
commit 8eaaa3cfec
5 changed files with 382 additions and 16 deletions
+1 -7
View File
@@ -40,13 +40,7 @@ defmodule MusicLibrary.Artists.ArtistInfo do
nil -> artist_info.musicbrainz_data["country"]
end
%{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)
%{name: area["name"] || "World", code: country_code || "XW"}
end
def extract_image(artist_info) when is_nil(artist_info.discogs_data) do