Closed mokrafoka closed 1 year ago
Btw,
my naive approach to fix this would look this. But I'm sure it can be done much more elegant. update: fixed quality selection
--- core.py 2022-10-28 16:31:24.307065961 +0200
+++ /usr/local/lib/python3.10/dist-packages/qobuz_dl/core.py 2022-10-28 16:32:21.651706830 +0200
@@ -274,7 +274,7 @@
def interactive(self, download=True):
try:
- from pick import pick
+ from pick import pick, Option
except (ImportError, ModuleNotFoundError):
if os.name == "nt":
sys.exit(
@@ -283,6 +283,13 @@
)
raise
+ qualitiesOpts = [
+ Option("320", 5),
+ Option("Lossless", 6),
+ Option("Hi-res =< 96kHz", 7),
+ Option("Hi-Res > 96 kHz", 27),
+ ]
+
qualities = [
{"q_string": "320", "q": 5},
{"q_string": "Lossless", "q": 6},
@@ -320,15 +327,15 @@
"(one or more)\nPress Ctrl + c to quit\n"
"Don't select anything to try another search"
)
+ optionTexts = [ Option(i["text"], i["url"]) for i in options]
selected_items = pick(
- options,
+ optionTexts,
title,
multiselect=True,
min_selection_count=0,
- options_map_func=get_title_text,
)
if len(selected_items) > 0:
- [final_url_list.append(i[0]["url"]) for i in selected_items]
+ [final_url_list.append(i[0].value) for i in selected_items]
y_n = pick(
["Yes", "No"],
"Items were added to queue to be downloaded. "
@@ -345,12 +352,11 @@
"be automatically\ndowngraded if the selected "
"is not found)"
)
- self.quality = pick(
- qualities,
+ self.quality = pick(
+ qualitiesOpts,
desc,
- default_index=1,
- options_map_func=get_quality_text,
- )[0]["q"]
+ default_index=1
+ )[0].value
if download:
self.download_list_of_urls(final_url_list)
I can confirm these changes solve the problem I also experienced.
Hi, do you have the updated core.py? I'm having trouble implementing your fix myself as I'm not a python dev.
Hi, do you have the updated core.py? I'm having trouble implementing your fix myself as I'm not a python dev.
Yes, this is a patch for core.py
.
Copy/paste this patch into a new file like mypatch.patch
and then download the sources of qobuz-dl
if necessary. Then go to the directory where core.py
is stored in and apply this patch using patch -p0 path/to/mypatch.path
I updated the requirements to met pick's 1.6.0 version. Please re-open the issue if the error persists.
Hi, since pick 2.0.0 release the
options_map_func
parameter has been dropped. qobuz-dl (Version: 0.9.9.7 according to pip3) still seems to rely on an older version of pick which causes it to fail on ubuntu 22.04 where pick is already updated to pick 2.0.2.see: https://github.com/vitiko98/qobuz-dl/blob/d44770a38698eb441dfbe4174f1890b515ab1230/qobuz_dl/core.py#L328 https://github.com/vitiko98/qobuz-dl/blob/d44770a38698eb441dfbe4174f1890b515ab1230/qobuz_dl/core.py#L352