Add error handling for invalid Deezer track_id

This commit is contained in:
Alok Saboo 2023-07-13 09:53:41 -04:00
parent a4bde2af8b
commit ef8a780e1c

View file

@ -192,6 +192,10 @@ class DeezerPlugin(MetadataSourcePlugin, BeetsPlugin):
if deezer_id is None:
return None
track_data = requests.get(self.track_url + deezer_id).json()
if 'error' in track_data:
self._log.debug(f"Error fetching track {track_id}: "
f"{track_data['error']['message']}")
return None
track = self._get_track(track_data)
# Get album's tracks to set `track.index` (position on the entire