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-axel

    r3323 r5095  
    55MSG_STARTING=$(gettext "Starting to download your file")
    66MSG_CANCELLED=$(gettext "Your dowloading has been cancelled about your file")
     7MSG_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")
     11
     12
     13ZEN_BUTTON_OK="--ok-label=$MSG_BUTTON_OK"
     14ZEN_BUTTON_CANCEL_OK="--cancel-label=$MSG_BUTTON_CANCEL $ZEN_BUTTON_OK"
     15
     16
    717
    818
     
    3747                        if [ -f "$2"/"$NAME_FILE" ] ; then
    3848                                echo "$2/$NAME_FILE exists, you have to delete it before if you want to download it again"
     49                                zenity --error --text "$2/$NAME_FILE exists, you have to delete it before if you want to download it again" $ZEN_BUTTON_OK
     50
    3951                                exit 1
    4052                        else
     
    4961                        echo "Please check it."
    5062                        echo ""
     63                        zenity --error --text "$MSG_URL_NOT_EXISTS" $ZEN_BUTTON_OK
    5164                        exit 1
    5265                fi
     
    96109                                PERCENT=$( tail -1 /tmp/axel.log  2>/dev/null  | grep % | sed 's/[^0-9.]*\([0-9.]*\).*/\1/' )
    97110                                #Hacemos echo de los datos que necesita el zenity
    98                                 echo "#Downloading $3 in $2 ...................$PERCENT%"
     111                                echo "#MSG_DONWLOADING $3 in $2 ...................$PERCENT%"
    99112                                echo "$PERCENT"
    100113                                #por ultimo entubamos la salida al zenity progress para que nos muestre el resultado en pantalla
    101                         done | zenity --progress percentage=0 --auto-close --width 550 --title="Zero-Downloader-Helper" > /dev/null 2>&1  || rc=1
     114                        done | zenity --progress percentage=0 --auto-close --width 550 --title="Zero-Downloader-Helper" $ZEN_BUTTON_CANCEL_OK > /dev/null 2>&1  || rc=1
    102115                       
    103116                        #Si se presiono cancel en la descarga matamos los procesos para finiquitarla
     
    151164                # Old instruction:
    152165                #( 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
    153                 ( 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'........." > /dev/null 2>&1  )|| rc=1
     166                ( wget -O "$2"/"$3" "$1" 2>&1 |  sed -u 's/.*\ \([0-9]\+\)%\ \+\(.*\)$/\1\n'#$MSG_DONWLOADING' \1\% from "'$NAME'" at \2/' | zenity  --progress percentage=0 --auto-close --auto-kill --width 600 --title="Zero-Downloader-Helper" --text="$MSG_STARTING '$NAME'........." > /dev/null 2>&1  )|| rc=1
    154167
    155168                #Esta parte cancela el proceso del wget si se cancela la descarga en el zenity.
Note: See TracChangeset for help on using the changeset viewer.