Merge pull request 'Return user specified ack on search and addToQueue requests' (#24) from kermit/deemix-pyweb:ack into main

Reviewed-on: https://codeberg.org/RemixDev/deemix-pyweb/pulls/24
This commit is contained in:
RemixDev 2020-09-15 20:10:56 +02:00
commit 053b7fdfac
2 changed files with 7 additions and 4 deletions

4
app.py
View file

@ -137,10 +137,10 @@ class deemix:
return dz.search(term, type, nb, start)
# Queue functions
def addToQueue(self, dz, url, bitrate=None, interface=None):
def addToQueue(self, dz, url, bitrate=None, interface=None, ack=None):
if ';' in url:
url = url.split(";")
self.qm.addToQueue(dz, url, self.set.settings, bitrate, interface)
self.qm.addToQueue(dz, url, self.set.settings, bitrate, interface, ack)
def removeFromQueue(self, uuid, interface=None):

View file

@ -234,7 +234,9 @@ def logout():
@socketio.on('mainSearch')
def mainSearch(data):
if data['term'].strip() != "":
emit('mainSearch', app.mainSearch(session['dz'], data['term']))
result = app.mainSearch(session['dz'], data['term'])
result['ack'] = data.get('ack')
emit('mainSearch', result)
@socketio.on('search')
@ -242,6 +244,7 @@ def search(data):
if data['term'].strip() != "":
result = app.search(session['dz'], data['term'], data['type'], data['start'], data['nb'])
result['type'] = data['type']
result['ack'] = data.get('ack')
emit('search', result)
@ -252,7 +255,7 @@ def queueRestored():
@socketio.on('addToQueue')
def addToQueue(data):
result = app.addToQueue(session['dz'], data['url'], data['bitrate'], interface=socket_interface)
result = app.addToQueue(session['dz'], data['url'], data['bitrate'], interface=socket_interface, ack=data.get('ack'))
if result == "Not logged in":
emit('loginNeededToDownload')