get_playlist: support None limit (#275)

This commit is contained in:
sigma67 2022-09-26 12:49:43 +02:00
commit ec771fc976
No known key found for this signature in database
GPG key ID: 1C314227DF0103D0
2 changed files with 7 additions and 2 deletions

View file

@ -14,7 +14,7 @@ class PlaylistsMixin:
Returns a list of playlist items
:param playlistId: Playlist id
:param limit: How many songs to return. Default: 100
:param limit: How many songs to return. `None` retrieves them all. Default: 100
:return: Dictionary with information about the playlist.
The key ``tracks`` contains a List of playlistItem dictionaries
@ -106,6 +106,8 @@ class PlaylistsMixin:
playlist['tracks'] = []
if song_count > 0:
playlist['tracks'].extend(parse_playlist_items(results['contents']))
if limit is None:
limit = song_count
songs_to_get = min(limit, song_count)
if 'continuations' in results: