Render cover art on downloads page for fixed/wishlist tracks

Download-status meta enrichment only checked spotify_album.images[0].url
for the card artwork. That's the Spotify-API shape, but the context
builder for wishlist and manually-fixed tracks populates spotify_album
with image_url (singular string) and no images array. Result: those
tracks downloaded and post-processed fine (different path) but the
downloads page showed a placeholder note icon.

Enrichment now falls through three spots before giving up:
  1. spotify_album.images[0].url (Spotify-originated)
  2. spotify_album.image_url       (wishlist / fixed discovery)
  3. track_info.image_url          (some discovery flows)

Pure read-side fix — no changes to the context builder, so existing
behaviour for Spotify-primary users is unchanged.
This commit is contained in:
Broque Thomas 2026-04-21 21:54:09 -07:00
parent 03b7230ac2
commit b79162f9e0

View file

@ -10512,11 +10512,23 @@ def get_download_status():
_sp_artist = ctx.get('spotify_artist') or {}
_sp_album = ctx.get('spotify_album') or {}
_sp_track = ctx.get('track_info') or {}
# Cover art can live in a few places depending on the
# origin path: album.images[0].url (Spotify-shaped),
# album.image_url (context-built / wishlist / fixes), or
# track_info.image_url (some discovery flows). Try them
# all so fixed-discovery tracks render their artwork.
_sp_images = _sp_album.get('images') or []
_art_url = ''
if _sp_images and isinstance(_sp_images[0], dict):
_art_url = _sp_images[0].get('url', '') or ''
if not _art_url:
_art_url = _sp_album.get('image_url') or ''
if not _art_url:
_art_url = _sp_track.get('image_url') or ''
transfer['_meta'] = {
'artist': _sp_artist.get('name', ''),
'album': _sp_album.get('name', ''),
'artwork_url': _sp_images[0].get('url', '') if _sp_images and isinstance(_sp_images[0], dict) else '',
'artwork_url': _art_url,
'track_number': _sp_track.get('track_number'),
'quality': ctx.get('_audio_quality', ''),
}