Scrobble Zen Radar
Getting Album Information from last.fm Recent Tracks Feed
Page 1: Theory of Operation
After setting up a recent tracks widget for my homepage with Zend_Service_Audioscrobbler, I came to the disappointing realization many people have lamented. There is no album information in the recent tracks feed, and no easy way to get it through other means. I don't really understand why the album info is not provided in the feed - the album listening stats are available, so it's being stored in the scrobbler database somewhere. I'm sure there's a good reason for this omission, since there have been a number of requests for this feature on the last.fm forums.
Since album detail feeds are available (with track listings!), it's possible to correlate the artist and track names in the recent tracks feed to the albums. It's not an easy task, and it's not 100% accurate, but with a little effort, you can put together a system that can match album info to your recent tracks list, complete with cover art, URLs to the album pages on last.fm, the whole enchilada.
Here's how it works:
So what to do?
Since album detail feeds are available (with track listings!), it's possible to correlate the artist and track names in the recent tracks feed to the albums. It's not an easy task, and it's not 100% accurate, but with a little effort, you can put together a system that can match album info to your recent tracks list, complete with cover art, URLs to the album pages on last.fm, the whole enchilada.
Here's how it works:
- Pull your recenttracks feed
- Loop through the list of tracks
- For each artist, pull the "top albums" list, which for most artists is their complete discography
- Loop through the list of albums, and pull the album info feed for each one
- Loop through the track list for each album and compare each track name to the name from the recenttracks feed
- When you get a hit, the current album info feed has everything you need.
So what to do?


