Archive for November 6th, 2006

An AJAX Erlang Jukebox

Erlang Jukebox Screenshot

Sometime around the beginning of July I rewrote our internal jukebox in Erlang. It’s taken me four months to get a round tuit, but new stock has just arrived: here’s the code for our AJAX jukebox web-application, as a tarball. (There’s also a darcs repository: darcs get http://www.lshift.net/~tonyg/erlang-jukebox/.) Click on the image for a screenshot.

To run it, you will need Erlang, Yaws (the Erlang webserver), a modern browser, mpg123, ogg123 (from vorbis-tools), and some MP3 or OGG files to listen to.

I’ve made a start on a bit of documentation and design rationale. Here are a few highlights for the curious:

  • You point the jukebox at one or more root URLs, which it then spiders, collecting URLs for MP3 and OGG files, which it puts into a simple flat-file database. Just expose, say, your iTunes folder via Apache, point the Jukebox at it, and you’re away.

  • It relies on mpg123 and ogg123’s support for playing HTTP-streamed MP3 and OGG files, respectively, rather than retrieving or playing the media itself.

  • The user interface is completely written in HTML+Javascript, using prototype for its event binding and XMLHttpRequest support.

  • The server side of the application communicates with the user interface solely via JSON-RPC.

  • Erlang made a great platform for the server side of the application. Its support for clean, simple concurrency let me design the program in a very natural way.

As part of the development of the program, I built a few stand-alone modules that others might be interested in reusing:

[Update: fixed an issue with json.js, tweaked the use of screen real-estate, and now seems to work with Safari, IE6, and Opera. I’ve changed the tarball link above to point to the new version.]

[Update: fixed a couple of links that had broken over time as the darcs repository evolved.]

17 comments November 6th, 2006 tonyg

Calendar

November 2006
M T W T F S S
« Oct   Dec »
 12345
6789101112
13141516171819
20212223242526
27282930  

Posts by Month

Posts by Category