A couple weeks ago, my wife introduced me to Blip.fm — that’s a whole blog post in itself, as I’ve got mixed feelings about it.
Nevertheless, it made me curious about ways I could integrate blip.fm or something similar into my awesometop. I currently use Rhythmbox Music Player to play all of my music; It’s kind of like iTunes — in fact the only noticeable difference I’ve found is that when you import a CD you can’t select specific songs: it’s just all or nothing.
One thing that it does have that I don’t think iTunes has is the ability to load plugins (and write your own!!!). A plugin that caught my eye was the “Rhythm for Web” plugin, which takes the currently playing song data and sends it off to a URL of your choosing. The destination URL can be a widget, a website, an API call, whatever. The author’s website provides sample code to use, but I wanted to do it a little differently than he did. I also made some slight modifications to the plugin itself, in order to make it more clean.
To install the plugin, unzip the tar.gz file to ~/.gnome2/rhythmbox/plugins/RhythmToWeb/. Then load Rhythmbox, click on “Edit”->”Plugins” and locate “RhythmToWeb” in the list. Click on “Configure”.
For “URL” type in the URL of where you will have your handler script. For “Secret” type in any password or string of characters you want to use (1two3four5six would work, for example, or perhaps your birthdate and name — try to not use spaces of #’s.). Make sure you jot it down for a moment, because you’ll need to use it in the server script below. (Leave “interval” at 2… I’ve never had reason to change that.)
Felix, the original author, liked my “multiple song” tracking and has updated his code to use it. Nice work!
My PHP server-side code is below.