Download utility for devs. Xdialog progress. # New version.

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Download utility for devs. Xdialog progress. # New version.

#1 Post by sunburnt »

This is a script that uses Xdialog`s progress dialog as a stand-alone downloader.
The progress bar is accurate unlike most Linux and Win. progress gui`s.

I could have used GtkDialog to add extras, like download speed and ETA. Feature creep...

# Usage: xdlg.dnldprogress (/path/file) (url)

# Help: xdlg.dnldprogress -h .......... ( Just shows above Usage.)

If the titlebar [x] is clicked the download stops and the file is deleted.

URLs at many sites are horribly mangled ( intentionally I`m sure...).
So this could be a problem.
Only Ubuntu and Debian have I seen to be "normal".

It`s simple to use and very useful too.
Seems to work well, post any problems or suggestions.


# New version. Cleaned it up a bit, and now it continues a broken download.

Note: If the site is rotten and just won`t do it, then xdlg.dnldprogress will try forever.
.......... So at some point the user will want to just click the [x] and end the download.

### Brokeman suggested to add a option so it will download from SourceForge.

# New version adds option: --trust-server-names
.
Attachments
xdlg.dnldprogress.zip
### New version: Jan. 23 2014
(939 Bytes) Downloaded 453 times
Last edited by sunburnt on Fri 24 Jan 2014, 03:24, edited 4 times in total.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#2 Post by amigo »

Pretty scripting there feller! Funny paths in that archive though...

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#3 Post by Keef »

I think he's done that before....

sfs
Posts: 49
Joined: Sat 02 Nov 2013, 04:49
Location: Russia
Contact:

#4 Post by sfs »

Code: Select all

f="$@"
f=ftp://ftp.yandex.ru/ubuntu/ls-lR.gz
wget  --connect-timeout=3 -t 2 "$f" 2>&1 |tee /dev/stderr |sed -u "s/^ *[0-9]*K[ .]*\([0-9]*%\).*/\1/" | \
yad --image=save48-alt --no-buttons --progress-text="Load $f" \
    --progress --auto-close --auto-kill  --undecorated --center 2> /dev/null

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#5 Post by amigo »

There's a distinct advantage to using Xdialog here as it is available for both gtk1 and gtk2 and, even more so, the same syntax works for cdialog(ncurses). One script -three toolkits.

The polling every two seconds may make long downloads excruciating, though.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#6 Post by Keef »

Is (/path/file) for naming/renaming the file to download? That's what it does anyway. Seems an unnecessary complication.
Just putting in a URL (on its own) fails, and I wouldn't want to have to type the name of a file I don't want to rename - I can do that afterwards.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post by sunburnt »

Keef; Yes I wanted to have the file parsed from the url, but so many urls are "abnormal".

koulaxizis`s web site url`s end with: /download, so using "wget -P" the name of the file is "download".
And Yandex totally mutilates it`s urls, they`re a mile long. Only Ubuntu and Debian are okay.
So I figured using the wget -O is the best idea.
BUT... If you have an idea about how to control the /path/file with an option speak up.!
I could allow the user to do: -o = /path/file & -p = /path

amigo; Thanks... And yes, the archive was made from rxvt with a pasted path. Gotta watch that...
Need to find one of these Rox desktop icon archivers like the one MU made years ago.
# Any suggestions on how to improve the gui`s apparent activity for large downloads?

sfs; Like amigo said, I thought about Yad as it`s more capable, but it`s not all that common.
As I said, I could have used GtkDialog and "feature creeped" it and added speed and eta.
I`ll add the "-t" to my wget command, I figured it could probably use a little tuning. Thanks...
.
Last edited by sunburnt on Wed 27 Nov 2013, 22:14, edited 3 times in total.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#8 Post by Keef »

sunburnt

Yes I see what you are doing now. I've pasted urls like that into wget and had to chop out the crap manually.

I'll have to remain silent on a solution unfortunately.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#9 Post by sunburnt »

Yeah... The user would have to analyze the url manually to see if it`s "normal" and usable.
The user still has to know the Path he wants, and the FullFileName.
Again, I figure it`s just best for the user to enter the /path/file verbatim so there`s no mistakes.

A wrapper GUI to call it could have buttons and text boxes for URL and /Path/File info.
It`s a add-on gui like a file/dir. selector to make writing bigger apps easier to do.
.
Last edited by sunburnt on Thu 28 Nov 2013, 02:40, edited 2 times in total.

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#10 Post by smokey01 »

This is quite a nice little script that uses wget with a gtkdialog progress bar.

Code: Select all

#!/bin/bash 
url="$1"
export MAIN_DIALOG=' 
<vbox> 
<progressbar> 
<label>Some Text</label> 
<input>wget "'$url'" 2>&1 | sed -nru "s/.* ([0-9]+%) +([^ ]+).*$/\1\n« \1 downloaded \2 »/p"</input> 
<action type="exit">Ready</action> 
</progressbar> 
</vbox> 
' 
gtkdialog --program=MAIN_DIALOG
I call it dl.

Usage is: dl url

The downloaded file will be placed in the same directory that you executed the script.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#11 Post by sunburnt »

smokey; What about mangled urls? Like this one for Firefox, the file ends up being named "download":

http://sourceforge.net/projects/puppyst ... s/download

And other urls I`ve seen are really messed up ( on purpose I`m sure...).
Also as amigo said, Xdialog code is extremely portable, where as GtkDialog is only used here at Puppy.

But your GtkDialog one could be "feature banged" by adding Speed and ETA. Xdialog one can`t do that.
Also it could be setup to show multiple simultaneous downloads and a big progress bar for total completed.
.

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#12 Post by smokey01 »

The script was named dl. The following code downloaded the file but it had to be renamed to whatever.sfs.

Code: Select all

dl http://sourceforge.net/projects/puppystuff/files/Internet/Firefox/firefox-23.0.1-en_5.6.0.sfs/download 
If you back off the /download like:

Code: Select all

dl http://sourceforge.net/projects/puppystuff/files/Internet/Firefox/firefox-23.0.1-en_5.6.0.sfs
It worked fine.

Maybe the script is transportable to Xdialog. I haven't tried.

Cheers.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#13 Post by sunburnt »

smokey; It looks like the wget line could be piped to Xdialog, I couldn`t get it to work.
Like I`m trying to get 9menu to work, as I tried getting Yad to work. Bash quoting`s a nightmare.

If you wanna see something truly horrible, look at the link code for Chromium-31 here:
https://disk.yandex.com/public/?hash=5% ... &locale=en

My dialog is add-on support for other apps. So I chose to have the /path/file an argument.
.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#14 Post by amigo »

Here, I've found some stuff that I did before:
http://distro.ibiblio.org/amigolinux/do ... Resources/

I'm still looking locally for some other examples I used to add...

I mostly use the while_box which just shows a static notification window. The gauge or progressbar are always more costly than doing anything else, but wget helps you a lot there. I also used infoboxes which can be piped to or to simply create a moving 'busy' notification like a small animation -by simply printing characters like:
. (.) (..) ((..)) . (.) (..) ((..)) to create 'movement'.

Anyway, you might find something useful in there -it was mostly done relevant to my SqueezeMe AppDir which later became ZipZap. The gauges were estimating the time to create archives -probably more expensive than what you are doing with wget which provides usable progress output. There's also a proc_dot function in there that creates a spinning cursor.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#15 Post by mikeb »

I won't mention my gtkdialog wget thing :D.

amigo...any tips to make Xdialog log/tail box work better....want a smooth one second update. It was suggested after I had a problem testing yad with cdrecord but was not useable so I went back to gtklogfileviewer.

mike

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#16 Post by amigo »

What do you mean by smooth? I mean, is the box flickering on and off, or what?

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#17 Post by mikeb »

log messages scroll up but in 5-10 second chunks lagging behind the action significantly...makes it unreadable in effect.

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#18 Post by sunburnt »

mikeb; I`m sure a better download/gui utility can be made. I`d like to see your "version".
Your logbox problem is sooo typical, I get disgusted before I finish and give up...

amigo; Grabbed a bunch of stuff of yours to look at. Always looking for a better way.

# Thoughts: Devs need add-on gui and back-end utilities like a downloader or file/dir. selector.
The dev. process can be rapid, or prolonged agony. Linux is sooo scattered. Solutions?

Trying to get Yad or 9menu to work is a struggle, Bash quoting being what it is.
They work okay with literal arguments or individual vars., but args. grouped into vars. bomb.
9menu should be easy to use, but it won`t do commands with lots of args. Have to call script.
.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#19 Post by mikeb »

Actually you don't...has a url box, a save name/path box , a window of active downloads with option to kill and it spawned gtklogfileviewer log boxes. It was originally written to also include cclive so any you tube and similar urls would download the vid and offer to play as it did. cclive became ridiculous so I removed that side and I never really used wget by itself. It and curl get called in scripts otherwise I use the browser. My bash/gtkdialog dropbox file manager might be more of interest.

merge gxmessage, yad, gtkdialog, xmessage, Xdialog gtklogfileviewer and the rest into one binary called pad .... make it multicall if yer like... so it covers whatever interface gets the golden dime bar this week :D

mike

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#20 Post by sunburnt »

I see it a bit like putting bandaids on bandaids. The Linux boat needs a new hull, not patches.

I`m not sure of problems with X and xorg, but GTK / QT are ripe for replacement.
After over 20 years the old style of "Windows" is really worn out and looks like crap.
A new solid base with a new solid well designed gui kit. A simplified sane api and syntax.
.

Post Reply