mirror of
https://gitlab.com/RemixDev/deemix-gui-pyweb.git
synced 2024-12-28 02:16:16 +00:00
Implemented barebones charts tab
This commit is contained in:
parent
0e516352b1
commit
30ceca014a
16
app.py
16
app.py
|
@ -5,6 +5,7 @@ from deemix.app.spotify import SpotifyHelper
|
|||
|
||||
settings = {}
|
||||
spotifyHelper = None
|
||||
chartsList = []
|
||||
|
||||
|
||||
def getUser(dz):
|
||||
|
@ -24,6 +25,21 @@ def shutdown(interface=None):
|
|||
if interface:
|
||||
interface.send("toast", {'msg': "Server is closed."})
|
||||
|
||||
def get_charts(dz):
|
||||
global chartsList
|
||||
if len(chartsList) == 0:
|
||||
temp = dz.get_charts_countries()
|
||||
countries = []
|
||||
for i in range(len(temp)):
|
||||
countries.append({
|
||||
'title': temp[i]['title'].replace("Top ", ""),
|
||||
'id': temp[i]['id'],
|
||||
'picture_small': temp[i]['picture_small'],
|
||||
'picture_medium': temp[i]['picture_medium'],
|
||||
'picture_big': temp[i]['picture_big']
|
||||
})
|
||||
chartsList = countries
|
||||
return chartsList
|
||||
|
||||
# Search functions
|
||||
def mainSearch(dz, term):
|
||||
|
|
|
@ -70,6 +70,7 @@ def on_connect():
|
|||
emit('init_downloadQueue',
|
||||
{'queue': queue, 'queueComplete': queueComplete, 'queueList': queueList, 'currentItem': currentItem})
|
||||
emit('init_home', session['dz'].get_charts())
|
||||
emit('init_charts', app.get_charts(session['dz']))
|
||||
|
||||
|
||||
@socketio.on('login')
|
||||
|
@ -175,6 +176,10 @@ def analyzeLink(link):
|
|||
(type, data) = app.analyzeLink(session['dz'], link)
|
||||
emit('analyze_'+type, data)
|
||||
|
||||
@socketio.on('getChartTracks')
|
||||
def getChartTracks(id):
|
||||
emit('setChartTracks', session['dz'].get_playlist_tracks(id)['data'])
|
||||
|
||||
def run_server(port):
|
||||
print("Starting server at http://127.0.0.1:" + str(port))
|
||||
socketio.run(server, host='0.0.0.0', port=port)
|
||||
|
|
Loading…
Reference in a new issue