Qoobster functions

On this site you can find function modifications of Qoobster.
Sample code of:
- afterSuccessfulDownloadingFile()
- afterFailedDownloadingFile()
- afterAll()
are listed below.

Lock iPhone after download:

thx to: johnIphone66
function afterAll() {
# sb will restart after kill
killall Terminal ; killall SpringBoard
true
}

Files checker:

thx to: gimmenao
# couse there is no beforeAll() simply paste before main loop
ERR=0
	for FILE in $ALL ; do
	NAME=`echo $FILE | cut -d'/' -f6`
	NR=`echo $FILE | cut -d'/' -f5`
	
		if [ `wget -O- -q 'http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles&files='$NR'&filenames='$NAME | cut -d"," -f5` -ne 1 ] ; then
		echo "!!ERR: $FILE"
		ERR=1
		fi
	done


	if [ $ERR -eq 1 ] ; then
	exit
	fi

# while  [ $# -ne 0 ] ;

Restart router after download file:

thx to: Qoobster dev team
function afterSuccessfulDownloadingFile() {

USER="admin"
PASS="pass"
ROUTER="192.168.1.1"

#your restarting code:
#info: this particular wget is for ZTE zxv10 w300 router
wget -q --http-user=$USER --http-passwd=$PASS --post-data=restoreFlag=0 http://$ROUTER/Forms/tools_system_1 -O /dev/null

sleep 5
# if ready to go loop
        while  [ `ping -q -c1 8.8.8.8 2>/dev/null | grep "received" | cut -d"," -f2 | tr " " "\n" | grep "1" | wc -l` -eq 0 ] ;
        do
        sleep 5
        done

true
}

Dynamically add files qoobster addon:

thx to: Niewpisze
#!/bin/bash

if [ $# -eq 0 ]; then
FILENAME="links"
else
FILENAME=$1
fi


while [ `wc -l $FILENAME | sed -e "s/[ \ta-z.][ \ta-z.]*//g"` -ge 1 ];
do

FILE=`head -1 $FILENAME`


COUNT=`wc -l $FILENAME | sed -e "s/[ \ta-z.][ \ta-z.]*//g"`
echo "Files left: $COUNT

starting download file $FILE
"


qoobster $FILE

echo $FILE >> complete

sed -i '1d' $FILENAME

echo "download complete $FILE
"

done

Upload file into next ftp server:

thx to: Qoobster dev team
function afterSuccessfulDownloadingFile() {

HOST='ftp.example.org'
USER='user'
PASSWD='pass'


filename=`echo $1 | rev | cut -d"/" -f1 | rev`

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $filename
quit
END_SCRIPT

rm $filename
}

Upload file into next ftp server ( thread version ) :

thx to: Qoobster dev team
function afterSuccessfulDownloadingFile() {
function send() {
HOST='ftp.example.org'
USER='user'
PASSWD='pass'


filename=`echo $1 | rev | cut -d"/" -f1 | rev`

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $filename
quit
END_SCRIPT

rm $filename
}

send $1 &
echo "sending $filename in separate thread"
}

Delete link from "links" file after download:

thx to: anon Qoobster user
function afterSuccessfulDownloadingFile() {
FILE='links'
LINECOUNTMINUSONE=$[ `cat $FILE | wc -l` -1 ]
cat $FILE | tail -n`echo $LINECOUNTMINUSONE` > $FILE
true
}

Whenever a new functionality is developed, the site is being updated.