or, Learning to Hate Python One Commit at a Time

Most of the time, I’m content to remain Not A Programmer. After all, I’m not. I studied it for a while, and I know most of the basics, but advanced programming and algorithm studies and things like that just don’t interest me. I like doing things with computers, not trying to make them do things. Unfortunately, I found myself in a bit of a bind.

In my Copious Spare Time, I do an Internet radio broadcast for my amusement and the amusement of my friends. It’s fun, silly, and (now that I’m not trying to do it from 0200-0500 Eastern) relaxing. The problem, of course, is that I don’t operate anything remotely resembling a standard amateur rig for doing this. Part of any broadcast rig is music playback software, part of the rig is the streaming software, and part of the rig is a little widget that updates the metadata on the server with the song title information. A lot of software packages exist that tie all three of these components together in one application, but I don’t like any of the options available to GNU/Linux users.

To compensate for not having a handy-dandy all-in-one package that I liked, I found three separate components that I liked and tied them together with some spaghetti. To handle the streaming, I use a package called Darkice. It’s pretty flexible, and it’s super-easy to use. For music playback, I used to use XMMS, but it was deprecated even then and the development team was busily working on XMMS2, which doesn’t work the same. The last part was the trickiest. Neither Darkice nor XMMS will update the stream’s metadata with the current song title, since it’s not a job either of them is designed to do. So, I ended up digging up a little script called ‘shoutcast-titles.sh’ (available here) that would use a command-line HTTP client to update the metadata. XMMS had a plugin that let you run a command on certain events, and I configured everything accordingly.

Time passed.

I no longer use XMMS for my music; it doesn’t do the job I wanted it to do. I started using Amarok 1.4, and was seriously impressed with its functionality. It was well organized, easy to use, and even extensible with a plugin interface. The problem, of course, is that the plugin available for Amarok to update metadata was for Icecast servers only, and I was broadcasting over ShoutCast. I eventually buckled down and started hacking together a plugin for Amarok that would do the job I wanted it to do, but I never actually completed it.

More time passed.

Amarok got ‘updated’ to the new 2.x branch, and I stopped using Amarok. The new interface is ugly, clumsy, and painfully frustrating to use. I lost all interest in developing plugins for Amarok when I stopped using it as my primary source of aural entertainment. Eventually, though, after much trial and error, I stumbled across a project by people with similar enough tastes in music players to me: Exaile. Exile has most of the features of Amarok 1.4 that I really liked, and though it still has a few bugs, it works pretty well. Too, it’s written with a GTK+ interface, where my primary complaint about Amarok was its reliance on KDE (a desktop environment I would rather pass hedgehogs than use). Exaile also supports a plugin infrastructure, which allows for easy extension of functionality through the use of Python scripts. I hoped dearly someone had written a plugin to handle ShoutCast, or even Icecast, updates, but no dice.

I finally had enough. Last week, I broke down and started hacking together a plugin for Exaile to do what I wanted it to do. It took me a while to get caught up on Python; even simple stuff for most programmers takes me hours to puzzle out and implement, because my head’s just not wired the same way. Also, most of the formal study I put into programming was done with Java, which doesn’t look or feel anything like Python to me. The end result, though, is something I’m actually kinda proud of. I actually successfully produced a working plugin, that does everything I want it to, and even includes a configuration dialog to allow for users to set their own servers. Along the way, I stopped using ShoutCast, and went solely with an Icecast approach, so I dropped the idea of supporting ShoutCast with this plugin, but it works quickly and easily with Icecast, and I’m happy with it.

More to the point, I posted it here on this website where you can download it and use it for yourself. I may be updating it with a README file later, or perhaps even packaging it up, but for now, you can get it here:

git clone http://www.dragonsroost.org/src/updatetitles.git

Just put it in your Exaile plugins directory and away you go.

It’s released under the terms of the Revised BSD license, so don’t expect extensive support, but I’ll answer short questions about it if anyone’s curious.

« »