NIEDZIELSKI.COM
 

bananas

I finally got around to experimenting with the last.fm / Audioscrobbler API to generate song recommendations.  It turned out to be fairly simple to write a rudimentary Python script to automate the task.  For example, here’s all the code for retrieving data in XML form from last.fm:

import urllib

def service( str_url ):
sock = urllib.urlopen( str_url )
str_xml = sock.read()
sock.close()
return str_xml

The script is fairly pragmatic / specific / hackish. I just wanted my recommendations. Here’s a breakdown of the automation:

  1. Get my top 50 tracks.
  2. For each track, get the top 50 listeners.
  3. For each listener, get their top 50 tracks.
  4. Count the number of occurrences of each track and dump the results in an ordered list.

In terms of results, here are my top ten recommendations (without tracks already contained in my top 10):

0080: Coldplay – Viva la Vida
0070: The Killers – When You Were Young
0066: Paramore – Misery Business
0050: Metro Station – Shake It
0049: The Postal Service – Such Great Heights
0047: Coldplay – Violet Hill
0046: Muse – Starlight
0046: Death Cab for Cutie – I Will Follow You Into the Dark
0043: Jason Mraz – I’m Yours
0041: Death Cab for Cutie – Soul Meets Body

The numbered column on the left represents the number of listener top 50’s a song was found in during the search. The second column represents song artist. The third represents song title.

So I listened to the recommendations! Out of the above 10, there was one song I enjoy (Starlight, for the record) and the rest didn’t do anything for me. BAH! I think that in order to get better results I would need to make a significantly more sophisticated selection.

At any rate. you may download my hackjob here.