From 3facf299f183e6216b62b93ca8764bede21a20ee Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 14 Apr 2020 14:23:45 +0200 Subject: [PATCH] Preparing for separation of the GUI from the core --- deemix/app/downloader.py | 6 ++++- deemix/app/main.py | 49 ---------------------------------------- 2 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 deemix/app/main.py diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index 6cb9f64..9741b1d 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -686,7 +686,9 @@ def after_download(tracks, settings, queueItem): with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w') as f: for line in playlist: 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): if 'cancel' in track: @@ -701,6 +703,8 @@ def after_download_single(track, settings, queueItem): orig += "\r\n" orig += track['searched']+"\r\n" f.write(orig) + if settings['executeCommand'] != "": + execute(settings['executeCommand'].replace("%folder%", track['extrasPath'])) return track['extrasPath'] class downloadCancelled(Exception): diff --git a/deemix/app/main.py b/deemix/app/main.py deleted file mode 100644 index f4ae9ef..0000000 --- a/deemix/app/main.py +++ /dev/null @@ -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))