Added %folder% variable to executeCommand
This commit is contained in:
parent
4056c2e1cb
commit
ba647bc300
|
@ -364,7 +364,8 @@ def download_track(dz, id, settings, overwriteBitrate=False):
|
||||||
trackAPI = dz.get_track_gw(id)
|
trackAPI = dz.get_track_gw(id)
|
||||||
trackAPI['FILENAME_TEMPLATE'] = settings['tracknameTemplate']
|
trackAPI['FILENAME_TEMPLATE'] = settings['tracknameTemplate']
|
||||||
trackAPI['SINGLE_TRACK'] = True
|
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):
|
def download_album(dz, id, settings, overwriteBitrate=False):
|
||||||
albumAPI = dz.get_album(id)
|
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:
|
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
|
||||||
|
|
||||||
def download_artist(dz, id, settings, overwriteBitrate=False):
|
def download_artist(dz, id, settings, overwriteBitrate=False):
|
||||||
artistAPI = dz.get_artist_albums(id)
|
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:
|
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
|
||||||
|
|
|
@ -10,18 +10,19 @@ def downloadLink(url, settings, bitrate=None):
|
||||||
forcedBitrate = getBitrateInt(bitrate)
|
forcedBitrate = getBitrateInt(bitrate)
|
||||||
type = getTypeFromLink(url)
|
type = getTypeFromLink(url)
|
||||||
id = getIDFromLink(url, type)
|
id = getIDFromLink(url, type)
|
||||||
|
folder = settings['downloadLocation']
|
||||||
if type == None or id == None:
|
if type == None or id == None:
|
||||||
print("URL not recognized")
|
print("URL not recognized")
|
||||||
if type == "track":
|
if type == "track":
|
||||||
download_track(dz, id, settings, forcedBitrate)
|
folder = download_track(dz, id, settings, forcedBitrate)
|
||||||
elif type == "album":
|
elif type == "album":
|
||||||
download_album(dz, id, settings, forcedBitrate)
|
folder = download_album(dz, id, settings, forcedBitrate)
|
||||||
elif type == "playlist":
|
elif type == "playlist":
|
||||||
download_playlist(dz, id, settings, forcedBitrate)
|
folder = download_playlist(dz, id, settings, forcedBitrate)
|
||||||
elif type == "artist":
|
elif type == "artist":
|
||||||
download_artist(dz, id, settings, forcedBitrate)
|
download_artist(dz, id, settings, forcedBitrate)
|
||||||
else:
|
else:
|
||||||
print("URL not supported yet")
|
print("URL not supported yet")
|
||||||
return None
|
return None
|
||||||
if settings['executeCommand'] != "":
|
if settings['executeCommand'] != "":
|
||||||
execute(settings['executeCommand'])
|
execute(settings['executeCommand'].replace("%folder%", folder))
|
||||||
|
|
Loading…
Reference in New Issue