Audioscrobbler meets the commandline

May 3rd, 2004  |  Published in python  |  1 Comment

It’s been around for a while, but suddenly everyone’s talking about audioscrobbler again. I got interested when I saw a talk about last.fm at dorkbot a few months back. It’s based on the simple idea of instrumenting your music player to send a ping to a central site every time you’re listening to a track. Going further than just a ‘now playing’ on a sidebar on your website, this leads to a world of potential new music toys using collaborative filtering and the like.

At home I play all my music from the commandline: my mp3 jukebox has no fancy user interface, I just SSH into it. Audioscrobbler have several player plugins for download, but no commandline interface. I wrote myself some python code to play MP3s and talk to audioscrobbler so that I could keep my profile up to date.


Popping onto the audioscrobbler IRC channel, I found Russ and RJ, two key guys behind the system. They were very helpful, sorting me out with a client ID for testing and giving debugging tips.

As so often happens, the python community had already supplied all the libraries I need to make the guts of my system: pymad to decode MP3s, pyao for audio output, pyid3lib to read ID3 tags. Building the code was just a matter of following the protocol documentation and writing about 100 lines to stick it all together.

The Audioscrobbler protocol is very nice. Top marks for using the web the way it was designed, letting me GET the details I need to start a session (MD5 challenge, URL to submit to, etc) and then POST my information to affect my user profile. The protocol used within the transaction doesn’t use RDF or XML, which would be my choice, but it is nice and simple, reminiscent of traditional text-based internet protocols such as SMTP and POP3.

Now I’ve reached this simple goal (a commandline MP3 player with no controls that submits ‘now playing’ information), I’d like to take it further. If I had a newer iPod, it’d be great to write a bit of code to submit tracks I’ve been playing on the move to my profile, but sadly my iPod is of too early a generation to have that feature. More interestingly, I look forward to being able to make use of audioscrobbler’s analysis to build my own playlists and discover new music. For now this is mostly only doable through the audioscrobbler site, but there are also data dumps available. It’d be great to have a combination of the two – an online REST query interface that gives machine-readable results.

Oh, and don’t forget… donate to Audioscrobbler and keep a great project online.

Responses

  1. shanti's daily links says:

    September 11th, 2004 at 10:03 am (#)

    Audioscrobbler meets the commandline

    Audioscrobbler meets the commandline…