Songkick is a music service that finds local concerts based on your personal tastes. You give it some info about what you like, either through an exported iTunes library, Pandora playlist, or Last.fm scrobble history, tell it where you’re interested in going, and it lets you know who is playing and where. I’ve been a happy user for at least two years now, and it’s a really good tool for tracking tours and concert history.
For all the aspects I enjoy about Songkick, I found it somewhat difficult directing people to my Upcoming Events calendar. They don’t seem to offer any pre-configured way to embed the content in other places, but they do offer an API now. I requested an API key, and went to work trying to embed my Upcoming Events calendar into this blog post.
I’ve made a few comments in the code below to give you an idea what’s going on, but the meat of the work is in the getConcertHTML function, a callback that is triggered when the JSONP object is received from Songkick. I’m using simple string concatenation to build up some generated HTML, which then replaces the content of the HTML element with ‘songkick’ as its ID.
// callback used to process the JSONP object
; @layout post
So, the Upcoming Events are shown below. The formatting isn’t great, but it is functional. I’m curious what it would take to pull some of the templating out of the HTML generation code of the callback, because right now I have to hard-code some things like the styles. Perhaps something like the jQuery or Protype library would be useful for this. In the future, I would like to make an IRC bot that you could query for the same information in a channel. It shouldn’t be hard to make a Python wrapper for the entire API, similar to libsonic, which I’m using in Mopidy-Subsonic. I hope you’ve enjoyed reading this post. I’m still catching up on a few posts that are backlogged, so hopefully there will be more soon.