Fix broken interactive mode from PR; style

This commit is contained in:
vitiko98 2020-12-07 11:53:09 -04:00
parent 5eaabfc55b
commit 2f63df8c0b
2 changed files with 13 additions and 15 deletions

16
main.py
View File

@ -138,14 +138,14 @@ def interactive(Qz, path, limit, tracks=True):
else: else:
break break
if len(Albums) > 0: if len(Albums) > 0:
desc = ( desc = (
"Select [intro] the quality (the quality will be automat" "Select [intro] the quality (the quality will be automat"
"ically\ndowngraded if the selected is not found)" "ically\ndowngraded if the selected is not found)"
) )
Qualits = ["320", "Lossless", "Hi-res =< 96kHz", "Hi-Res > 96 kHz"] Qualits = ["320", "Lossless", "Hi-res =< 96kHz", "Hi-Res > 96 kHz"]
quality = pick(Qualits, desc, default_index=1) quality = pick(Qualits, desc, default_index=1)
processSelected(Qz, path, Albums, IDs, Types, quality) processSelected(Qz, path, Albums, IDs, Types, quality)
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit("\nBye") sys.exit("\nBye")

View File

@ -33,7 +33,7 @@ def mkDir(dirn):
def getDesc(u, mt): def getDesc(u, mt):
return "{}{} [{}/{}]".format( return "{}{} [{}/{}]".format(
mt["title"], mt["title"],
" (" + mt["version"] + ")" if mt["version"] is not None else "", (" (" + mt["version"] + ")") if mt["version"] else "",
u["bit_depth"], u["bit_depth"],
u["sampling_rate"], u["sampling_rate"],
) )
@ -70,13 +70,13 @@ def iterateIDs(client, id, path, quality, album=False):
print( print(
"\nDownloading: {0} {1}\n".format( "\nDownloading: {0} {1}\n".format(
meta["title"], meta["title"],
"(" + meta["version"] + ")" if meta["version"] is not None else " ", ("(" + meta["version"] + ")") if meta["version"] else " ",
) )
) )
dirT = ( dirT = (
meta["artist"]["name"], meta["artist"]["name"],
meta["title"], meta["title"],
" " + meta["version"] if meta["version"] is not None else "", (" " + meta["version"]) if meta["version"] else "",
meta["release_date_original"].split("-")[0], meta["release_date_original"].split("-")[0],
) )
sanitized_title = sanitize_filename("{} - {}{} [{}]".format(*dirT)) # aa-{} sanitized_title = sanitize_filename("{} - {}{} [{}]".format(*dirT)) # aa-{}
@ -107,15 +107,13 @@ def iterateIDs(client, id, path, quality, album=False):
print( print(
"\nDownloading: {0} {1}\n".format( "\nDownloading: {0} {1}\n".format(
meta["title"], meta["title"],
"(" + meta["version"] + ")" if meta["version"] is not None else " ", ("(" + meta["version"] + ")") if meta["version"] else " ",
) )
) )
dirT = ( dirT = (
meta["album"]["artist"]["name"], meta["album"]["artist"]["name"],
meta["album"]["title"], meta["album"]["title"],
" " + meta["album"]["version"] (" " + meta["album"]["version"]) if meta["album"]["version"] else "",
if meta["album"]["version"] is not None
else "",
meta["album"]["release_date_original"].split("-")[0], meta["album"]["release_date_original"].split("-")[0],
) )
sanitized_title = sanitize_filename("{} - {}{} [{}]".format(*dirT)) sanitized_title = sanitize_filename("{} - {}{} [{}]".format(*dirT))