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():