Graphical wget

B

bashcommando

Guest
I am trying to make a graphical version of what but how do I echo the percentage finished downloading? Here is my code so far:
Code:
#!/bin/sh
export url=`zenity --entry --text="Enter URL" --title="gwget"`
cd ~/Downloads
(
wget $url
) |
zenity --progress --title="gwget" --text="Downloading..." --percentage 0
exit 0
How do I make it echo the percentage downloaded?
 


OP
D

DevynCJohnson

Guest
Does this article help - http://www.linux.org/threads/zenity-gui-for-shell-scripts.556

You should read the article for extra info, but very quickly, this is how you do it - (echo "40"; COMPLEX_COMMAND; echo "60"; COMMAND) | zenity --progress --text="Working hard or hardly working?" --percentage=0 --auto-close

However, I do not think there is a way to make wget output its download progress.
 
OP
B

bashcommando

Guest
DevynCJohnson post: 19710 said:
Does this article help - http://www.linux.org/threads/zenity-gui-for-shell-scripts.556

You should read the article for extra info, but very quickly, this is how you do it - (echo "40"; COMPLEX_COMMAND; echo "60"; COMMAND) | zenity --progress --text="Working hard or hardly working?" --percentage=0 --auto-close

However, I do not think there is a way to make wget output its download progress.
The code above works BUT it will show 0% until it is finished downloading when it shows 100%. What I need help with is to have wget print or echo the percentage. But thanks for
Code:
--auto-close
 
OP
D

DevynCJohnson

Guest
The code above works BUT it will show 0% until it is finished downloading when it shows 100%. What I need help with is to have wget print or echo the percentage. But thanks for
Code:
--auto-close

The only way you can get past the 0-100% issue is to get wget to occasionally output its downloading progress.
 
OP
Y

Yesyesloud

Guest
How would I recode it? Or how do I get it to output the percentage?
Analyse the source to realize where and how exactly you should implement the code.

As for the second question, it's up to you. Learning C is a good start.

When you finally manage to output downloading percentage for wget in a clean way, you can send its maintainers your code, they'd probably make it official :)
 
OP
B

bashcommando

Guest
Analyse the source to realize where and how exactly you should implement the code.

As for the second question, it's up to you. Learning C is a good start.

When you finally manage to output downloading percentage for wget in a clean way, you can send its maintainers your code, they'd probably make it official :)
I barley know C. Oh well...
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online

No members online now.

Top