From 98a3935ced0aaa00560b1fe73e9366454d588c3b Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 14 Apr 2020 16:48:13 +0200 Subject: [PATCH] Added clear and cancel queue buttons --- app.py | 8 +++++++- server.py | 12 ++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 1a71dd6..b264abe 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ import deemix.utils.localpaths as localpaths -from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads +from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads, removeFinishedDownloads from deemix.app.settings import initSettings, getSettings, saveSettings from os import system as execute @@ -30,6 +30,12 @@ def addToQueue_link(dz, url, bitrate=None, socket=None): def removeFromQueue_link(uuid, socket=None): removeFromQueue(uuid, socket) +def cancelAllDownloads_link(socket=None): + cancelAllDownloads(socket) + +def removeFinishedDownloads_link(socket=None): + removeFinishedDownloads(socket) + def getSettings_link(): return getSettings() diff --git a/server.py b/server.py index f703884..5767587 100644 --- a/server.py +++ b/server.py @@ -50,8 +50,8 @@ def closing(): def on_connect(): session['dz'] = Deezer() emit('init_settings', app.getSettings_link()) - queue, queueList, currentItem = app.getQueue_link() - emit('init_downloadQueue', {'queue': queue, 'queueList': queueList, 'currentItem': currentItem}) + queue, queueComplete, queueList, currentItem = app.getQueue_link() + emit('init_downloadQueue', {'queue': queue, 'queueComplete': queueComplete, 'queueList': queueList, 'currentItem': currentItem}) @socketio.on('login') def login(arl, force=False): @@ -118,6 +118,14 @@ def addToQueue(data): def removeFromQueue(uuid): app.removeFromQueue_link(uuid, socket=socketio) +@socketio.on('removeFinishedDownloads') +def removeFinishedDownloads(): + app.removeFinishedDownloads_link(socket=socketio) + +@socketio.on('cancelAllDownloads') +def cancelAllDownloads(): + app.cancelAllDownloads_link(socket=socketio) + # Example code leftover, could be usefull later on @server.route('/choose/path', methods=['POST']) def choose_path():