Thursday, March 17, 2011

Quick and easy gnocl based music jukebox

I don't like bloatware. I like things simple, like me. The media players that ship with our Distros are just too complicated and well, annoying. I wanted to listen to my favourite audio tracks whilst working this morning and was so fed up of fiddling with apps that I thought: "Gnocl has built-in sound playback, lets build a custom jukebox!". So, here it is.<br />

#---------------
# playOGG.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"

package require Gnocl

set box [gnocl::box -orientation vertical]

set i 0
foreach track [lsort [glob *.ogg]] {
        set b($i) [gnocl::button \
                -icon %#Cdrom \
                -text $track \
                -onClicked "gnocl::sound \"$track\""]
        $box add $b($i)
        incr i
}

gnocl::window -child $box
gnocl::mainLoop

No comments: