Blog AboutGalleryPortfolioContact
Kenneth Solberg
Welcome to my blog

Last.fm listing

Last.fm is a social network and music tracking site that is built on top of the Audioscrobbler system, a huge database that tracks listening habits and calculates relationships and recommendations based on the music people listen to. Audioscrobbler exposes a bunch of REST web services with profile data, artist relation data, recently played tracks etc.

With 3 lines of XSLT code you can have a list of your Last.fm top albums, just like in my About section. Umbraco extends XSLT files by default with the Umbraco.library. In this library there is especially one method that opens up the mashup-doors to Web 2.0 apps, namely the GetXmlDocumentByUrl(). The method wraps a WebRequest() and returns the content prepared as XML. (To create your own XSLT extensions, check out the Umbraco Wiki books).

XSLT:

   1: <xsl:for-each select="umbraco.library:GetXmlDocumentByUrl('http://ws.audioscrobbler.com/1.0/user/rabagaz/topalbums.xml')//album">
   2: <img src="{image/small}" alt="{artist} - {name}" height="50" width="50" hspace="5" vspace="5"/> 
   3: </xsl:for-each>

Umbraco is your perfect companion for so-called mashups, especially because of its excellent Macro system that renders Macros (XSLT or .NET user controls) real-time in the Client. Head over to http://www.programmableweb.com/apilist and start mashin’!

22.6.2006