Tuesday, August 07, 2012

Now Playing Desktop Display for VLC using Geeklet

I was looking for now playing display on the desktop for Mac. I used combination of Samurize, Foobar and Now Playing Simple Plugin in Windows and would like to have the similar experience.

The closest combination I can find is by using Geektool. There's a posted geeklet for Now Playing on VLC to be used with Geektool but it no longer work when I tried it. It seems the xml posted by vlc web interface has changed since the posting of that Geeklet.

I end up playing around with the new vlc's xml myself using XMLStarlet to get the value I want. It's a great command line tool for handling xml. Here's the command that I then feed to Geektool (using shell Geeklet) :

cd /Users/Hafiz;curl -o vlcstatus.xml -s http://localhost:8080/requests/status.xml;./bin/xml sel -t -v "/root/information/category[@name='meta']/info[@name='title' or @name='artist' or @name='album']" vlcstatus.xml

What it does is dump the xml to the file using curl, and then XMLStarlet parse and display the relevant part (artist, album, title). When the above command put in shell Geeklet, Geektool will then display it on the desktop.

Here's how it displayed on the lower-right corner of my screen.