MPRIS Songbird Extension

Logan Smyth's picture
Submitted by Logan Smyth on Wed, 07/01/2009 - 01:00

This extensions provides an MPRIS interface for controlling Songbird through the Linux DBUS. It allows for changing tracks, volume and position, prev/next, play/pause/stop, as well as allows for retrieval of metadata on songs. This is my first Songbird extension and likely my last since they have discontinued support for Songbird on Linux, though there are still nightly builds available.

It began because I was wandering around the internet looking at Songbird extensions. At the time I think I was looking for ones that could be used for remote control and I came across DbusBird, but I was disappointed to see that it only supported reading basic metadata, and in the comments, someone mentioned MPRIS. I had no idea what that was, but I went and looked, since that's what one does when they are wandering the net :) MPRIS is a media player control interface standard thats runs on the Linux DBUS. A few months later, I was trying to decide on a project to work on and this came to mind. It seemed like fun, since I'd get to not only learn how to code a Songbird extension, but also learn how to contact DBus from C/C++. And thus it began.

There isn't a whole ton I can say really other than that project was a great success! It took me about 3 weeks of working a few nights a week. I started off by writing a simple C class to send dbus messages via the dbus C bindings and from there I figured out how to compile an XPCOM extension against Mozilla's developement libraries. The extension uses a combination of Javascript and C++, because C++ is needed for the DBus bindings and Javascript is easier to debug and requires no compiling. Because I was using several songbird specific classes, if I'd wanted to do it in C++, I'd have had to get the songbird source/headers. I decided that it would be easier in the long run to compile against the standard Mozilla xulrunner libraries and write the Songbird specific code in Javascript.

I've linked to the files on the side here and put up a bunch of links that I found super helpful for Mozilla and dbus stuff. If you have any questions, take a look at the source and feel free to contact me.

Add new comment

You are here