Started implementing Link Analyzer's tab

This commit is contained in:
RemixDev 2020-04-26 14:27:54 +02:00
parent 904692f8dd
commit 8fcf858a2b
2 changed files with 13 additions and 0 deletions

9
app.py
View file

@ -1,4 +1,5 @@
from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads, removeFinishedDownloads
from deemix.utils.misc import getTypeFromLink, getIDFromLink
from deemix.app.settings import initSettings, getSettings, saveSettings
from deemix.app.spotify import SpotifyHelper
@ -53,6 +54,14 @@ def removeFinishedDownloads_link(interface=None):
def getQueue_link():
return getQueue()
def analyzeLink(dz, link):
type = getTypeFromLink(link)
relID = getIDFromLink(link, type)
if type in ["track", "album"]:
data = getattr(dz, 'get_' + type)(relID)
else:
data = {}
return (type, data)
# Settings functions
def getSettings_link():

View file

@ -169,6 +169,10 @@ def getTracklist(data):
releaseAPI['tracks'] = tracks
emit('show_' + data['type'], releaseAPI)
@socketio.on('analyzeLink')
def analyzeLink(link):
(type, data) = app.analyzeLink(session['dz'], link)
emit('analyze_'+type, data)
def run_server(port):
print("Starting server at http://127.0.0.1:" + str(port))