Last.fm Hack Day: Scrobbling Spotify

Posted on

Sunday was Last.fm's first Hack Day (and my first Hack Day too) a great opportunity to get together with a bunch of other developers, enjoy a steady supply of free food, coffee and beer and spend the day hacking away at whatever Last.fm-related projects we could dream up. I particularly liked Neil Crosby's Last Genius which builds a playlist of similar music based on a single starting track and Matt Ogle's Songcolours which draws pretty graphs based the most common words in the lyrics of your favourite songs.

I spent the day playing around with SIMBL, Spotify and, of course, the Last.fm API trying to build a Spotify Scrobbler. Progress was slower than I would have liked and I spent most of the day trying to figure out Spotify's internal APIs and following various dead-ends (reverse engineering compiled software is tricky), but it was good to learn how to write SIMBL bundles and by the end of the day I'd managed to hack together a working plugin that was aware of when a new track started and what the track and artist names were. It seemed a shame to leave it half done, so I spent some time when I got home adding scrobbling capabilities, and you can now find a working Spotify Scrobbler over on GitHub (if you want to use it you'll find instructions in the read-me file).  It's not particularly polished, but I'm pretty pleased with how it turned out. All in all, a good first Hack Day.

As of 18th December 2008 Spotify has built-in scrobbling support.

5 Comments

Dirk Ginader commented on :

wow! I know a lot of people (including myself) were looking for a proper way to scrobble from Spotify! thank you!

Jens Nikolaus commented on :

It works! Well done, mate. :)

Matti commented on :

Could you give me an invite to spotify? I'm really interested in this application.

Jamie Kirkpatrick commented on :

Just found your post having spent the weekend hacking Spotify with SIMBL: good to see you went down the same roads I did to get to where you wanted...it was my first SIMBL hack too.

It's a shame they don't offer a proper Applescript dictionary or something: I'm writing a controller and doing so was not easy given that half the event handling happens in stripped C++ code and not via the normal Cocoa mechanisms.

Anywayho, made good progress. Was interested to see that in your code you used the spotify TrackInfo structure directly: any reason you went this way rather than just hooking into the Growl send method and extracting the details from there? (that's what I'm doing for now...)

George Brocklehurst responded on :

@Jamie: Glad you found the code useful. I agree that an official AppleScript bundle would be a nicer interface. Don't read too much into the specific decisions I made about how things should work – it was very much a process of trial and error.

I wrote another SIMBL hack for Spotify a while after the hack day, which is also on GitHub.