mirror of
https://gitlab.com/RemixDev/deemix-py.git
synced 2024-12-28 18:46:13 +00:00
Made download cancelling process more clear
This commit is contained in:
parent
c75e6a8e9e
commit
bc0233790a
|
@ -642,6 +642,7 @@ def download(dz, queueItem, socket=None):
|
||||||
download_path = after_download(playlist, settings, queueItem)
|
download_path = after_download(playlist, settings, queueItem)
|
||||||
if socket:
|
if socket:
|
||||||
if 'cancel' in queueItem:
|
if 'cancel' in queueItem:
|
||||||
|
socket.emit('toast', {'msg': "Current item cancelled.", 'icon':'done', 'dismiss': True, 'id':'cancelling_'+queueItem['uuid']})
|
||||||
socket.emit("removedFromQueue", queueItem['uuid'])
|
socket.emit("removedFromQueue", queueItem['uuid'])
|
||||||
else:
|
else:
|
||||||
socket.emit("finishDownload", queueItem['uuid'])
|
socket.emit("finishDownload", queueItem['uuid'])
|
||||||
|
|
|
@ -215,6 +215,8 @@ def getQueue():
|
||||||
def removeFromQueue(uuid, socket=None):
|
def removeFromQueue(uuid, socket=None):
|
||||||
global currentItem, queueList, queue, queueComplete
|
global currentItem, queueList, queue, queueComplete
|
||||||
if uuid == currentItem:
|
if uuid == currentItem:
|
||||||
|
if socket:
|
||||||
|
socket.emit('toast', {'msg': "Cancelling current item.", 'icon':'loading', 'dismiss': False, 'id':'cancelling_'+uuid})
|
||||||
queueList[uuid]['cancel'] = True
|
queueList[uuid]['cancel'] = True
|
||||||
elif uuid in queue:
|
elif uuid in queue:
|
||||||
queue.remove(uuid)
|
queue.remove(uuid)
|
||||||
|
@ -232,12 +234,14 @@ def cancelAllDownloads(socket=None):
|
||||||
queue = []
|
queue = []
|
||||||
queueComplete = []
|
queueComplete = []
|
||||||
if currentItem != "":
|
if currentItem != "":
|
||||||
|
if socket:
|
||||||
|
socket.emit('toast', {'msg': "Cancelling current item.", 'icon':'loading', 'dismiss': False, 'id':'cancelling_'+currentItem})
|
||||||
queueList[currentItem]['cancel'] = True
|
queueList[currentItem]['cancel'] = True
|
||||||
for uuid in list(queueList.keys()):
|
for uuid in list(queueList.keys()):
|
||||||
if uuid != currentItem:
|
if uuid != currentItem:
|
||||||
del queueList[uuid]
|
del queueList[uuid]
|
||||||
if socket:
|
if socket:
|
||||||
socket.emit("removedAllDownloads")
|
socket.emit("removedAllDownloads", currentItem)
|
||||||
|
|
||||||
def removeFinishedDownloads(socket=None):
|
def removeFinishedDownloads(socket=None):
|
||||||
global queueList, queueComplete
|
global queueList, queueComplete
|
||||||
|
|
Loading…
Reference in a new issue