Add album artists and watchlist artist fallback
Store album artists in the Spotify track data structure (handles both dict and object album forms) so downstream processing has access to album-level artist metadata. Also update missing-track processing to fall back to source_info['watchlist_artist_name'] when artist_name is absent, ensuring artist context is preserved for legacy/watchlist-sourced entries.
This commit is contained in:
parent
477615593e
commit
3c0d1fc187
2 changed files with 6 additions and 3 deletions
|
|
@ -1148,6 +1148,7 @@ class WatchlistScanner:
|
|||
album_images = album.get('images', [])
|
||||
album_type = album.get('album_type', 'album') # 'album', 'single', or 'ep'
|
||||
total_tracks = album.get('total_tracks', 0)
|
||||
album_artists = album.get('artists', [])
|
||||
else:
|
||||
album_name = album.name
|
||||
album_id = album.id
|
||||
|
|
@ -1155,6 +1156,7 @@ class WatchlistScanner:
|
|||
album_images = album.images if hasattr(album, 'images') else []
|
||||
album_type = album.album_type if hasattr(album, 'album_type') else 'album'
|
||||
total_tracks = album.total_tracks if hasattr(album, 'total_tracks') else 0
|
||||
album_artists = album.artists if hasattr(album, 'artists') else []
|
||||
|
||||
# Create Spotify track data structure
|
||||
spotify_track_data = {
|
||||
|
|
@ -1167,7 +1169,8 @@ class WatchlistScanner:
|
|||
'release_date': album_release_date,
|
||||
'images': album_images,
|
||||
'album_type': album_type, # Store album type for category filtering
|
||||
'total_tracks': total_tracks # Store track count for accurate categorization
|
||||
'total_tracks': total_tracks, # Store track count for accurate categorization
|
||||
'artists': album_artists
|
||||
},
|
||||
'duration_ms': track_duration,
|
||||
'explicit': track_explicit,
|
||||
|
|
|
|||
|
|
@ -14651,9 +14651,9 @@ def _run_full_missing_tracks_process(batch_id, playlist_id, tracks_json):
|
|||
artist_ctx = first_artist
|
||||
else:
|
||||
artist_ctx = {'name': str(first_artist)}
|
||||
elif source_info.get('artist_name'):
|
||||
elif source_info.get('artist_name') or source_info.get('watchlist_artist_name'):
|
||||
# Fallback: album artist name from source_info (set at wishlist add time)
|
||||
artist_ctx = {'name': source_info['artist_name']}
|
||||
artist_ctx = {'name': source_info.get('artist_name') or source_info['watchlist_artist_name']}
|
||||
elif s_artists and len(s_artists) > 0:
|
||||
# Last resort: track-level artist (old wishlist entries without album artist data)
|
||||
first_artist = s_artists[0]
|
||||
|
|
|
|||
Loading…
Reference in a new issue