Fixed some issues and added some stuff

This commit is contained in:
RemixDev 2020-04-13 19:22:34 +02:00
parent 8fe15ffdb4
commit 2045349163
2 changed files with 20 additions and 5 deletions

View File

@ -496,6 +496,10 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
track['album']['picPath'] = os.path.join(TEMPDIR, f"alb{track['album']['id']}_{settings['embeddedArtworkSize']}.{'png' if settings['PNGcovers'] else 'jpg'}") track['album']['picPath'] = os.path.join(TEMPDIR, f"alb{track['album']['id']}_{settings['embeddedArtworkSize']}.{'png' if settings['PNGcovers'] else 'jpg'}")
track['album']['picPath'] = downloadImage(track['album']['picUrl'], track['album']['picPath']) track['album']['picPath'] = downloadImage(track['album']['picUrl'], track['album']['picPath'])
if os.path.sep in filename:
tempPath = filename[:filename.rfind(os.path.sep)]
filepath = os.path.join(filepath, tempPath)
filename = filename[filename.rfind(os.path.sep)+len(os.path.sep):]
makedirs(filepath, exist_ok=True) makedirs(filepath, exist_ok=True)
writepath = os.path.join(filepath, filename + extensions[track['selectedFormat']]) writepath = os.path.join(filepath, filename + extensions[track['selectedFormat']])
@ -607,9 +611,9 @@ def download(dz, queueItem, socket=None):
result = {'error': { result = {'error': {
'message': str(e), 'message': str(e),
'data': { 'data': {
'id': track['SNG_ID'], 'id': queueItem['single']['SNG_ID'],
'title': track['SNG_TITLE'] + (" "+track['VERSION'] if 'VERSION' in track and track['VERSION'] else ""), 'title': queueItem['single']['SNG_TITLE'] + (" "+queueItem['single']['VERSION'] if 'VERSION' in queueItem['single'] and queueItem['single']['VERSION'] else ""),
'mainArtist': {'name': track['ART_NAME']} 'mainArtist': {'name': queueItem['single']['ART_NAME']}
} }
} }
} }

View File

@ -1,6 +1,6 @@
import deemix.utils.localpaths as localpaths import deemix.utils.localpaths as localpaths
from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads
from deemix.app.settings import initSettings from deemix.app.settings import initSettings, getSettings, saveSettings
from os import system as execute from os import system as execute
import os.path as path import os.path as path
from os import mkdir, rmdir from os import mkdir, rmdir
@ -13,7 +13,6 @@ def getUser(dz):
def initialize(): def initialize():
global settings global settings
settings = initSettings() settings = initSettings()
return {'settings': settings}
def shutdown(socket=None): def shutdown(socket=None):
print(getQueue()) print(getQueue())
@ -33,6 +32,18 @@ def addToQueue_link(dz, url, bitrate=None, socket=None):
def removeFromQueue_link(uuid, socket=None): def removeFromQueue_link(uuid, socket=None):
removeFromQueue(uuid, socket) 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): def downloadLink(url, bitrate=None):
if settings['executeCommand'] != "": if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", folder)) execute(settings['executeCommand'].replace("%folder%", folder))