Add suport for aria2c for faster downloading if installed (#299)

* Add suport for aria2c for faster downloading if installed

* Fix newlines in aria2c output
This commit is contained in:
Jai A P 2022-02-17 15:36:47 +05:30 committed by GitHub
parent bb6b4fe597
commit 4c85cf5596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -552,9 +552,18 @@ function web_get() {
exit 1
fi
if ! wget --quiet --continue --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL}. Try running 'quickget' again."
exit 1
if command -v aria2c > /dev/null; then
if ! aria2c -x16 --continue=true --summary-interval=0 --download-result=hide --console-log-level=error "${URL}" -o "${DIR}/${FILE}"; then
echo #Necessary as aria2c in suppressed mode doesnot have new lines
echo "ERROR! Failed to download ${URL}. Try running 'quickget' again."
exit 1
fi
echo #Necessary as aria2c in suppressed mode doesnot have new lines
else
if ! wget --quiet --continue --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then
echo "ERROR! Failed to download ${URL}. Try running 'quickget' again."
exit 1
fi
fi
}