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.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

@ -322,7 +322,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")
@ -333,7 +333,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 = []