fix: Consider Spotify's upc padding

This commit is contained in:
Xoconoch
2025-08-25 07:41:56 -06:00
parent bd393805a8
commit ed3375d8ba

View File

@@ -527,7 +527,7 @@ class DeeLogin:
spo_artists = spotify_album_data.get('artists') or [] spo_artists = spotify_album_data.get('artists') or []
spo_main_artist = (spo_artists[0].get('name') if spo_artists else '') or '' spo_main_artist = (spo_artists[0].get('name') if spo_artists else '') or ''
external_ids = spotify_album_data.get('external_ids') or {} external_ids = spotify_album_data.get('external_ids') or {}
spo_upc = str(external_ids.get('upc') or '').strip() spo_upc = str(external_ids.get('upc') or '').strip().lstrip('0')
# Try UPC first # Try UPC first
if spo_upc: if spo_upc:
@@ -555,7 +555,7 @@ class DeeLogin:
dzc = API.get_album_json(str(c_id)) dzc = API.get_album_json(str(c_id))
except Exception: except Exception:
continue continue
upc = str(dzc.get('upc') or '').strip() upc = str(dzc.get('upc') or '').strip().lstrip('0')
if spo_upc and upc and spo_upc != upc: if spo_upc and upc and spo_upc != upc:
continue continue
link_dee = f"https://www.deezer.com/album/{c_id}" link_dee = f"https://www.deezer.com/album/{c_id}"