Added clear and cancel queue buttons

This commit is contained in:
RemixDev 2020-04-14 16:48:13 +02:00
parent a65e157bd0
commit 98a3935ced
2 changed files with 17 additions and 3 deletions

8
app.py
View file

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

View file

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