Peter Russell (psr) wrote in logjam,
Peter Russell

  • Mood:
  • Music:

Handy Rhythmbox music detection script

Hi, I hope this might be of some use to someone.

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.

#!/usr/bin/env python
import pygtk; pygtk.require("2.0")
import bonobo
obj = bonobo.activation.activate_from_id("OAFIID:GNOME_Rhythmbox")
song = obj.getPlayerProperties().getValue("song")
artist = song.value().artist
title = song.value().title
print(artist + " - " + title)
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.