Page 1 of 1

Pwget for Dingo (Lobster attempts to program)

Posted: Sun 06 Jan 2008, 06:38
by Lobster
Image
Pwget is a simple front end to the wget utility
for Dingo (Puppy 4).
Well it would be if I could program.

Sadly I have all the programming prowess
of a bag of soggy chips, without the bag

Pwget is used for downloading larger files from the internet such as ISOs using the wget bash command. The files are verified during the download procedure. As ISO and other files are checked, they do not require a md5sum check

basically this is the command

Code: Select all

wget -c -P$DEST $SOURCE

and this is the front end

Code: Select all

#! /bin/bash

# Pwget created by Lobster Jan 2008 for Puppy Dingo and Linux Tmxxine GPL v3 License
# http://tmxxine.com

export Pwget='
<window title="Pwget - File downloader utility">
<vbox>
 <hbox>
  <text><label>Source URL</label></text>
  <entry accept="directory"><variable>SOURCE</variable><input>/tmp/pm_source_dir</input></entry>
  <button>
   <input file icon="gtk-paste"></input>
   <action type="fileselect">SOURCE</action>
   <action>refresh:SOURCE</action>
  </button>
 </hbox>
 <hbox>
  <text><label>Destination Dir</label></text>
  <entry accept="directory"><variable>DEST</variable><input>/tmp/pm_mirror_dir</input></entry>
  <button>
   <input file icon="gtk-open"></input>
   <action type="fileselect">DEST</action>
   <action>refresh:DEST</action>
  </button>
 </hbox>
 <hbox>
  <button help>
   <action>`Xdialog --wrap --screencenter --left --title "Pwget - HELP" --msgbox "Pwget is a simple front end to the wget utility. Wget is used for downloading larger files from the internet such as ISOs. The files are verified during the download procedure. As ISO and other files are checked, they do not require a md5sum check. \n\n Lobster, Jan 2008" 600x0`</action>
  </button>
  <button cancel></button>
  <button ok></button>
 </hbox>
</vbox>
</window>'

gtkdialog3 --program Pwget 
unset Pwget

wget -c -P$DEST $SOURCE
How do I get this working?

Posted: Sun 06 Jan 2008, 09:40
by zigbert
Would this help

Code: Select all

#! /bin/bash

# Pwget created by Lobster Jan 2008 for Puppy Dingo and Linux Tmxxine GPL v3 License
# http://tmxxine.com

export Pwget='
<window title="Pwget - File downloader utility">
<vbox>
 <hbox>
  <text><label>Source URL</label></text>
  <entry accept="directory"><variable>SOURCE</variable><input>/tmp/pm_source_dir</input></entry>
  <button>
   <input file icon="gtk-paste"></input>
   <action type="fileselect">SOURCE</action>
   <action>refresh:SOURCE</action>
  </button>
 </hbox>
 <hbox>
  <text><label>Destination Dir</label></text>
  <entry accept="directory"><variable>DEST</variable><input>/tmp/pm_mirror_dir</input></entry>
  <button>
   <input file icon="gtk-open"></input>
   <action type="fileselect">DEST</action>
   <action>refresh:DEST</action>
  </button>
 </hbox>
 <hbox>
  <button help>
   <action>`Xdialog --wrap --screencenter --left --title "Pwget - HELP" --msgbox "Pwget is a simple front end to the wget utility. Wget is used for downloading larger files from the internet such as ISOs. The files are verified during the download procedure. As ISO and other files are checked, they do not require a md5sum check. \n\n Lobster, Jan 2008" 600x0`</action>
  </button>
  <button cancel></button>
  <button ok></button>
 </hbox>
</vbox>
</window>'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program=Pwget --center); do
	eval $STATEMENTS
done
IFS=$I
if [ $EXIT = OK ]; then
	wget -c -P"$DEST $SOURCE"
fi
Now it only executes if user press OK-button.

Sigmund

Posted: Sun 06 Jan 2008, 12:33
by Lobster
Many thanks Zigbert

This bit of code (near the bottom works - yours did not
but the rest of it is great :D

Code: Select all

exec wget -c -P $DEST $SOURCE
. . . so it works

I just hacked your pmirror util to get the code incidentally . . . 8)

The only other thing to get working (or remove)
is the paste button? Any thoughts on that?

So the code stands as

Code: Select all

#! /bin/bash

# Pwget GUI front end for Wget created by Lobster and Zigbert Jan 2008 for Puppy Dingo and Linux Tmxxine GPL v3 License
# http://tmxxine.com

