fix deezer pagination

See #4180, and #4198.
This commit is contained in:
Dominik Schrempf 2021-12-19 00:53:39 +01:00
parent eb71f7698b
commit 969f045610
No known key found for this signature in database
GPG key ID: E82B4974AA8C563A
2 changed files with 9 additions and 3 deletions

View file

@ -77,11 +77,16 @@ class DeezerPlugin(MetadataSourcePlugin, BeetsPlugin):
"by {} API: '{}'".format(self.data_source, release_date)
)
tracks_data = requests.get(
tracks_obj = requests.get(
self.album_url + deezer_id + '/tracks'
).json()['data']
).json()
tracks_data = tracks_obj['data']
if not tracks_data:
return None
while "next" in tracks_obj:
tracks_obj = requests.get(tracks_obj['next']).json()
tracks_data.extend(tracks_obj['data'])
tracks = []
medium_totals = collections.defaultdict(int)
for i, track_data in enumerate(tracks_data, start=1):

View file

@ -12,7 +12,8 @@ New features:
:bug:`4101`
Bug fixes:
* :doc:`/plugins/deezer`: Fix auto tagger pagination issues (fetch beyond the
first 25 tracks of a release).
* :doc:`/plugins/lyrics`: Fix Genius search by using query params instead of body.
* :doc:`/plugins/unimported`: The new ``ignore_subdirectories`` configuration
option added in 1.6.0 now has a default value if it hasn't been set.