From bc0233790a762ad07ad63a5d130585eb512c07b6 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 14 Apr 2020 19:14:17 +0200 Subject: [PATCH] Made download cancelling process more clear --- deemix/app/downloader.py | 1 + deemix/app/queuemanager.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index d5b53b7..f3d017a 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -642,6 +642,7 @@ def download(dz, queueItem, socket=None): download_path = after_download(playlist, settings, queueItem) if socket: if 'cancel' in queueItem: + socket.emit('toast', {'msg': "Current item cancelled.", 'icon':'done', 'dismiss': True, 'id':'cancelling_'+queueItem['uuid']}) socket.emit("removedFromQueue", queueItem['uuid']) else: socket.emit("finishDownload", queueItem['uuid']) diff --git a/deemix/app/queuemanager.py b/deemix/app/queuemanager.py index 891d6e6..c3f2796 100644 --- a/deemix/app/queuemanager.py +++ b/deemix/app/queuemanager.py @@ -215,6 +215,8 @@ def getQueue(): def removeFromQueue(uuid, socket=None): global currentItem, queueList, queue, queueComplete if uuid == currentItem: + if socket: + socket.emit('toast', {'msg': "Cancelling current item.", 'icon':'loading', 'dismiss': False, 'id':'cancelling_'+uuid}) queueList[uuid]['cancel'] = True elif uuid in queue: queue.remove(uuid) @@ -232,12 +234,14 @@ def cancelAllDownloads(socket=None): queue = [] queueComplete = [] if currentItem != "": + if socket: + socket.emit('toast', {'msg': "Cancelling current item.", 'icon':'loading', 'dismiss': False, 'id':'cancelling_'+currentItem}) queueList[currentItem]['cancel'] = True for uuid in list(queueList.keys()): if uuid != currentItem: del queueList[uuid] if socket: - socket.emit("removedAllDownloads") + socket.emit("removedAllDownloads", currentItem) def removeFinishedDownloads(socket=None): global queueList, queueComplete