954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

wget and zenity --progress

Hey all,
I have written a small script to download certain files from an ftp site. I use the wget function.I'd like to get a progress-bar with zenity to show the advancement of the wget function. Can anyone suggest a solution?
Thanx,
Shreerang Patwardhan.

Shreerang
Newbie Poster
9 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

I'm confused, wget already displays progress...

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 
Hey all, I have written a small script to download certain files from an ftp site. I use the wget function.I'd like to get a progress-bar with zenity to show the advancement of the wget function. Can anyone suggest a solution? Thanx, Shreerang Patwardhan.

I had to look into this since I've never used zenity, and it sounded interesting.

Very easy stuff actually. Zenity parses a lot of it's input and in the case of the --progress option apparently just looks for a percentage, so the quick and dirty thing to do is simply redirect wgets screen output including progress bar to zenity --progress. Then add some nice zenity features like auto kill and auto close.

wget --progress=bar:force "http://base.url.here/filename.txt" -O/your/destination/and/filename 2>&1 | zenity --title="File transfer in progress!" --progress --auto-close --auto-kill


The redirect of screen output is what I assume was giving you trouble, which is what the 2>&1 is all about.

As an example, I did this to try it out:

wget --progress=bar:force --limit-rate=250 "http://www.google.com/intl/en_ALL/images/logo.gif" -O/dev/null 2>&1 | zenity --title="file transfer in progress" --progress --auto-close --auto-kill


I hope google doesn't mind us pulling down their logo at 250B/s for testing our script.

REF:
man wget
man zenity

Skifter
Newbie Poster
5 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0
 
I'm confused, wget already displays progress...

This wget/zenity combo is ideal for setting up a visual indicator of an occurring download without having to open a terminal. For example, link the script to Flashgot in Firefox and you can download Firefox linked files using wget and get a really nice GUI progress bar, rather than a terminal version that'll just get in your way. Also handy for ruTorrent for example, where ruTorrent is running on a VPS and you need an easy way to get the completed torrents onto your home box. Should work just as well with Rsync.

Besides, Zenity is cool and it just looks nicer that way. :cool:

I'm going to use it. I'm glad I found this thread.

Kiwicam
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You