Pass back ack on addToQueue

Enables external requests to identify the queueitem uuid that was
generated by an addToQueue request
This commit is contained in:
kermit 2020-09-14 15:46:50 +01:00
parent 39be6077d3
commit 2bde3ca2fa
2 changed files with 7 additions and 3 deletions

View file

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

View file

@ -322,7 +322,7 @@ class QueueManager:
logger.warn("URL not supported yet")
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 interface:
interface.send("loginNeededToDownload")
@ -333,7 +333,9 @@ class QueueManager:
if link == "":
return False
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:
queueItem = []