An Ajax Erlang Jukebox
When I first joined LShift, one of the machines in the office had the responsibility of being the office jukebox. It ran some SQL-based web jukebox from the mists of time whose name I no longer recall; when we moved offices, the jukebox didn’t survive the move, and we set about trying to figure out what to replace it with.
After a while, I decided to write a new one—I don’t remember why, it seemed like the right thing to do at the time—and used Racket (called MzScheme, at the time) and its web server to do the job.
The basic design:
- The server would run on a machine with a sound card, connected to a stereo.
- Users would host
mp3
s andogg
files, etc., on their personal desktop workstations, and would serve the files via plain old HTTP. - The jukebox would be told, one URL at a time, where music files could be found, and would run a reindexing spider for each such music repository when asked to do so.
In mid 2006, after one final battle with the PLT webserver, I decided to call it quits and reimplement the thing in Erlang, since we were just about to start work on RabbitMQ and (I thought to myself) I may as well learn something of the language before having to use it for real.
Reimplementing the system in Erlang turned out to be a very smooth process, and was more-or-less completed over a weekend. The new implementation has been stable ever since. Over time, it has accumulated dependencies on external libraries for processing metadata and so forth, but the core of the application is pure Erlang. Erlang is very well-suited for this kind of project, where many concurrent activities (spidering, playback, presenting search results) exist in the system.
LShift is, as far as I can tell, still running the jukebox, and it’s still being developed by them in-house.
Links
The jukebox is hosted on github.
-
The code depends on my implementation of JSON and JSON-RPC for Erlang.
-
Documentation for installing and configuring the jukebox is available here.
-
This is the blog post originally announcing the system, from back in November 2006.