views:

71

answers:

1

On the Last.fm website, your recently listened track include the 34x34 (or whatever size) image at the left of each song. However, in the RSS feed that they give you, no image URLs are provided for the songs. I was wondering if there was a good way of figuring out the ID for the image that needs to be used for that artist and displaying it based on the data that we're given. I know it is possible to load the artist page from their website and then grab the image values from JavaScript, but that seems overly complicated and would probably take quite some time to do.

What we're given:

<item>
   <title>Owl City – Rainbow Veins</title>
   <link>http://www.last.fm/music/Owl+City/_/Rainbow+Veins&lt;/link&gt;
   <pubDate>Thu, 20 May 2010 18:15:29 +0000</pubDate>
   <guid>http://www.last.fm/user/animuson#1274379329&lt;/guid&gt;
   <description>http://www.last.fm/music/Owl+City&lt;/description&gt;
</item>

and the 34x34 image for this song would be here (ID# 37056785).

Owl+City

Does anything like this exist? I've considered storing the ID number in a cache of some sort once it has been checked once, but what if the image changes?

+2  A: 

After a bit of searching I found it (thanks Thomas McDonald as well). I found a user.getRecentTracks method that includes image URLs in the information and also uses XML, which is much more helpful to me.

What you get with this method:

<track> 
    <artist mbid="">Owl City</artist>
    <name>Rainbow Veins</name>
    <streamable>1</streamable>
    <mbid></mbid>
    <album mbid="f3e4acfb-6e99-4370-9f72-48dbd99d5206">Maybe I'm Dreaming</album>
    <url>http://www.last.fm/music/Owl+City/_/Rainbow+Veins&lt;/url&gt;
    <image size="small">http://userserve-ak.last.fm/serve/34s/22743543.jpg&lt;/image&gt;
    <image size="medium">http://userserve-ak.last.fm/serve/64s/22743543.jpg&lt;/image&gt;
    <image size="large">http://userserve-ak.last.fm/serve/126/22743543.jpg&lt;/image&gt;
    <image size="extralarge">http://userserve-ak.last.fm/serve/300x300/22743543.jpg&lt;/image&gt;
    <date uts="1274379329">20 May 2010, 18:15</date>
</track>

As you can see, a lot more information than the basic recent tracks RSS feed and you don't have to run multiple loads to get additional information, just the single XML load to get the feed.

animuson