Merge pull request 'Pass back user specified ack on addToQueue' (#43) from kermit/deemix:ack into main

Reviewed-on: https://codeberg.org/RemixDev/deemix/pulls/43
This commit is contained in:
RemixDev 2020-09-15 20:06:54 +02:00
commit b91c12b858
2 changed files with 7 additions and 3 deletions

View File

@ -32,6 +32,7 @@ class QueueItem:
self.progress = 0 self.progress = 0
self.uuid = f"{self.type}_{self.id}_{self.bitrate}" self.uuid = f"{self.type}_{self.id}_{self.bitrate}"
self.cancel = False self.cancel = False
self.ack = None
def toDict(self): def toDict(self):
return { return {
@ -47,7 +48,8 @@ class QueueItem:
'type': self.type, 'type': self.type,
'id': self.id, 'id': self.id,
'bitrate': self.bitrate, 'bitrate': self.bitrate,
'uuid': self.uuid 'uuid': self.uuid,
'ack': self.ack
} }
def getResettedItem(self): def getResettedItem(self):

View File

@ -324,7 +324,7 @@ class QueueManager:
logger.warn("URL not supported yet") logger.warn("URL not supported yet")
return QueueError(url, "URL not supported yet", "unsupportedURL") return QueueError(url, "URL not supported yet", "unsupportedURL")
def addToQueue(self, dz, url, settings, bitrate=None, interface=None): def addToQueue(self, dz, url, settings, bitrate=None, interface=None, ack=None):
if not dz.logged_in: if not dz.logged_in:
if interface: if interface:
interface.send("loginNeededToDownload") interface.send("loginNeededToDownload")
@ -335,7 +335,9 @@ class QueueManager:
if link == "": if link == "":
return False return False
logger.info("Generating queue item for: "+link) logger.info("Generating queue item for: "+link)
return self.generateQueueItem(dz, link, settings, bitrate, interface=interface) item = self.generateQueueItem(dz, link, settings, bitrate, interface=interface)
item.ack = ack;
return item
if type(url) is list: if type(url) is list:
queueItem = [] queueItem = []