From a6f5b7557750ff3631fbcdf815d990a0a95490de Mon Sep 17 00:00:00 2001 From: RemixDev Date: Wed, 14 Oct 2020 23:20:48 +0200 Subject: [PATCH] Fixed download of tracks with no explicit data --- deemix/app/queuemanager.py | 6 +++--- deemix/app/track.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/deemix/app/queuemanager.py b/deemix/app/queuemanager.py index 7dbfa46..903bfad 100644 --- a/deemix/app/queuemanager.py +++ b/deemix/app/queuemanager.py @@ -107,7 +107,7 @@ class QueueManager: trackAPI['FILENAME_TEMPLATE'] = settings['albumTracknameTemplate'] collection.append(trackAPI) - explicit = albumAPI_gw['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'] in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT] + explicit = albumAPI_gw.get('EXPLICIT_ALBUM_CONTENT', {}).get('EXPLICIT_LYRICS_STATUS', LyricsStatus.UNKNOWN) in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT] return QICollection( id=id, @@ -151,7 +151,7 @@ class QueueManager: playlistAPI['nb_tracks'] = totalSize collection = [] for pos, trackAPI in enumerate(playlistTracksAPI, start=1): - if trackAPI['EXPLICIT_TRACK_CONTENT'].get('EXPLICIT_LYRICS_STATUS', LyricsStatus.UNKNOWN) in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT]: + if trackAPI.get('EXPLICIT_TRACK_CONTENT', {}).get('EXPLICIT_LYRICS_STATUS', LyricsStatus.UNKNOWN) in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT]: playlistAPI['explicit'] = True trackAPI['_EXTRA_PLAYLIST'] = playlistAPI trackAPI['POSITION'] = pos @@ -258,7 +258,7 @@ class QueueManager: playlistAPI['nb_tracks'] = totalSize collection = [] for pos, trackAPI in enumerate(artistTopTracksAPI_gw, start=1): - if trackAPI['EXPLICIT_TRACK_CONTENT'].get('EXPLICIT_LYRICS_STATUS', LyricsStatus.UNKNOWN) in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT]: + if trackAPI.get('EXPLICIT_TRACK_CONTENT', {}).get('EXPLICIT_LYRICS_STATUS', LyricsStatus.UNKNOWN) in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT]: playlistAPI['explicit'] = True trackAPI['_EXTRA_PLAYLIST'] = playlistAPI trackAPI['POSITION'] = pos diff --git a/deemix/app/track.py b/deemix/app/track.py index 8c6f622..c1f7cc9 100644 --- a/deemix/app/track.py +++ b/deemix/app/track.py @@ -273,9 +273,8 @@ class Track: self.album['recordType'] = "album" self.album['label'] = albumAPI_gw.get('LABEL_NAME', self.album['label']) - if albumAPI_gw.get('EXPLICIT_ALBUM_CONTENT') and albumAPI_gw['EXPLICIT_ALBUM_CONTENT'].get('EXPLICIT_LYRICS_STATUS'): - explicitLyricsStatus = albumAPI_gw['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'] - self.album['explicit'] = explicitLyricsStatus in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT] + explicitLyricsStatus = albumAPI_gw.get('EXPLICIT_ALBUM_CONTENT', {}).get('EXPLICIT_LYRICS_STATUS', LyricsStatus.UNKNOWN) + self.album['explicit'] = explicitLyricsStatus in [LyricsStatus.EXPLICIT, LyricsStatus.PARTIALLY_EXPLICIT] if not self.album['pic']: self.album['pic'] = albumAPI_gw['ALB_PICTURE']