From 2bde3ca2fa6367f67139db7925a1adfef780b0ba Mon Sep 17 00:00:00 2001 From: kermit Date: Mon, 14 Sep 2020 15:46:50 +0100 Subject: [PATCH] Pass back ack on addToQueue Enables external requests to identify the queueitem uuid that was generated by an addToQueue request --- deemix/app/queueitem.py | 4 +++- deemix/app/queuemanager.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deemix/app/queueitem.py b/deemix/app/queueitem.py index 0dab1c2..ed26a18 100644 --- a/deemix/app/queueitem.py +++ b/deemix/app/queueitem.py @@ -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): diff --git a/deemix/app/queuemanager.py b/deemix/app/queuemanager.py index 62745ce..964a958 100644 --- a/deemix/app/queuemanager.py +++ b/deemix/app/queuemanager.py @@ -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 = []