From 4a85bf5b6475a595a20f00c546b5b62b291adc98 Mon Sep 17 00:00:00 2001 From: kermit Date: Mon, 28 Sep 2020 19:31:48 +0100 Subject: [PATCH] Expose explicit flag in queue --- deemix/app/queueitem.py | 17 ++++++++++------- deemix/app/queuemanager.py | 4 ++++ deemix/app/spotifyhelper.py | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/deemix/app/queueitem.py b/deemix/app/queueitem.py index b840457..ab14a55 100644 --- a/deemix/app/queueitem.py +++ b/deemix/app/queueitem.py @@ -1,9 +1,10 @@ class QueueItem: - def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, size=None, type=None, settings=None, queueItemDict=None): + def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, explicit=False, size=None, type=None, settings=None, queueItemDict=None): if queueItemDict: self.title = queueItemDict['title'] self.artist = queueItemDict['artist'] self.cover = queueItemDict['cover'] + self.explicit = queueItemDict['explicit'] self.size = queueItemDict['size'] self.type = queueItemDict['type'] self.id = queueItemDict['id'] @@ -18,6 +19,7 @@ class QueueItem: self.title = title self.artist = artist self.cover = cover + self.explicit = explicit self.size = size self.type = type self.id = id @@ -37,6 +39,7 @@ class QueueItem: 'title': self.title, 'artist': self.artist, 'cover': self.cover, + 'explicit': self.explicit, 'size': self.size, 'files': self.files, 'downloaded': self.downloaded, @@ -67,12 +70,12 @@ class QueueItem: return light class QISingle(QueueItem): - def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, type=None, settings=None, single=None, queueItemDict=None): + def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, explicit=False, type=None, settings=None, single=None, queueItemDict=None): if queueItemDict: super().__init__(queueItemDict=queueItemDict) self.single = queueItemDict['single'] else: - super().__init__(id, bitrate, title, artist, cover, 1, type, settings) + super().__init__(id, bitrate, title, artist, cover, explicit, 1, type, settings) self.single = single def toDict(self): @@ -81,12 +84,12 @@ class QISingle(QueueItem): return queueItem class QICollection(QueueItem): - def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, size=None, type=None, settings=None, collection=None, queueItemDict=None): + def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, explicit=False, size=None, type=None, settings=None, collection=None, queueItemDict=None): if queueItemDict: super().__init__(queueItemDict=queueItemDict) self.collection = queueItemDict['collection'] else: - super().__init__(id, bitrate, title, artist, cover, size, type, settings) + super().__init__(id, bitrate, title, artist, cover, explicit, size, type, settings) self.collection = collection def toDict(self): @@ -95,12 +98,12 @@ class QICollection(QueueItem): return queueItem class QIConvertable(QICollection): - def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, size=None, type=None, settings=None, extra=None, queueItemDict=None): + def __init__(self, id=None, bitrate=None, title=None, artist=None, cover=None, explicit=False, size=None, type=None, settings=None, extra=None, queueItemDict=None): if queueItemDict: super().__init__(queueItemDict=queueItemDict) self.extra = queueItemDict['_EXTRA'] else: - super().__init__(id, bitrate, title, artist, cover, size, type, settings, []) + super().__init__(id, bitrate, title, artist, cover, explicit, size, type, settings, []) self.extra = extra def toDict(self): diff --git a/deemix/app/queuemanager.py b/deemix/app/queuemanager.py index e032be1..741776c 100644 --- a/deemix/app/queuemanager.py +++ b/deemix/app/queuemanager.py @@ -72,6 +72,7 @@ class QueueManager: title, trackAPI_gw['ART_NAME'], f"https://e-cdns-images.dzcdn.net/images/cover/{trackAPI_gw['ALB_PICTURE']}/75x75-000000-80-0-0.jpg", + int(trackAPI_gw['EXPLICIT_LYRICS']) > 0, 'track', settings, trackAPI_gw, @@ -115,6 +116,7 @@ class QueueManager: albumAPI['title'], albumAPI['artist']['name'], cover, + albumAPI_gw['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'] > 0, totalSize, 'album', settings, @@ -160,6 +162,7 @@ class QueueManager: playlistAPI['title'], playlistAPI['creator']['name'], playlistAPI['picture_small'][:-24] + '/75x75-000000-80-0-0.jpg', + playlistAPI['explicit'], totalSize, 'playlist', settings, @@ -266,6 +269,7 @@ class QueueManager: playlistAPI['title'], playlistAPI['creator']['name'], playlistAPI['picture_small'][:-24] + '/75x75-000000-80-0-0.jpg', + playlistAPI['explicit'], totalSize, 'playlist', settings, diff --git a/deemix/app/spotifyhelper.py b/deemix/app/spotifyhelper.py index 95ce7b6..1479f30 100644 --- a/deemix/app/spotifyhelper.py +++ b/deemix/app/spotifyhelper.py @@ -246,6 +246,7 @@ class SpotifyHelper: spotify_playlist['name'], spotify_playlist['owner']['display_name'], cover, + playlistAPI['explicit'], totalSize, 'spotify_playlist', settings,