Add new albumSearch and newReleases endpoints

This commit is contained in:
kermit 2020-09-25 11:56:56 +01:00
parent f231825446
commit d132c0ba54
2 changed files with 26 additions and 0 deletions

6
app.py
View file

@ -137,6 +137,12 @@ class deemix:
def search(self, dz, term, type, start, nb):
return dz.search(term, type, nb, start)
def searchAlbum(self, dz, term, start, nb):
return dz.search_album_gw(term, start, nb)
def newReleases(self, dz):
return dz.get_new_releases()
# Queue functions
def addToQueue(self, dz, url, bitrate=None, interface=None, ack=None):
if ';' in url:

View file

@ -266,6 +266,26 @@ def search(data):
result['ack'] = data.get('ack')
emit('search', result)
@socketio.on('albumSearch')
def albumSearch(data):
if data['term'].strip() != "":
albums = app.searchAlbum(session['dz'], data['term'], data['start'], data['nb'])
output = {
'data': albums,
'total': len(albums),
'ack': data.get('ack')
};
emit('albumSearch', output)
@socketio.on('newReleases')
def newReleases(data):
result = app.newReleases(session['dz'])
output = {
'data': result,
'total': len(result),
'ack': data.get('ack')
};
emit('newReleases', output)
@socketio.on('queueRestored')
def queueRestored():