fix issue where wishlist would not delete entire album.
Also fixed issue where a warning was displayed.
This commit is contained in:
parent
a5c4783da6
commit
883b43b015
3 changed files with 14 additions and 3 deletions
|
|
@ -271,7 +271,7 @@ class WishlistService:
|
|||
spotify_data = track['spotify_data']
|
||||
recent_failures.append({
|
||||
'name': spotify_data.get('name', 'Unknown Track'),
|
||||
'artist': spotify_data.get('artists', [{}])[0].get('name', 'Unknown Artist'),
|
||||
'artist': (spotify_data.get('artists', [{}])[0].get('name', 'Unknown Artist') if isinstance(spotify_data.get('artists', [{}])[0], dict) else spotify_data.get('artists', ['Unknown Artist'])[0]) if spotify_data.get('artists') else 'Unknown Artist',
|
||||
'failure_reason': track['failure_reason'],
|
||||
'retry_count': track['retry_count'],
|
||||
'date_added': track['date_added']
|
||||
|
|
|
|||
|
|
@ -3095,7 +3095,12 @@ class MusicDatabase:
|
|||
track_data = json.loads(track['spotify_data'])
|
||||
track_name = track_data.get('name', '').lower()
|
||||
artists = track_data.get('artists', [])
|
||||
artist_name = artists[0].get('name', '').lower() if artists else 'unknown'
|
||||
if artists and isinstance(artists[0], dict):
|
||||
artist_name = artists[0].get('name', '').lower()
|
||||
elif artists:
|
||||
artist_name = str(artists[0]).lower()
|
||||
else:
|
||||
artist_name = 'unknown'
|
||||
|
||||
key = (track_name, artist_name)
|
||||
|
||||
|
|
|
|||
|
|
@ -11130,7 +11130,13 @@ def remove_album_from_wishlist():
|
|||
# Create custom ID matching frontend logic exactly
|
||||
# album_data is guaranteed to be a dict from above check
|
||||
album_name = album_data.get('name', 'Unknown Album')
|
||||
artist_name = spotify_data.get('artists', [{}])[0].get('name', 'Unknown Artist') if spotify_data.get('artists') else 'Unknown Artist'
|
||||
artists = spotify_data.get('artists', [])
|
||||
if artists and isinstance(artists[0], dict):
|
||||
artist_name = artists[0].get('name', 'Unknown Artist')
|
||||
elif artists and isinstance(artists[0], str):
|
||||
artist_name = artists[0]
|
||||
else:
|
||||
artist_name = 'Unknown Artist'
|
||||
custom_id = f"{album_name}_{artist_name}"
|
||||
# Match frontend regex exactly:
|
||||
# 1. Remove all special chars except spaces, underscores, hyphens: /[^a-zA-Z0-9\s_-]/g
|
||||
|
|
|
|||
Loading…
Reference in a new issue