Added "open downloads folder" button on GUI

This commit is contained in:
RemixDev 2020-05-19 18:30:18 +02:00
parent 1f342f4ff8
commit 3903874552
2 changed files with 15 additions and 0 deletions

4
app.py
View file

@ -55,6 +55,10 @@ def loadDownloadQueue(dz, interface=None):
remove(path.join(getConfigFolder(), 'queue.json')) remove(path.join(getConfigFolder(), 'queue.json'))
restoreQueue(qd['queue'], qd['queueComplete'], qd['queueList'], dz, interface) restoreQueue(qd['queue'], qd['queueComplete'], qd['queueList'], dz, interface)
def getDownloadFolder():
global settings
return settings['downloadLocation']
def get_charts(dz): def get_charts(dz):
global chartsList global chartsList
if len(chartsList) == 0: if len(chartsList) == 0:

View file

@ -1,6 +1,7 @@
#!/usr/env/bin python3 #!/usr/env/bin python3
import logging import logging
import sys import sys
import subprocess
from os import path from os import path
from flask import Flask, render_template, request, session from flask import Flask, render_template, request, session
@ -244,6 +245,16 @@ def update_userArtists():
def update_userTracks(): def update_userTracks():
emit('updated_userTracks', app.updateUserTracks(session['dz'])) emit('updated_userTracks', app.updateUserTracks(session['dz']))
@socketio.on('openDownloadsFolder')
def openDownloadsFolder():
folder = app.getDownloadFolder()
if sys.platform == 'darwin':
subprocess.check_call(['open', folder])
elif sys.platform == 'linux':
subprocess.check_call(['xdg-open', folder])
elif sys.platform == 'win32':
subprocess.check_call(['explorer', folder])
def run_server(port): def run_server(port):
print("Starting server at http://127.0.0.1:" + str(port)) print("Starting server at http://127.0.0.1:" + str(port))
socketio.run(server, host='0.0.0.0', port=port) socketio.run(server, host='0.0.0.0', port=port)