diff --git a/app.py b/app.py index a7c4155..089faef 100644 --- a/app.py +++ b/app.py @@ -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: diff --git a/server.py b/server.py index c5f558a..5ace503 100644 --- a/server.py +++ b/server.py @@ -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():