Commit d8a46310 authored by Boria138's avatar Boria138

Change wget to curl and zenity to yad (tested design)

parent e46ebfb2
...@@ -133,17 +133,17 @@ try_download_game () { ...@@ -133,17 +133,17 @@ try_download_game () {
try_download () { try_download () {
PW_DOWNLOAD_FILE_NAME="$(basename $1)" PW_DOWNLOAD_FILE_NAME="$(basename $1)"
set -o pipefail set -o pipefail
wget -c -O "$2" --read-timeout 300 --retry-connrefused --timeout 3 --tries 2 --no-dns-cache --no-cache \ curl -# -A "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" -L "$1" -o "$2" 2>&1 | \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" "$1" 2>&1 | \ tr '\r' '\n' | sed -u -e 's/#//g' -e 's/ //g' -e 's/\.[[:digit:]]%//' | \
tr '\r' '\n' | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9,.]\+.\) \(.*\)/\1\n#Downloading at \1\/, \2\/s, ETA \3/; s/^20[0-9][0-9].*/#Done./' | \ "${pw_yad_v12_3}" --progress --percentage=0 --text="Download ${PW_DOWNLOAD_FILE_NAME}" --auto-close --no-escape \
zenity --progress --percentage=0 --title="Download ${PW_DOWNLOAD_FILE_NAME}" --text=Starting... --auto-close --width=500 --height=90 --auto-kill --center --text-align="center" --fixed --no-buttons --title "PortProton" --width=500 --height=90
if [ "${PIPESTATUS[0]}" != 0 ] ; then if [ "${PIPESTATUS[0]}" != 0 ] ; then
print_error "Failed to download ${PW_DOWNLOAD_FILE_NAME} from GitHub." print_error "Failed to download ${PW_DOWNLOAD_FILE_NAME} from GitHub."
print_info "Try download ${PW_DOWNLOAD_FILE_NAME} from FTP" print_info "Try download ${PW_DOWNLOAD_FILE_NAME} from FTP"
wget -c -O "$2" --read-timeout 300 --retry-connrefused --timeout 3 --tries 2 --no-dns-cache --no-cache \ curl -# -A "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" -L "ftp://171.22.215.18/archives/${PW_DOWNLOAD_FILE_NAME}" -o "$2" 2>&1 | \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" --ftp-user=anonymous "ftp://171.22.215.18/archives/${PW_DOWNLOAD_FILE_NAME}" 2>&1 | \ tr '\r' '\n' | sed -u -e 's/#//g' -e 's/ //g' -e 's/\.[[:digit:]]%//' | \
tr '\r' '\n' | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9,.]\+.\) \(.*\)/\1\n#Downloading at \1\/, \2\/s, ETA \3/; s/^20[0-9][0-9].*/#Done./' | \ "${pw_yad_v12_3}" --progress --percentage=0 --text="Download ${PW_DOWNLOAD_FILE_NAME}" --auto-close --no-escape \
zenity --progress --percentage=0 --title="Try download ${PW_DOWNLOAD_FILE_NAME} from FTP" --text=Starting... --auto-close --width=500 --height=90 --auto-kill --center --text-align="center" --fixed --no-buttons --title "PortProton" --width=500 --height=90
if [ "${PIPESTATUS[0]}" != 0 ] ; then if [ "${PIPESTATUS[0]}" != 0 ] ; then
print_error "Failed to download ${PW_DOWNLOAD_FILE_NAME} from FTP." print_error "Failed to download ${PW_DOWNLOAD_FILE_NAME} from FTP."
return 1 return 1
...@@ -154,11 +154,12 @@ try_download () { ...@@ -154,11 +154,12 @@ try_download () {
} }
try_download_to_path () { try_download_to_path () {
PW_DOWNLOAD_FILE_NAME="$(basename $1)"
set -o pipefail set -o pipefail
wget --directory-prefix="$2" --read-timeout 300 --retry-connrefused --timeout 4 --tries 2 --no-dns-cache --no-cache \ curl -# -A "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" -L "$1" -o "$2/$PW_DOWNLOAD_FILE_NAME" 2>&1 | \
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" "$1" 2>&1 | \ tr '\r' '\n' | sed -u -e 's/#//g' -e 's/ //g' -e 's/\.[[:digit:]]%//' | \
tr '\r' '\n' | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9,.]\+.\) \(.*\)/\1\n#Downloading at \1\/, \2\/s, ETA \3/; s/^20[0-9][0-9].*/#Done./' | \ "${pw_yad_v12_3}" --progress --percentage=0 --text="Download ${PW_DOWNLOAD_FILE_NAME}" --auto-close --no-escape \
zenity --progress --percentage=0 --title="Download $(basename $1)" --text=Starting... --auto-close --width=500 --height=90 --auto-kill --center --text-align="center" --fixed --no-buttons --title "PortProton" --width=500 --height=90
if [ "${PIPESTATUS[0]}" != 0 ] ; then if [ "${PIPESTATUS[0]}" != 0 ] ; then
print_error "Failed to download $1." print_error "Failed to download $1."
return 1 return 1
...@@ -168,8 +169,7 @@ try_download_to_path () { ...@@ -168,8 +169,7 @@ try_download_to_path () {
} }
try_download_silent () { try_download_silent () {
wget -O "$2" --read-timeout 300 --retry-connrefused --timeout 4 --tries 2 --no-dns-cache --no-cache \ curl -sS -A "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" -L "$1" -o "$2"
--user-agent="Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)" "$1"
if [ "${PIPESTATUS[0]}" != 0 ] ; then if [ "${PIPESTATUS[0]}" != 0 ] ; then
print_error "Failed to download $1. Skipping." print_error "Failed to download $1. Skipping."
try_remove_file "$2" try_remove_file "$2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment