Programming and Scripting :: wget gui



I was planning to make a wget gui some time ago, and now as mikshaw mentioned it, i started one. For now its only a simple base, it can only download to the dir the lua script is in, but i will add some more features later, cos wget has a LOT of features.
Feel free to edit the code, but please post it here again when u r done :).

EDIT: updated script

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()

Quote
Feel free to edit the code

I did by stripping out over a quarter of the lines (11?) that tell me about you and your copyright instead of actually doing something with wget.:)

I'll see if I can find my tcl/tk scripts for wget. My last version allowed recursion of N levels, select file extension, etc. And mine's not even copyrighted because I figured it's just a front end to someone else's program...

Code Sample
 os.execute("aterm +tr -geometry 80x4 -e wget " ..url)


This is what I have used many times. Do a grep 80x4 /usr/bin/*.lua

We didn't have popen until much later when murgaLua added it.

A better goal would be not to do another os.execute of a wget hosted by aterm, but instead without the os.execute and without the hosting aterm.

Possibly io.popen - see examples of netcardconf.lua and printing.lua
then add a murgaLua progess meter.



in my opinion, a person that puts in the work required to make something useful or creative deserves to put his name on it.  I don't see a frontend as being part of the backend, but a compliment to it, so I think a copyright notice or a simple "written by so-and-so" is perfectly acceptable.

What I dislike is dishonesty and selfishness. A person deliberately writing code that no one but himself can understand, or  adding a license prohibiting users from modifying/improving the code, even for personal use.

Quote
Possibly io.popen - see examples of netcardconf.lua and printing.lua
then add a murgaLua progess meter.
This is exactly what kept me from starting this project. I don't know how to keep checking on the progress...guessing it requires coroutine, which I've never learned.

Next Page...
original here.