mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-11-22 11:05:25 +01:00
Improve error handling of interactive search
searchSelected -> processSelected Preselect "Lossless" quality
This commit is contained in:
parent
607b0d2795
commit
432b7f250c
21
main.py
21
main.py
@ -56,7 +56,7 @@ def get_id(url):
|
|||||||
).group(1)
|
).group(1)
|
||||||
|
|
||||||
|
|
||||||
def searchSelected(Qz, path, albums, ids, types, quality):
|
def processSelected(Qz, path, albums, ids, types, quality):
|
||||||
q = ["5", "6", "7", "27"]
|
q = ["5", "6", "7", "27"]
|
||||||
quality = q[quality[1]]
|
quality = q[quality[1]]
|
||||||
for alb, id_, type_ in zip(albums, ids, types):
|
for alb, id_, type_ in zip(albums, ids, types):
|
||||||
@ -110,8 +110,12 @@ def interactive(Qz, path, limit, tracks=True):
|
|||||||
while True:
|
while True:
|
||||||
query = input("\nEnter your search: [Ctrl + c to quit]\n- ")
|
query = input("\nEnter your search: [Ctrl + c to quit]\n- ")
|
||||||
print("Searching...")
|
print("Searching...")
|
||||||
|
if len(query.strip())==0:
|
||||||
|
break
|
||||||
start = Search(Qz, query, limit)
|
start = Search(Qz, query, limit)
|
||||||
start.getResults(tracks)
|
start.getResults(tracks)
|
||||||
|
if len(start.Total)==0:
|
||||||
|
break
|
||||||
Types.append(start.Types)
|
Types.append(start.Types)
|
||||||
IDs.append(start.IDs)
|
IDs.append(start.IDs)
|
||||||
|
|
||||||
@ -134,13 +138,14 @@ def interactive(Qz, path, limit, tracks=True):
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
desc = (
|
if len(Albums)>0:
|
||||||
"Select [intro] the quality (the quality will be automat"
|
desc = (
|
||||||
"ically\ndowngraded if the selected is not found)"
|
"Select [intro] the quality (the quality will be automat"
|
||||||
)
|
"ically\ndowngraded if the selected is not found)"
|
||||||
Qualits = ["320", "Lossless", "Hi-res =< 96kHz", "Hi-Res > 96 kHz"]
|
)
|
||||||
quality = pick(Qualits, desc)
|
Qualits = ["320", "Lossless", "Hi-res =< 96kHz", "Hi-Res > 96 kHz"]
|
||||||
searchSelected(Qz, path, Albums, IDs, Types, quality)
|
quality = pick(Qualits, desc, default_index=1)
|
||||||
|
processSelected(Qz, path, Albums, IDs, Types, quality)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.exit("\nBye")
|
sys.exit("\nBye")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user