Mpris Songbird Extension

Tags: C Plus Plus Javascript
I was wandering around the internet a few months ago and looking at Songbird extensions. At the time I think I was looking for ones that could be used for remote control. I came across DbusBird. 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 :) For those unaware, MPRIS is a media player control interface thats runs on the Linux DBUS. More info can be found here. Last month, I was looking for a project this came to mind. It seemed like a project that would be great, 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. The project was a great success! It took me about 3 weeks of working after finishing my day at work, though I in no way worked every night. I started off by writing a simple C class to send dbus messages via the dbus C bindings. From there I figured out how to compile an XPCOM extension against Mozilla's developement libraries. Then combines them both and wrote the Javascript.

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 email me.

On 2009-06-17 18:14:02:
Project complete! Check it out!
Valid XHTML 1.1 Valid CSS2