Preparing for separation of the GUI from the core

This commit is contained in:
RemixDev 2020-04-14 14:23:45 +02:00
parent 1ed8e7bb20
commit 3facf299f1
2 changed files with 5 additions and 50 deletions

View File

@ -686,7 +686,9 @@ def after_download(tracks, settings, queueItem):
with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w') as f: with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w') as f:
for line in playlist: for line in playlist:
f.write(line+"\n") f.write(line+"\n")
return extrasPath if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", extrasPath))
return track['extrasPath']
def after_download_single(track, settings, queueItem): def after_download_single(track, settings, queueItem):
if 'cancel' in track: if 'cancel' in track:
@ -701,6 +703,8 @@ def after_download_single(track, settings, queueItem):
orig += "\r\n" orig += "\r\n"
orig += track['searched']+"\r\n" orig += track['searched']+"\r\n"
f.write(orig) f.write(orig)
if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", track['extrasPath']))
return track['extrasPath'] return track['extrasPath']
class downloadCancelled(Exception): class downloadCancelled(Exception):

View File

@ -1,49 +0,0 @@
import deemix.utils.localpaths as localpaths
from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads
from deemix.app.settings import initSettings, getSettings, saveSettings
from os import system as execute
import os.path as path
from os import mkdir, rmdir
settings = {}
def getUser(dz):
return dz.user
def initialize():
global settings
settings = initSettings()
def shutdown(socket=None):
print(getQueue())
cancelAllDownloads(socket)
if socket:
socket.emit("toast", {'msg': "Server is closed."})
def mainSearch(dz, term):
return dz.search_main_gw(term)
def search(dz, term, type, start, nb):
return dz.search_gw(term, type, start, nb)
def addToQueue_link(dz, url, bitrate=None, socket=None):
return addToQueue(dz, url, settings, bitrate, socket)
def removeFromQueue_link(uuid, socket=None):
removeFromQueue(uuid, socket)
def getSettings_link():
return getSettings()
def getSettings_link():
return getSettings()
def getQueue_link():
return getQueue()
def saveSettings_link(newSettings):
return saveSettings(newSettings)
def downloadLink(url, bitrate=None):
if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", folder))