Ignore:
Timestamp:
Jun 6, 2017, 2:48:45 PM (3 years ago)
Author:
jrpelegrina
Message:

WIP in fix some bugs in zero-center

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zero-center/trunk/fuentes/install-files/usr/bin/zero-lliurex-wget

    r2108 r5095  
    66MSG_CANCELLED=$(gettext "Your dowloading has been cancelled about your file")
    77MSG_URL_NOT_EXISTS=$(gettext "Your URL don't exists, imposible to download the file")
     8MSG_BUTTON_OK=$(gettext "OK")
     9MSG_BUTTON_CANCEL=$(gettext "Cancel")
     10MSG_DONWLOADING=$(gettext "Downloading")
     11MSG_FROM=$(gettext "from")
     12MSG_CHECKING=$(gettext "Cheking net parameters to download ")
     13MSG_KEEP_CALM=$(gettext "please keep calm......... ")
     14
     15ZEN_BUTTON_OK="--ok-label=$MSG_BUTTON_OK"
     16ZEN_BUTTON_CANCEL_OK="--cancel-label=$MSG_BUTTON_CANCEL $ZEN_BUTTON_OK"
     17
    818
    919NAME_FILE=""
     
    5363                        if [ -f "$2"/"$NAME_FILE" ] ; then
    5464                                echo "$2/$NAME_FILE exists, you have to delete it before if you want to download it again"
    55                                 zenity --error --text "$2/$NAME_FILE exists, you have to delete it before if you want to download it again"
     65                                zenity --error --text "$2/$NAME_FILE exists, you have to delete it before if you want to download it again" $ZEN_BUTTON_OK
    5666                                exit 1
    5767                        else
     
    6979                        echo "Please check it."
    7080                        echo ""
    71                         zenity --error --text "$MSG_URL_NOT_EXISTS"
     81                        zenity --error --text "$MSG_URL_NOT_EXISTS" $ZEN_BUTTON_OK
    7282                        if [ -f "/tmp/axel.log" ]; then
    7383                                rm /tmp/axel.log -rf
     
    94104                                PERCENT=$( tail -1 /tmp/axel.log  2>/dev/null  | grep % | sed 's/[^0-9.]*\([0-9.]*\).*/\1/' )
    95105                                #Hacemos echo de los datos que necesita el zenity
    96                                 echo "#Downloading $3 in $2 ...................$PERCENT%"
     106                                echo "#MSG_DONWLOADING $3 in $2 ...................$PERCENT%"
    97107                                echo "$PERCENT"
    98108                                #por ultimo entubamos la salida al zenity progress para que nos muestre el resultado en pantalla
    99                         done | zenity --progress percentage=0 --auto-close --width 550 --title="Zero-Downloader-Helper" > /dev/null 2>&1  || rc=1
     109                        done | zenity --progress percentage=0 --auto-close --width 550 --title="Zero-Downloader-Helper" $ZEN_BUTTON_CANCEL_OK > /dev/null 2>&1  || rc=1
    100110                       
    101111                        #Si se presiono cancel en la descarga matamos los procesos para finiquitarla
     
    149159                # Old instruction:
    150160                #( wget -O "$2"/"$3" "$1" 2>&1 | grep --line-buffered -o "[0-9]*%" | sed  -u -e 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloaded \1\ from "'$NAME'"  at \2\/s, ETA \3/' | zenity  --progress percentage=0 --auto-close --auto-kill --width 600 --title="Zero-Downloader-Helper" > /dev/null 2>&1  )|| rc=1
    151                 ( wget -O "$2"/"$3" "$1" 2>&1 |  sed -u 's/.*\ \([0-9]\+\)%\ \+\(.*\)$/\1\n#Downloaded \1\% from "'$NAME'" at \2/' | zenity  --progress percentage=0 --auto-close --auto-kill --width 600 --title="Zero-Downloader-Helper" --text="$MSG_STARTING '$NAME' in '$2'........." > /dev/null 2>&1  )|| rc=1
     161                ( wget -O "$2"/"$3" "$1" 2>&1 |  sed -u 's/.*\ \([0-9]\+\)%\ \+\(.*\)$/\1\n'#$MSG_DONWLOADING' \1\% '$MSG_FROM' "'$NAME'" at \2/' | zenity  --progress percentage=0 --auto-close --auto-kill --width 600 --title="Zero-Downloader-Helper" --text="$MSG_STARTING '$NAME' in '$2'........." $ZEN_BUTTON_CANCEL_OK > /dev/null 2>&1  )|| rc=1
    152162
    153163                #Esta parte cancela el proceso del wget si se cancela la descarga en el zenity.
     
    179189namefile "$1" "$2" "$3"
    180190
    181 check_parameters "$1" "$2" | zenity --progress --title="ZERO-CENTER-WGET" --pulsate --text="Cheking net parameters to download $NAME_FILE, please keep calm........." --auto-close --auto-kill --width 600 --no-cancel
     191#check_parameters "$1" "$2" | zenity --progress --title="ZERO-CENTER-WGET" --pulsate --text="Cheking net parameters to download $NAME_FILE, please keep calm........." --auto-close --auto-kill --width 600 --no-cancel
     192check_parameters "$1" "$2" | zenity --progress --title="ZERO-CENTER-WGET" --pulsate --text="$MSG_CHECKING $NAME_FILE, $MSG_KEEP_CALM" --auto-close --auto-kill --width 600 --no-cancel
     193
    182194
    183195mainwget "$1" "$2" "$NAME_FILE"
Note: See TracChangeset for help on using the changeset viewer.