export Pwget='
<window title="Pwget - File downloader utility">
<vbox>
 <hbox>
  <text><label>Source URL</label></text>
  <entry accept="directory"><variable>SOURCE</variable><input>/tmp/pm_source_dir</input></entry>
  <button>
   <input file icon="gtk-paste"></input>
   <action type="fileselect">SOURCE</action>
   <action>refresh:SOURCE</action>
  </button>
 </hbox>
 <hbox>
  <text><label>Destination Dir</label></text>
  <entry accept="directory"><variable>DEST</variable><input>/tmp/pm_mirror_dir</input></entry>
  <button>
   <input file icon="gtk-open"></input>
   <action type="fileselect">DEST</action>
   <action>refresh:DEST</action>
  </button>
 </hbox>
 <hbox>
  <button help>
   <action>`Xdialog --wrap --screencenter --left --title "Pwget - HELP" --msgbox "Pwget is a simple front end to the wget utility. Wget is used for downloading larger files from the internet such as ISOs. The files are verified during the download procedure. As ISO and other files are checked, they do not require a md5sum check. Cut and paste the source file you wish to download. Use the file selector to choose the destination. \n\n Lobster, Jan 2008" 600x0`</action>
  </button>
  <button cancel></button>
  <button ok></button>
 </hbox>
</vbox>
</window>'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program=Pwget --center); do
   eval $STATEMENTS
done
IFS=$I
if [ $EXIT = OK ]; then
  exec wget -c -P $DEST $SOURCE
fi 

Posted: Sun 06 Jan 2008, 12:53
by zigbert
Paste: What should be pasted. You can copy whatever, and paste it into url-field by ctrl+c. Maybe a better question is: What should happen when you press the paste-button.

Code: Select all

exec wget -c -P $DEST $SOURCE
should be

Code: Select all

exec wget -c -P "$DEST" $SOURCE
This to accept paths with spaces in name.

Happy coding :D
Sigmund

Make it voice controllable and speaking

Posted: Sun 06 Jan 2008, 22:31
by mcewanw
Lobster... you know my feeling on this ...

Little apps like this should be made voice controllable (e.g. cvoicecontrol) and able to speak (e.g espeak) as well as having a good GUI and/or CUI. It is easier to build such facility into an app at the design stage. Your first non-working version is basically just a GUI, but your last version is already getting a bit more complex. I challenge you to make it work better for the visually impaired as well as for those with good vision! :-)

I'm sure you know how I'd do it if I were you, but my challenge is just a challenge: do it anyway you like!

The world of computing for the visually impaired would be a better place if their needs were taken into account at the design stage. It is very difficult to make, say Open Office or Microsoft Office friendly for the visually impaired; such apps have been designed for those who have good eyesight and coordination (icon/mouse-based interfaces with windows and written text).

I do realise that Dingo is unlikely to come with, for example, cvoicecontrol or espeak or similar by default, but these can be added as dotpets.

Posted: Sun 06 Jan 2008, 23:00
by trapster
Go Lobster go !!!!!!

FYI
Xwget can be found in puppy under the "internet" menu.

Posted: Mon 07 Jan 2008, 07:34
by BarryK
Lobster,
I'm curious about one thing. Did you try 'gCurl' in Dingo? This is a file downloader that uses libcurl. I've haven't tried it myself, just stuck it in Dingo as didn't have any other downloader.

Posted: Tue 08 Jan 2008, 00:28
by Lobster
Go Lobster go !!!!!!
:lol:
Did you try 'gCurl' in Dingo?
Ah - I knew you had added an installer but could not remember what . . .
No I have not tried it.
Basically I was in Dingo, needed to download a recent PcLinuxOS to see if the wireless would work on my laptop (it did not incidentally)
Could not find the downloader (written in tcl by Ian) and rather than use the command line (a fate worse than death :roll: ) thought it would be easier to rewrite the util for Dingo.

Also works on Puppy 2.17 using the latest pwget version now. Here is the code if you want to tweak and include in Dingo

Code: Select all

#! /bin/bash

# Pwget created by Lobster with thanks to Zigbert 
# for Puppy Dingo and Linux Tmxxine 
# Jan 2008 GPL v3 License
# http://tmxxine.com

