Playing XSPFs in Rhapsody – REST API

August 24, 2006

One of the main features of the new version of Musicmobs is the ability to play playlists in Rhapsody. What you might not know is that the REST API we’ve created can be used to open other XSPF files into Rhapsody as well.

If you look at any of the “Play” links on Musicmobs, you’ll notice URLs that look like this:

The key is the ?xspf= query string. As long as the XSPF you’re trying to open is hosted on the web, and properly marked up with metadata (<creator>, <album> and <title> elements for each track) our player should be able to grab it and do its best to find the songs in Rhapsody.

Where do you find playlists to open? For now there are really only two places you can get properly marked up XSPFs: Musicmobs and Finding XSPFs on Musicmobs is easy enough, but takes a little digging.

If you look at the Audioscrobbler Web Services page you’ll see that they expose various data feeds in XSPF format. Any of these URLs should be valid to use with our REST API.

For example this URL will play the top tracks tagged ‘Rock’ on

The one caveat is that doesn’t include the <album> element in their XSPFs. This means that our player will only find the song in Rhapsody after it’s been cached from the Rhapsody Web Services API at least once. Since our cache is continuously being filled, our matching will improve over time.

Finally, since it’s unlikely that you want the player to load (and therefore resize) your current window, it’s best to add target=”_blank” to any player URL. The finished product should look something like this:

<a href=”; target=”_blank”>Indie Playlist</a>

Also, if anyone knows of other web sites that you can get fully marked up XSPFs, please leave a comment and we’ll check it out.


10 Responses to “Playing XSPFs in Rhapsody – REST API”

  1. Paul Says:

    This is pretty neat (although the rhapsody player always seems to crash my browser ..). Too bad about the missing album issue … You should take a look at using the musicbrainz web service to look any missing info to avoid the cache problem (well, actually, I’m sure you already have). There web apis are pretty straightforward … then you can have a 4 way web service (muscmobs, musicbrains, and rhapsody ). The xml-based formats (such as already include the musicbrainz id… ), I bet it wouldn’t be hard to convince to include the mbid in the identifier section for each track in the xspf format. This is clearly what the field was intended for and would make the sharing of playlists even easier.


  2. Toby Says:

    That’s interesting, although philosophically speaking I’d rather have the system work with less data instead of adding additional hooks for more unique ids. Eventually I’d like to support microformats like hPlaylist that would potentially be created by a human (a non-developer).

    Once we acquire enough data from the Rhapsody API, we should have pretty decent matching.

  3. Paul Says:

    I’m interested in how you do the matching, it is certainly not trivial, there are so many forms for artist names, the normalization is not straightforward. Musicbrainz uses a statistical approach, they have a db of all aliases ever encountered for a particular artist. This lets them match “The Beatles”, “Beatles”, “Beatles, The” “The Beetles”, “Beetles”, “Beetles, The” without issue because they’ve encountered tracks with those labels. This has the advantage when they encounter an ambiguous name like ‘elvis’ or ‘beck’ that they can use usage counts to make a good guess of which one was meant.

  4. byqgwtkd njuiy smklhw csnjrzu epqngau oukgs eyhmnojq

  5. pubgjdm fqskumwy emvzjnd rwayd uhrsvmxeg quvz vgqyhnb [URL][/URL] wpjfa carwuo

  6. ogio Says:

    Cool site. Thanks!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: