Programming and Scripting :: wget gui



Quote
Oh, and thx for all those reactions, it really's a good way to scare people away from helping the project by doing this.

How do you figure that? That others are vainglory and seek out legacies through minimally functional front ends with their names and copyrights -- repeatedly invoking your legal claims to something -- taking up a sizable part of the code? Or that they see someone with dual copyright sections in a simple front end with invitations for others to do all the work while someone else's name is all over it? Yeah, shame on me for wondering what's up with that.

Your initial egotism with more lines of code dedicated to putting your name (possibly) in others' computers than actual function of the script and your response defending it is why *I*'m not posting my tcl/tk scripts here, parts of which would be very helpful to what it sounds like you want to do. I've posted a few scripts here, in other forums and USENET, and on my blog for others who've wanted them (the DSL ones were mostly flua/lua 4). At most I added one line with "-- lucky13" or "# lucky13" so they know whom to blame. Maybe throw in that it's public domain, BSD license, "copy and use freely," but no copyright. That's it -- at most a couple lines regardless of how much time I spend on it or however many lines. Shell wrappers, little front ends, stuff that's a little more complex, whatever. None of which is really deserving of legal protections afforded by claiming copyrights. Besides, I have a hunch most wrappers and front ends would be thrown out of court if anyone ever tried to claim copyright infringement of one. So why bother making any legal claims like that?

I appreciate your desire to do stuff like this. But, as you can tell, I think it's ridiculous to post a script that only opens a terminal executing one small wget command to get one item at a time and then have it include all kinds of legalities (copyright) and ego-stroking with it. If your script were nearly as polished or complex as others' efforts -- Robert's many scripts, Zucca's scripts that he copyrights and posts here, mikshaw's excellent contributions, etc. -- I could accept that and even appreciate it. But like joer wrote, there's really *no* comparison.

... i dont like discussions like these, in the end everybody is angry at eachother. lets restart this topic ...

Ok, i've written a base for a wget gui, it's "released" under the gpl2 license. Please be so kind to help to make this app better.

For now, this is the code:
Code Sample

#!/bin/lua
-- Written by Jaap Broekhuizen aka Jaapz
-- This script is released under the terms of the GPL2 License

-- aswg.lua
--- A Simple Wget Gui written in murgaLua

prefix = os.getenv("HOME").."/"

--Main
w = fltk:Fl_Window(300,110,"ASWG for DSL")
w:callback(
function(w)
 os.exit(0)
end)

text = fltk:Fl_Box(135,5,30,30,"Fill in the URL of the file you want to download.")

urlInput = fltk:Fl_Input(5,35,290,30)
urlInput:value("http://")

okBtn = fltk:Fl_Return_Button(5,75,50,25,"Ok")
okBtn:callback(
function(okBtn)
 url = urlInput:value()
 os.execute("aterm +tr -geometry 80x4 -e wget --directory-prefix=" ..prefix.. " " ..url)
end)

closeBtn = fltk:Fl_Button(60,75,50,25,"Close")
closeBtn:callback(
function(closeBtn)
 os.exit(0)
end)

optionsBtn = fltk:Fl_Button(115,75,60,25,"Options")
optionsBtn:callback(
function(optionsBtn)
 optionsw = fltk:Fl_Window(300,110,"Options")

 preftext = fltk:Fl_Box(135,5,30,30,"Target Directory:")
 prefixval = fltk:Fl_Input(5,35,290,30)
 prefixval:value(prefix)

 applyBtn = fltk:Fl_Button(100,75,100,25,"Apply")
 applyBtn:callback(
 function(applyBtn)
   prefix = prefixval:value()
   optionsw:hide()
 end)

 optionsw:show()
end)

helpBtn = fltk:Fl_Button(245,75,50,25,"Help")
helpBtn:callback(
function(helpBtn)
 fltk:fl_message([[A Simple Wget GUI, written in murgaLua.

The files will be automatically downloaded to your home directory,
unless otherwise specified.
Click on the "Options" button to edit the options.]])
end)

w:show()
Fl:run()

jaapz,

Don't feel bad about copyright stuff unless you are a lawyer and want to sue someone.  :)   Really copyrights are okey one of the best scripts that I use alot has this banner:

#!/bin/sh
##################################################################
# $Id: ff, v-0.1 : GPL-v2 : 2002/11/24 17:25:45 bish Exp $
# © 2002 USM Bish <bish@nde.vsnl.net.in>
# Released under GNU GPL v2 - http://www.gnu.org/copyleft/gpl.html
##################################################################

I don't think I am violating a copyright by posting this because it is GPL.  There is a big difference between copyrights and patents.  The great man Arthur C. Clark said he didn't patent his ideals because of lawyers.

Note on your script: busybox has a minimalistic set of options, so yours should error out (untested)

I've taken a shot a this a while back when I decided a simple downloader was going to be my first (murga)lua script built from scratch, mainly because I didn't really like the xterm invocations used in the current mydsl utilities, and the blocking effects of it.

The gui elements and the simplicity of working in this was really nice to use... I was surprised how fast it was to develop.
And then I ran into the problems of os.execute and io.popen (that was hinted at earlier in this thread).

os.execute blocks the calling lua script, then returns control to it only after the child process is terminated.
io.popen doesn't block and allows you to read stdout from the spawned process, but you have no control over it.

Obviously execute is out of the question, but popen has the 'flaw' of still having the spawned process running even when the lua script terminates.
I ended up hacking up a dirty workaround that stored the pid in a temp file and killing it when a "stop download" command was issued or when the lua script exited.  And then there was the problem of handling signals... (I'm guessing a wrapper script would be needed to handle those)

I searched for better methods online, but it seems that only extra/external modules could possibly contain functions to remedy this.  And I'm assuming I'd have to see if murgaLua adopts something that would help before trying to do something with it in DSL - unless adding binary module blobs would be okay to do.

I've just stopped short of ideas for this now.  I'm comtemplating throwing the above code away.  From my 'research,' seems that using lua sockets could be a much better idea (and are included in murgaLua).  Has anyone used them?

Quote
From my 'research,' seems that using lua sockets could be a much better idea (and are included in murgaLua).  Has anyone used them?


To see an example of sockets see my gettime.lua script.

/usr/local/bin/gettime.lua

Next Page...
original here.