export Pwget='
<window title="Pwget - File downloader utility">
<vbox>
 <hbox>
  <text><label>Cut and Paste URL location of required file into "Address". Add destination and click "OK"</label></text>
 </hbox>
 <hbox>
  <text><label>Address</label></text>
  <entry accept="directory"><variable>SOURCE</variable><input>/tmp/pm_source_dir</input></entry>
 </hbox>
 <hbox>
  <text><label>Destination Dir</label></text>
  <entry accept="directory"><variable>DEST</variable><input>/tmp/pm_mirror_dir</input></entry>
  <button>
   <input file icon="gtk-open"></input>
   <action type="fileselect">DEST</action>
   <action>refresh:DEST</action>
  </button>
 </hbox>
 <hbox>
  <button help>
   <action>`Xdialog --wrap --screencenter --left --title "Pwget - HELP" --msgbox "Pwget is a simple front end to the wget utility. Wget is used for downloading larger files from the internet such as ISOs. The files are verified during the download procedure. As ISO and other files are checked and downloads resumed, they do not require a md5sum check. Cut and paste the source file you wish to download. Use the file selector to choose the destination. \n\n Lobster, Jan 2008" 600x0`</action>
  </button>
  <button cancel></button>
  <text><label>Download</label></text>
  <button ok></button>
 </hbox>
</vbox>
</window>'

I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program=Pwget --center); do
   eval $STATEMENTS
done
IFS=$I
if [ $EXIT = OK ]; then
  exec rxvt -name Xwget -bg "#F3F2DF" -e wget -c -P "$DEST" $SOURCE
fi 

Posted: Tue 08 Jan 2008, 03:05
by cb88
how about adding a mirror function? with several option like to only download if a newer version is avaliable....

i have done that before with wget but i forget the options always just use wget --help :-)

GO Lobster!!!!

Posted: Tue 08 Jan 2008, 08:04
by Lobster
cb88 wrote:how about adding a mirror function?
m m m . . .
here is me combing my whiskers in front of the mirror . . .
Image

Not what you meant? :oops:

. . . well maybe if someone turns this into a dotpet (and posts on additional software) I will consider that for a future update

(I know it is easy but could not find any info - there is some sort of "dir2pet" command) maybe it is not in 2.17 that I am using . . .

Posted: Tue 08 Jan 2008, 12:45
by cb88
what i mean is there is a command line option to mirror a site

say dotpups.de/dotpups/Multimedia/

just that i forget which option it is right now...

it would download all the files at that address and with another option active it would ONLY update the downloaded files if needed

it mirrors a specifyed depth on the site or just one link deep if not specified i think would have to actually use it to be sure an i have linux incompatable modems :-(

Posted: Tue 08 Jan 2008, 13:27
by Dingo
works fine for me on Puppy 3.01

Posted: Tue 08 Jan 2008, 13:40
by jcoder24
cb88 wrote:what i mean is there is a command line option to mirror a site
wget -m or wget --mirror
cb88 wrote:mirrors a specifyed depth on the site or just one link deep if not specified
wget -N -r -l number_of_levels
where number_of_levels is a number 0 or greater. 0 = infinite which is the same as mirror all.

Posted: Tue 08 Jan 2008, 17:49
by cb88
thanks jcoder24 that is exactly what i meant

Posted: Wed 16 Jan 2008, 10:56
by MU
Dotpup:
http://dotpups.de/dotpups/Internet/Pwget.pup
mirror:
http://puppyfiles.ca/dotpupsde/dotpups/ ... /Pwget.pup

I made one change:
after the download, Rox-filer opens with the download-folder.

Lobster:
If you update, just drag /usr/local/bin/Pwget again on the dotpup-wizard.

Mark

Posted: Sat 19 Jan 2008, 07:47
by Lobster
Lobster:
If you update, just drag /usr/local/bin/Pwget again on the dotpup-wizard.


forgot about that program :oops:

Many thanks Mark - much appreciated
I always feel useless when I ask people to help
what I should have remembered . . .

:D

Posted: Sat 19 Jan 2008, 07:57
by MU
no reason to feel useless :)
There meanwhile are so many programs around, that you easily loose overview.
I even cannot remember all those I made myself.
When I find one by accident using the search, I think:
"hmmm? Me was that?" :lol:

Wish you a great weekend :P
Mark

Posted: Sat 19 Jan 2008, 08:48
by Lobster
:) Thanks Mark

Have announced the prog here
http://www.murga-linux.com/puppy/viewto ... 972#167972

I have to chastise my over developed ego
by calling it useless :roll:

Thanks for the weekend wish. You too :D

Posted: Tue 29 Jan 2008, 05:20
by big_bass
Dingo wrote:works fine for me on Puppy 3.01
worked fine for me too version 2.16 fat-free 8)

nice app congrats for such a nice small practical app


big_bass