My mash

As previously blogged, I attended the BBC’s Mashed08 hack day. I explored some of the noteworthy hacks on the LOLCODE site, but it’s time that I explain what I did with my 24 hours straight of hacking.

The number of APIs and virtual toys unleashed by the BBC at Mashed08 was a bit dizzying with all the choices. In the end, however, I had to go with an idea that had been rattling around in my head for the longest: a twitter bot based on the Echo Nest Recommend API. Twitter bots are nothing new, not terribly original, and not even all that feasible nowadays with the API limits, but it seemed quite a nice application of the EN Recommender.

What I spent a lot of time on was the ergonomics, context awareness, and giving the bot a memory, all in aid of getting maximal information from minimal effort from the (mobile) twitter user. The bot’s name, ‘recomme,’ was designed to be easily keyable with a T9 keypad. I spent a fair amount of time on maximizing the amount of information in 140 characters.

Given a tweet with a bandname to @recomme, it responds with the closest recommended bands:

If you name one the BBC’s (pop) music radio stations, then the bot is aware of the context at the time: it goes off and checks on what’s currently playing:

If you messaged the bot too late, however, you can correct it, asking for the track immediately preceding:

If the recommendations are on target, you can ask for more of the same:

As you can see, there’s a fair bit of state saved with each interaction with the bot, and it responds with as much information it can fit into the space allotted.

The fairly terse URLs that follow each set of recommendations are give each query some persistence, an easily accessible reminder of what was requested, capturing the context of the moment, and offering more verbose detail than can be captured in a 140 character message. The user’s past queries (saveable, sharable) are also accessible via a linked user page.

The cherry on top, and perhaps the only part of the hack that couldn’t conceivably be done last year, was that the BBC Audio & Music Interactive team brought live archives of the BBC pop music radio stations. For the Mashed08 event, I was able to link to these live, time-indexed archives, so in the above “BBCR1” query, the persistent link pointed to the right time in the past such that you would hear the BeatFreakz song that was playing at that time.

Most of the development time was spent re-learning parts of Django, and getting the model for the underlying web application (“memory”) right. The twitter bot is a separate process that requests information from and saves things to the Django webapp with some special POST requests.

The project was a a fair bit of fun, and it felt rewarding to see it through. I’m a bit conflicted on whether to deploy it: I think it would be good, fun, and useful to some, but it could easily use another solid 24 hours of polish before it’s presentable. Furthermore, Twitter is in no state to support a new bot: 20 API requests per hour are nearly useless for something that’s ostensibly an interactive mobile application.

As a postscript, I noticed that the “recomme.com” domain was cybersquatted by the time I returned to my hotel in London. I wasn’t too bothered by it, as I have other domains that could be pressed into service for this, but I was mightily impressed at who’s paying attention.