Merge pull request 'Expose explicit flag in queue' (#64) from kermit/deemix:explicit into main

Reviewed-on: https://codeberg.org/RemixDev/deemix/pulls/64
This commit is contained in:
RemixDev 2020-09-30 09:56:41 +02:00
commit 48f6026c75
3 changed files with 15 additions and 7 deletions

View File

@ -1,9 +1,10 @@
class QueueItem: 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: if queueItemDict:
self.title = queueItemDict['title'] self.title = queueItemDict['title']
self.artist = queueItemDict['artist'] self.artist = queueItemDict['artist']
self.cover = queueItemDict['cover'] self.cover = queueItemDict['cover']
self.explicit = queueItemDict['explicit']
self.size = queueItemDict['size'] self.size = queueItemDict['size']
self.type = queueItemDict['type'] self.type = queueItemDict['type']
self.id = queueItemDict['id'] self.id = queueItemDict['id']
@ -18,6 +19,7 @@ class QueueItem:
self.title = title self.title = title
self.artist = artist self.artist = artist
self.cover = cover self.cover = cover
self.explicit = explicit
self.size = size self.size = size
self.type = type self.type = type
self.id = id self.id = id
@ -37,6 +39,7 @@ class QueueItem:
'title': self.title, 'title': self.title,
'artist': self.artist, 'artist': self.artist,
'cover': self.cover, 'cover': self.cover,
'explicit': self.explicit,
'size': self.size, 'size': self.size,
'files': self.files, 'files': self.files,
'downloaded': self.downloaded, 'downloaded': self.downloaded,
@ -67,12 +70,12 @@ class QueueItem:
return light return light
class QISingle(QueueItem): 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: if queueItemDict:
super().__init__(queueItemDict=queueItemDict) super().__init__(queueItemDict=queueItemDict)
self.single = queueItemDict['single'] self.single = queueItemDict['single']
else: 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 self.single = single
def toDict(self): def toDict(self):
@ -81,12 +84,12 @@ class QISingle(QueueItem):
return queueItem return queueItem
class QICollection(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: if queueItemDict:
super().__init__(queueItemDict=queueItemDict) super().__init__(queueItemDict=queueItemDict)
self.collection = queueItemDict['collection'] self.collection = queueItemDict['collection']
else: 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 self.collection = collection
def toDict(self): def toDict(self):
@ -95,12 +98,12 @@ class QICollection(QueueItem):
return queueItem return queueItem
class QIConvertable(QICollection): 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: if queueItemDict:
super().__init__(queueItemDict=queueItemDict) super().__init__(queueItemDict=queueItemDict)
self.extra = queueItemDict['_EXTRA'] self.extra = queueItemDict['_EXTRA']
else: 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 self.extra = extra
def toDict(self): def toDict(self):

View File

@ -72,6 +72,7 @@ class QueueManager:
title, title,
trackAPI_gw['ART_NAME'], trackAPI_gw['ART_NAME'],
f"https://e-cdns-images.dzcdn.net/images/cover/{trackAPI_gw['ALB_PICTURE']}/75x75-000000-80-0-0.jpg", 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', 'track',
settings, settings,
trackAPI_gw, trackAPI_gw,
@ -115,6 +116,7 @@ class QueueManager:
albumAPI['title'], albumAPI['title'],
albumAPI['artist']['name'], albumAPI['artist']['name'],
cover, cover,
albumAPI_gw['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'] > 0,
totalSize, totalSize,
'album', 'album',
settings, settings,
@ -160,6 +162,7 @@ class QueueManager:
playlistAPI['title'], playlistAPI['title'],
playlistAPI['creator']['name'], playlistAPI['creator']['name'],
playlistAPI['picture_small'][:-24] + '/75x75-000000-80-0-0.jpg', playlistAPI['picture_small'][:-24] + '/75x75-000000-80-0-0.jpg',
playlistAPI['explicit'],
totalSize, totalSize,
'playlist', 'playlist',
settings, settings,
@ -266,6 +269,7 @@ class QueueManager:
playlistAPI['title'], playlistAPI['title'],
playlistAPI['creator']['name'], playlistAPI['creator']['name'],
playlistAPI['picture_small'][:-24] + '/75x75-000000-80-0-0.jpg', playlistAPI['picture_small'][:-24] + '/75x75-000000-80-0-0.jpg',
playlistAPI['explicit'],
totalSize, totalSize,
'playlist', 'playlist',
settings, settings,

View File

@ -246,6 +246,7 @@ class SpotifyHelper:
spotify_playlist['name'], spotify_playlist['name'],
spotify_playlist['owner']['display_name'], spotify_playlist['owner']['display_name'],
cover, cover,
playlistAPI['explicit'],
totalSize, totalSize,
'spotify_playlist', 'spotify_playlist',
settings, settings,