Added %folder% variable to executeCommand

This commit is contained in:
RemixDev 2020-03-21 12:56:55 +01:00
parent 4056c2e1cb
commit ba647bc300
2 changed files with 9 additions and 5 deletions

View File

@ -364,7 +364,8 @@ def download_track(dz, id, settings, overwriteBitrate=False):
trackAPI = dz.get_track_gw(id)
trackAPI['FILENAME_TEMPLATE'] = settings['tracknameTemplate']
trackAPI['SINGLE_TRACK'] = True
downloadTrackObj(dz, trackAPI, settings, overwriteBitrate)
result = downloadTrackObj(dz, trackAPI, settings, overwriteBitrate)
return result['extrasPath']
def download_album(dz, id, settings, overwriteBitrate=False):
albumAPI = dz.get_album(id)
@ -404,6 +405,7 @@ def download_album(dz, id, settings, overwriteBitrate=False):
with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w') as f:
for line in playlist:
f.write(line+"\n")
return extrasPath
def download_artist(dz, id, settings, overwriteBitrate=False):
artistAPI = dz.get_artist_albums(id)
@ -439,3 +441,4 @@ def download_playlist(dz, id, settings, overwriteBitrate=False):
with open(os.path.join(extrasPath, 'playlist.m3u8'), 'w') as f:
for line in playlist:
f.write(line+"\n")
return extrasPath

View File

@ -10,18 +10,19 @@ def downloadLink(url, settings, bitrate=None):
forcedBitrate = getBitrateInt(bitrate)
type = getTypeFromLink(url)
id = getIDFromLink(url, type)
folder = settings['downloadLocation']
if type == None or id == None:
print("URL not recognized")
if type == "track":
download_track(dz, id, settings, forcedBitrate)
folder = download_track(dz, id, settings, forcedBitrate)
elif type == "album":
download_album(dz, id, settings, forcedBitrate)
folder = download_album(dz, id, settings, forcedBitrate)
elif type == "playlist":
download_playlist(dz, id, settings, forcedBitrate)
folder = download_playlist(dz, id, settings, forcedBitrate)
elif type == "artist":
download_artist(dz, id, settings, forcedBitrate)
else:
print("URL not supported yet")
return None
if settings['executeCommand'] != "":
execute(settings['executeCommand'])
execute(settings['executeCommand'].replace("%folder%", folder))