Displaying Recent Tracks with PHP4

We've been using a modified version of marc2003's recent tracks script as an example of how to display your recent tracks feed. It's simple, elegant and just works. However, it requires PHP5 due to it's dependance on SimpleXML.

If you are limited to PHP4, click here to download a version that does not rely on SimpleXML. Be sure to change the file extension from .txt to .php.

Artist images in recent tracks feed

Someone on the last.fm forums was asking about artist images for recently scrobbled tracks, so I though I'd look into adding them to our recent tracks feed.

Unfortunately, that artist info is really hard to get to on-demand. There's no info feed for artists, so even though you can get Similar Artists, Top Fans, Top Tracks, Top Albums, Top Tags, and Current Events, you can't get a simple artist detail. However, if you pull the similar artists feed, pick the first artist in the list, then pull that artist's similar artists feed, you can spin through those artists and find the target artist. This method does work, but does not seem to generate matches for all artists, so there are some blanks here and there. I've got a cron job running to update all of the artists that are already cached in our DB (around 1100) with the image data, it should be done by this time tomorrow. Any artists not already in our DB will have their image data saved as they come in on the last.fm recent tracks feeds.

ZenRadar recent tracks feeds now have small and large artist images in the artist nodes, like this:

<artist mbid="">
    Sound Tribe Sector 9
    <url>http://www.last.fm/music/Sound+Tribe+Sector+9</url>
    <image_small>http://userserve-ak.last.fm/serve/50/86460.jpg</image_small>
    <image_large>http://userserve-ak.last.fm/serve/160/86460.jpg</image_large>
</artist>

Which will give you:




Artists that we haven't found images for will have the last.fm default "no artist" images:


http://cdn.last.fm/depth/catalogue/noimage/noartist_50px.jpg


http://cdn.last.fm/depth/catalogue/noimage/noartist_140px.jpg

I hope this is useful, let me know if you have any questions, or if you'd like artist images added to any of the other feeds.

Timeout Errors Fixed

Since moving to our new server a couple of weeks ago, we've been experiencing some timeout problems on operations that pull a lot of feeds from last.fm. This was causing ugly 500 errors while pulling feeds or loading the dashboard. This afternoon I tracked the problem to mod_fcgid's ridiculously low default timeout params and fixed it.

Sorry for the inconvenience!

Zen Radar on build.last.fm

Zen Radar on build.last.fm

"Last.fm feeds on crack. All the enhancements you ever wanted."

ZR has been added to build.last.fm. We're proud to be a part of the growing last.fm developer community.

If you're new here, take a moment to read about what this thing is and find out how to use it. If you have questions, check the FAQ, or feel free to contact us. If you're ready to get a closer look, create an account and dive right in.


Recent Loved Tracks RSS

Some people on the last.fm forum have been asking for an RSS feed for recently loved tracks, so I whipped one up for ZR users. This feed does not contain album info or art, if you find this feed useful, and would like to see the album info added, let us know.

Here's the feed URL:
http://zenradar.roblogic.net/service/1.0/user/[your username]/recentlovedtracks.rss

I'm not sure if there is much demand for RSS over XML, if you'd like to have more RSS feeds, speak up and we'll get on it.



Thirdparty Labs
tpl skunkworks

last scrobbled track


user login

username


password


newest users



RSS