I use Rhythmbox as my music player and I wanted to be able to have logjam detect the playing music, so I wrote this little script to get the relevant details. This is the first thing I've ever written in Python and the first time I've used Bonobo, so I'm sorry if it looks a bit sloppy. Eight lines and it took me all evening :-)
There is a slight bug in this, if Rhythmbox isn't running then the script will start it. Does anyone know how to stop this?
You probably need the Python-gnome module installed for this to work I think.
import pygtk; pygtk.require("2.0")
obj = bonobo.activation.activate_from_id("OAFI
song = obj.getPlayerProperties().getValue("song"
artist = song.value().artist
title = song.value().title
print(artist + " - " + title)