Open OH1KH opened 3 weeks ago
Do you or anyone else know how to reliably recognize wget vs wget2?
Do you or anyone else know how to reliably recognize wget vs wget2?
On mobile and fat fingers nor can check. If you mean check if wget2 exists & then use that, something like (As a script, I can't say in Python but it must be possible)
if command -v wget2 &> /dev/null; then echo "Using wget2" wget2 --version else echo "Using wget" wget --version fi
(Struggling to highlight and quote the above)
Then I guess if desired write a preference based on the result if that's needed inside Yle-dl when called?
In all cases use "wget". Because Fedora has symlinked wget->wget2 that is the proper way. At program start issue command: wget --version From result look at second word (or a word that has string Wget in it. Maybe better to make result upcase and seek upcase WGET) Depending on result switch the 'show-progress' parameter on (wget), or off (wget2).
Results for "wget --version":
(this is from Fedora39 that is OK)
saku@fedora:~$ wget --version
GNU Wget 1.21.4 käännetty linux-gnu-järjestelmällä.
(this is Fedora40 with symlinked wget->wget2)
[saku@hamtpad ~]$ wget --version
GNU Wget2 2.1.0 - multithreaded metalink/file/website downloader
I could have done PR but Python is not very familiar and it's tabulation makes me crazy. I prefer { }, or Begin End blocks.
yle-dl 20240927: Download media files from Yle Areena and Elävä Arkisto Copyright (C) 2009-2024 Antti Ajanki antti.ajanki@iki.fi, license: GPLv3
Output file: 1-71747536.mp3 Unknown option 'show-progress'
That is Fedora's fault because they have replaced wget with wget2 (wget is symlinked to wget2) and wget2 does not support 'show-progress' . That causes many scripts, also others than yle-dl, fail and is most stupid thing Fedora has done for long time.
They should fix their error, but meanwhile: Perhaps yle-dl could check is the wget really original wget and adjust call parameters to be suitable for used version ?