cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: easy c/g/Xdialog/zenity progress indicator?

From: Bill Paxton <goawaypleaseus_at_yahoo.com>
Date: Fri, 19 Nov 2004 07:13:52 -0800 (PST)

Hi,

Thanks for the fast reply.

dialog is a method of drawing menus and user dialogs from shell scripts. dialog, cdialog, Xdialog,
gdialog, kdialog, zenity... all are variations for curses, generic X, GNOME, KDE, etc. AFAIK every
linux distro comes with at least two of them.

re: breath-holding capabilities - Yes obviously it's low priority; it wouldn't affect
functionality at all. I'm really hoping for someone who already met and solved this in a creative
way to chime in.

I'm currently doing it with --head and regex extracting the Content-Length header and monitoring
the incoming file size, bypassing Xdialog's automated progress bar with a manual gauge. The
problem is that some servers drop me a 400 Bad Request if it's a script and not a file.

My latest testing is a forced timeout of 2 secs with it's errmsg output ("curl: (28) Operation
timed out with XXXX out of YYYYYY bytes received") piped to sed to extract the file size:

curl -# --max-time 2 -o /dev/null http://some.server/somescript.php?download=Y&fileID=96292 2>&1

...but it is getting messy because the code to check exit status (can't tell a stalled download
from an aborted one, etc) has to be in the pipe as well as any gauge updating... 5+ pipes in one
command and troubleshooting is becoming annoying.

I'll arrive at a workable solution eventually, just looking for cleaner methods.

Thanks,
BP

---
---
--- Daniel Stenberg <daniel-curl_at_haxx.se> wrote:
> On Thu, 18 Nov 2004, Bill Paxton wrote:
> 
> > In a perfect world some kind soul would implement a --progress-dialog that 
> > would output a single character or dot for each percent complete, so a 
> > calling script could be as easy as: curl --progress-dialog 
> > http://some.site/some.file | Xdialog --progress "downloading..." 0 0 100
> 
> I've never seen nor heard of Xdialog before.
> 
> > Is there some trick / pipe magic to filter curl progress meter to be 
> > compatible with these GUI tools?
> 
> Most likely it can be done, but it may be tricky. I don't know what the 
> requirements are so I really can't tell.
> 
> Personally, I have about 49 other curl things I'd rather fix before I'd plunge 
> into fixing this, so don't hold your breath waiting for me on this.
> 
> But: anyone with some patience and interest can do this.
> 
> -- 
>       Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
>        Dedicated custom curl help for hire: http://haxx.se/curl.html
> 
		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 
Received on 2004-11-19