dare2dreamer
Group: Members
Posts: 113
Joined: Feb. 2005 |
|
Posted: June 07 2006,05:22 |
|
I'm hoping someone has better scripting skills than I do, because I could really use some help. I'm working on a simple gui front-end for the mpc extension in the myDSL repository.
I've got the basic buttons working, but I'm having a heck of a time with the volume slider. I can get it to update the mpd server's volume without a hitch, but I cannot for the life of me get it to read in the server's current volume on startup of the script.
Can someone please take a look? I'd love to get this working so I can submit it to both the repository, and the musicpd.org website.
I promise I'll tidy my (currently awful) code up before I release anything.
Code Sample | #!/bin/flua
volnum = execute("/opt/mpc | grep volume | sed 's/[[:alpha:]]//g' | sed 's/%//g' | sed 's/[[:space:]]//g' | sed 's/://g'") volcmd = {} window = Window{210,65; label="jukebox control"}
b1 = Button{10,10,30,30, "<<"} function b1.callback() execute("/opt/mpc prev") end
b2 = Button{50,10,30,30, "->"} function b2.callback() execute("/opt/mpc play") end
b3 = Button{90,10,30,30, "||"} function b3.callback() execute("/opt/mpc toggle") end
b4 = Button{130,10,30,30, "[]"} function b4.callback() execute("/opt/mpc stop") end
b5 = Button{170,10,30,30, ">>"} function b5.callback() execute("/opt/mpc next") end
-- volume slider begin
volume = Value_Slider{20,50,185,15,"V:"; align=Align.left, type=Slidertype.horiz, minimum=0, maximum = 100, step = 1, value=volnum}
function volume:callback() volnum = self.value volcmd = "/opt/mpc volume" .." ".. volnum execute (volcmd)
end
-- volume slider end
window:end_layout() -- ends the layout of the window window:show()
|
-------------- ----dare2dreamer.
|