Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 16 Sep 2014, 11:30
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Download utility for devs. Xdialog progress. # New version.
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 4 [50 Posts]   Goto page: 1, 2, 3, 4 Next
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Wed 27 Nov 2013, 03:41    Post subject:  Download utility for devs. Xdialog progress. # New version.  

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
.
xdlg.dnldprogress.zip
Description  ### New version: Jan. 23 2014
zip

 Download 
Filename  xdlg.dnldprogress.zip 
Filesize  939 Bytes 
Downloaded  135 Time(s) 

Last edited by sunburnt on Thu 23 Jan 2014, 23:24; edited 4 times in total
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Wed 27 Nov 2013, 06:29    Post subject:  

Pretty scripting there feller! Funny paths in that archive though...
Back to top
View user's profile Send private message 
Keef


Joined: 20 Dec 2007
Posts: 628
Location: Staffordshire

PostPosted: Wed 27 Nov 2013, 08:02    Post subject:  

I think he's done that before....
Back to top
View user's profile Send private message 
sfs

Joined: 02 Nov 2013
Posts: 21
Location: Russia

PostPosted: Wed 27 Nov 2013, 10:00    Post subject:  

Code:
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
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Wed 27 Nov 2013, 11:13    Post subject:  

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.
Back to top
View user's profile Send private message 
Keef


Joined: 20 Dec 2007
Posts: 628
Location: Staffordshire

PostPosted: Wed 27 Nov 2013, 15:27    Post subject:  

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.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Wed 27 Nov 2013, 17:23    Post subject:  

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, 18:14; edited 3 times in total
Back to top
View user's profile Send private message 
Keef


Joined: 20 Dec 2007
Posts: 628
Location: Staffordshire

PostPosted: Wed 27 Nov 2013, 17:33    Post subject:  

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.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Wed 27 Nov 2013, 17:57    Post subject:  

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 Wed 27 Nov 2013, 22:40; edited 2 times in total
Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 1815
Location: South Australia

PostPosted: Wed 27 Nov 2013, 19:37    Post subject:  

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

Code:
#!/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.

_________________
Puppy Software <-> Distros <-> Puppy Linux Tips
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Wed 27 Nov 2013, 22:34    Post subject:  

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

http://sourceforge.net/projects/puppystuff/files/Internet/Firefox/firefox-23.0.1-en_5.6.0.sfs/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.
.
Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 1815
Location: South Australia

PostPosted: Wed 27 Nov 2013, 22:59    Post subject:  

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

Code:
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:
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.

_________________
Puppy Software <-> Distros <-> Puppy Linux Tips
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5028
Location: Arizona, U.S.A.

PostPosted: Thu 28 Nov 2013, 04:41    Post subject:  

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%2BnI%2BPsFd8ZkeKhcFiJVoxAAQ6ECqcw2%2BIz/uZIWGkM%3D&locale=en

My dialog is add-on support for other apps. So I chose to have the /path/file an argument.
.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Thu 28 Nov 2013, 05:35    Post subject:  

Here, I've found some stuff that I did before:
http://distro.ibiblio.org/amigolinux/download/DeskTop/MsgDialog/xdialog-2.1.2.01/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.
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8252

PostPosted: Thu 28 Nov 2013, 07:17    Post subject:  

I won't mention my gtkdialog wget thing Very Happy.

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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 4 [50 Posts]   Goto page: 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0819s ][ Queries: 13 (0.0051s) ][ GZIP on ]