Fix watchlist artist image not loading for Deezer source
The watchlist add code called fallback.get_artist() which doesn't exist on the Deezer client (only get_artist_info). The AttributeError was silently caught, leaving image_url as None. Now uses get_artist_info() and falls back to a direct Deezer API call for picture_xl when the Spotify-compatible format doesn't have images.
This commit is contained in:
parent
38ba6ddbc1
commit
de8f758596
1 changed files with 12 additions and 2 deletions
|
|
@ -33388,10 +33388,20 @@ def add_to_watchlist():
|
||||||
# For numeric IDs, fetch image from the configured fallback source
|
# For numeric IDs, fetch image from the configured fallback source
|
||||||
try:
|
try:
|
||||||
if fallback_source == 'deezer':
|
if fallback_source == 'deezer':
|
||||||
# Deezer artists have direct image URLs
|
# Deezer artists have direct image URLs via picture_xl
|
||||||
fallback = _get_metadata_fallback_client()
|
fallback = _get_metadata_fallback_client()
|
||||||
artist_info = fallback.get_artist(artist_id)
|
artist_info = fallback.get_artist_info(str(artist_id)) if hasattr(fallback, 'get_artist_info') else None
|
||||||
image_url = artist_info.get('images', [{}])[0].get('url') if artist_info and artist_info.get('images') else None
|
image_url = artist_info.get('images', [{}])[0].get('url') if artist_info and artist_info.get('images') else None
|
||||||
|
# Fallback: try Deezer API directly for picture
|
||||||
|
if not image_url:
|
||||||
|
try:
|
||||||
|
import requests as req
|
||||||
|
resp = req.get(f'https://api.deezer.com/artist/{artist_id}', timeout=5)
|
||||||
|
if resp.ok:
|
||||||
|
dz = resp.json()
|
||||||
|
image_url = dz.get('picture_xl') or dz.get('picture_big') or dz.get('picture_medium')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
# iTunes: look up album entity for artwork
|
# iTunes: look up album entity for artwork
|
||||||
itunes_url = f"https://itunes.apple.com/lookup?id={artist_id}&entity=album&limit=5"
|
itunes_url = f"https://itunes.apple.com/lookup?id={artist_id}&entity=album&limit=5"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue