fix poop_songs_random_mix

This commit is contained in:
sigma67 2023-12-18 21:02:29 +01:00
commit bd7a6b452d
No known key found for this signature in database
GPG key ID: 1C314227DF0103D0
2 changed files with 5 additions and 4 deletions

View file

@ -46,7 +46,7 @@ class UploadsMixin:
body["params"] = prepare_order_params(order)
response = self._send_request(endpoint, body)
results = get_library_contents(response, MUSIC_SHELF)
pop_songs_random_mix(results['contents'])
pop_songs_random_mix(results)
if results is None:
return []
songs = parse_uploaded_items(results['contents'])

View file

@ -77,13 +77,14 @@ def parse_library_artists(response, request_func, limit):
def pop_songs_random_mix(results) -> None:
"""remove the random mix that conditionally appears at the start of library songs"""
if len(results) >= 2:
results.pop(0)
if results:
if len(results['contents']) >= 2:
results['contents'].pop(0)
def parse_library_songs(response):
results = get_library_contents(response, MUSIC_SHELF)
pop_songs_random_mix(results['contents'])
pop_songs_random_mix(results)
return {
'results': results,
'parsed': parse_playlist_items(results['contents']) if results else results