General TC > Programming & Scripting - Unofficial

Firefox - Extension to install the latest version

<< < (2/17) > >>

Misalf:
~260 - ~310 Kilo Bytes per second it takes about 2 minutes 37 seconds. Just tested.

~8 Kilo Bytes per second, for a 40+ MB file will probably take like two hours. At least.. q:

Still downloading random stuff. (:

coreplayer2:
Yikes but that is in throttled me de?


Sent from my iPad using Tapatalk HD

Misalf:
2h would be throttled mode, yes. I'm living in the stone age of the internet from time to time. ):
However, my ISP is either too lazy or doesn't care to check my bandwidth consumption or it really likes me because the bandwidth limit don't want to kick in this month for some reason. It usually does. Yay! (:

Anyway, I'm using a quite simple wget script to make sure a troublesome download will not totally fail:
Some stuff might look familiar.. (:

--- Code: ---#!/bin/sh
## Author: Misalf
## v 0.1
## Jun-6-2014

echo -e "\033]0;Wget...\007"

#. /etc/init.d/tc-functions
#useBusybox

trap 'echo -e "\033]0;$\007" ; line="=" ; f_line ; trap 2 ; kill -2 $$' 1 2 3 13 15

##******************************************************************************************************************
##***************************************************Functions******************************************************
## coreplayer2

## Draws a line at full screen-width  ( use xy=(line#) for row position ;   linecolor=([0]-[7]) linebold=([0]-[7]) ;  line=([char]) )
f_line() {
wide=`stty size | cut -d" " -f2`
#printf "\033[3;0H"
echo -ne "\033[0${linebold};3${linecolor}m "
printf '%*s\n' "$(( wide-2 ))" '' | tr ' ' $line
printf "\033[00m"
}

## Check Connection / URL
f_chkconn () {
echo -ne "\033[00;35m Using\033[01;30m: \033[00;32m${WGET} \033[01;30m::"
echo -e "\033[00;35m URL\033[01;30m: \033[00;36m${URL}"

line="-"
f_line

echo -ne "\033[00;36m Testing connection to server\033[01;30m... \033[00m"
${WGET} -s -T 20 "${URL}" 2>/dev/null &
rotdash $!
case $? in
0) echo -e "\033[00;32mOK \033[00m"; cx=0;;
1) echo -e "\033[00;31mFail\033[00;33m!\033[00m"; cx=1; f_line; exit 1;;
esac
}
##******************************************************************************************************************
##******************************************************************************************************************

f_resolve_url() {
url=$1
domain=`echo $url | sed 's-^[^/]*/*\([^/]*\)/\?.*$-\1-'`
ipaddr=`ping -c 1 $domain | sed -n 's@^.*(\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*$@\1@p' | head -1`
req_url=`echo $url | sed "s-/[^/]\+-/$ipaddr-"`
wget $req_url
}

##******************************************************************************************************************

#WGET="$(which wget)"
WGET="$(which busybox) wget"

if [ -z "$1" ]; then
echo -e "\033[00;31m No download specified\033[01;30m."
echo -e "\033[00;33m Exiting\033[01;30m..."
sleep 3
exit 1
else
if [ -z "$2" ]; then
DIR="."
URL="$1"
else
DIR="$1"
if [ ! -d "${DIR}" ]; then
echo -e "\033[00;31m Directory does not exist\033[01;30m:"
echo -e "\033[01;34m ${DIR}/"
echo -e "\033[00;33m Exiting\033[01;30m..."
sleep 3
exit 1
fi
URL="$2"
fi
fi

linebold=1
linecolor=0
line="="
f_line

f_chkconn

echo -e "\033[00;35m Downloading to\033[01;30m:"
echo -e "\033[00;34m ${DIR}/\033[00;33m${URL##*/}"
line="-"
f_line

if [ -f ${DIR}/${URL##*/} ]; then
echo -e "\033[00;35m Continuing download\033[01;30m..."
else
echo -e "\033[00;35m Starting download\033[01;30m..."
fi

##******************************************************************************************************************

echo -ne "\033]0;Wget: ${URL##*/}\007"

RETRYNUM=0
while true; do
RETRYNUM=$((RETRYNUM+1))
###xterm -title "Wget: ${URL}" -e $(which busybox) wget -P ${DIR} -c ${URL}
echo -ne "\033[00;32m"
#${WGET} -P ${DIR} -c ${URL} && (echo -e "\n\033[00;33m DONE.") ; break || (echo -e "\033[00;31mERROR\033[01;30m = \033[00;33m$?\n\n\033[00;35mRetrying...\033[00m" ; sleep 2)
${WGET} -P ${DIR} -c ${URL}
EL=$?
case $EL in
0)
echo -e "\n\033[00;33m DONE. Press any key to exit."
line="="
f_line
break
;;
*)
echo -e "\033[00;31m ERROR\033[01;30m = \033[00;33m${EL}"
linebold=0
linecolor=1
line="-"
f_line
linebold=1
linecolor=0
echo -ne "\033[00;35m Waiting 5 seconds\033[01;30m... \033[00;33m"
sleep 5 &
rotdash $!
echo -e "\033[00;35mRetrying\033[01;30m (\033[00;35m#${RETRYNUM}\033[01;30m)\033[00m"
;;
esac
done

read junk

echo -e "\033[00m"


--- End code ---

coreplayer2:

--- Quote from: Misalf on December 29, 2014, 07:27:29 PM ---For now I know it works flawlessly at ~2Mbit/s. I'll go watching some youtube with firefox-official. (;

--- End quote ---

I take that as the script is working as intended..  :)

ok extension submitted ( named it  "firefox-latest.tcz" )

coreplayer2:
I just noticed that Firefox v35.0 is soon to be released..    Unfortunately the download links and release page hasn't been updated yet..

The update script probably will not auto detect an update until 35.0.1 or higher is released :(


Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version