Reply
Thread Tools
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#4591
brkn, i have another little question..
In option C user can download both instruction (Russian and English). Instead creating two scripts, how i can edit your script for downloading both files?
Thanks.

EDIT:
I just added the second script with another link below the first one, all in to one script, maybe it not right, but it work
Attached Images
  

Last edited by Schturman; 2012-11-11 at 14:41.
 
Posts: 299 | Thanked: 557 times | Joined on Aug 2012
#4592
Originally Posted by Schturman View Post
brkn, i have another little question..
In option C user can download both instruction (Russian and English). Instead creating two scripts, how i can edit your script for downloading both files?
Thanks.

EDIT:
I just added the second script with another link below the first one, all in to one script, maybe it not right, but it work
Quick and dirty:
+ dropped curl (wget only now)
- still needs some work in while loop/progress for full dynamic array of files

Code:
#!/bin/bash

bar="========================================"
barlength=${#bar}
FOLDER="https://dl.dropbox.com/u/17706605"
FILE[0]="N9_QuickTweak_en_v9.4.pdf"
FILE[1]="N9_QuickTweak_ru_v9.4.pdf"

echo "Calculating download size ..."

for (( i = 0 ; i < ${#FILE[@]} ; i++ ))
do
    if [ -f "${FILE[$i]}" ] ; then rm -f "${FILE[$i]}" ; fi
    length=$(wget "$FOLDER/${FILE[$i]}" --spider --server-response -O - 2>&1 | sed -ne '/Content-Length/{s/.*: //;p}')
    totallength=$(($totallength + $length))
    touch "${FILE[$i]}"
    nice -n 19 wget -N -q "$FOLDER/${FILE[$i]}" 2>/dev/null &
done

echo "Downloading $totallength bytes"

tmp=1
totaltmp=1

while [[ $totaltmp -lt $totallength ]]; do
    tmp1=$(stat "${FILE[0]}" | grep Size | awk '{print $2}')
    tmp2=$(stat "${FILE[1]}" | grep Size | awk '{print $2}')
    totaltmp=$(($tmp1 + $tmp2))
    n=$(($totaltmp * $barlength / $totallength))
    percent=$((100 * $totaltmp / $totallength))
    printf "\r[%-${barlength}s]" "${bar:0:n}"
    printf " $percent%%"
    sleep 0.1
done
printf "\n"

Last edited by brkn; 2012-11-11 at 15:08.
 

The Following User Says Thank You to brkn For This Useful Post:
Posts: 208 | Thanked: 63 times | Joined on May 2012
#4593
N9quicktweak force closed when try to install coderus tweak.any idea how it happen?..many thanks
 
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#4594
Originally Posted by N9owner View Post
N9quicktweak force closed when try to install coderus tweak.any idea how it happen?..many thanks
Its not uncommon so just make sure you monitor the logs and what isn't installed using ALL TWEAKS options you install using the individual options...
 

The Following User Says Thank You to thedead1440 For This Useful Post:
Posts: 208 | Thanked: 63 times | Joined on May 2012
#4595
Originally Posted by thedead1440 View Post
Its not uncommon so just make sure you monitor the logs and what isn't installed using ALL TWEAKS options you install using the individual options...
thanks for the advice i try to find what's wrong with it
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#4596
Hmmm.. I get this error:
Code:
! Downloading PDF instruction...
Calculating download size ...
/opt/N9QTweak/Tweaks/downloader.sh: line 15: +: syntax error: operand expected (error token is "+ ")

PDF instruction downloaded successfully...
and one file downloaded..
 
Posts: 299 | Thanked: 557 times | Joined on Aug 2012
#4597
Originally Posted by Schturman View Post
Hmmm.. I get this error:
Code:
! Downloading PDF instruction...
Calculating download size ...
/opt/N9QTweak/Tweaks/downloader.sh: line 15: +: syntax error: operand expected (error token is "+ ")

PDF instruction downloaded successfully...
and one file downloaded..
How do you run the script again?
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#4598
Originally Posted by brkn View Post
How do you run the script again?
Now it's correct
Code:
bash /opt/N9QTweak/Tweaks/downloader.sh
But still the same error
 
Posts: 299 | Thanked: 557 times | Joined on Aug 2012
#4599
Originally Posted by Schturman View Post
Now it's correct
Code:
bash /opt/N9QTweak/Tweaks/downloader.sh
But the same error
Tell me if you want it dynamic for pushing in more than 2 files or is it ok like this? Do you need the landscape mod?
Else my work is done here...
 

The Following User Says Thank You to brkn For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#4600
Originally Posted by brkn View Post
Tell me if you want it dynamic for pushing in more than 2 files or is it ok like this? Do you need the landscape mod?
Else my work is done here...
For landscape mode I think we don't need it, because all N9QT menu for portrait mode
And 2 files is ok Sometimes I need one file and sometimes 2
 
Reply

Tags
hebrew vkb, n9 qtweak, n9 quick tweak, n9 quicktweak, root-ssh


 
Forum Jump


All times are GMT. The time now is 12:30.