<!--#include virtual="/ssi/header.include" --> <!-- Enter custom page information and styles here --> <title>XSPF: XML Shareable Playlist Format: Quick Start</title> <style type="text/css"> <!-- #schema_ a { text-decoration: underline; } pre { margin-left: 3em; background-color: lightyellow; font-size: 125%; } span.callout { background-color: #eeeeee; color: red; } --> </style> <!--#include virtual="/common/xiphbar.include" --> <!--#include virtual="/ssi/pagetop.include" --> <!-- All your page content goes here --> <h1>Quick Start Guide</h1> <div>This document is a guide for people just encountering XSPF for the first time.</div> <h2>What is XSPF?</h2> <ul> <li>A playlist format like M3U</li> <li>XML like RSS</li> <li>Pronounced <cite>spiff</cite></li> <li>MIME type <code>application/xspf+xml</code></li> </ul> <h2>What does XSPF look like?</h2> <div>A very simple document looks like this:</div> <div> <pre> <?xml version="1.0" encoding="UTF-8"?> <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track><location>file:///mp3s/song_1.mp3</location></track> <track><location>file:///mp3s/song_2.mp3</location></track> <track><location>file:///mp3s/song_3.mp3</location></track> </trackList> </playlist> </pre></div> <div>Notice that the file names are <em>URIs</em>, meaning that you could pass them to a web browser. Also notice that it's <code>track<em>L</em>ist</code>, with an uppercase <cite>L</cite>, not <code>track<em>l</em>ist</code>, with a lowercase <cite>l</cite>.</div> <div>The following playlist is just the same except that the files are out on the web:</div> <div> <pre> <?xml version="1.0" encoding="UTF-8"?> <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track><location><span class="callout">http://</span>example.com/song_1.mp3</location></track> <track><location><span class="callout">http://</span>example.com/song_2.mp3</location></track> <track><location><span class="callout">http://</span>example.com/song_3.mp3</location></track> </trackList> </playlist> </pre></div> <h2>MIME type</h2> <div>The MIME type for XSPF documents is <code>application/xspf+xml</code>. It is <em>NOT</em> <code>text/plain</code>, <code>audio/xspf</code>, or <code>text/xml</code>. <em>THIS IS IMPORTANT</em>.</div> <h2>Metadata</h2> <div>In the following section I'm going to show how to do standard metadata by giving example playlists for each item. I'll show each item by making a change in the following sample code: <div> <pre> <?xml version="1.0" encoding="UTF-8"?> <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track> <location>http://example.com/song_1.mp3</location> </track> </trackList> </playlist> </pre></div> </div> <dl> <dt>How do I set metadata about the playlist, like the title, the name of the author, and the homepage of the author?</dt> <dd> <div> <pre> <?xml version="1.0" encoding="UTF-8"?> <playlist version="1" xmlns="http://xspf.org/ns/0/"> <!-- title of the playlist --> <span class="callout"><title>80s Music</title></span> <!-- name of the author --> <span class="callout"><creator>Jane Doe</creator></span> <!-- homepage of the author --> <span class="callout"><info>http://example.com/~jane</info></span> <trackList> <track> <location>http://example.com/song_1.mp3</location> </track> </trackList> </playlist> </pre></div> </dd> <dt>For a song in a playlist, how do I set metadata like the name of the artist and title of the album?</dt> <dd> <div> <pre> <?xml version="1.0" encoding="UTF-8"?> <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track> <location>http://example.com/song_1.mp3</location> <!-- artist or band name --> <span class="callout"><creator>Led Zeppelin</creator></span> <!-- album title --> <span class="callout"><album>Houses of the Holy</album></span> <!-- name of the song --> <span class="callout"><title>No Quarter</title></span> <!-- comment on the song --> <span class="callout"><annotation>I love this song</annotation></span> <!-- song length, in milliseconds --> <span class="callout"><duration>271066</duration></span> <!-- album art --> <span class="callout"><image>http://images.amazon.com/images/P/B000002J0B.01.MZZZZZZZ.jpg</image></span> <!-- if this is a deep link, URL of the original web page --> <span class="callout"><info>http://example.com</info></span> </track> </trackList> </playlist> </pre></div> </dd> </dl> <!--#include virtual="/ssi/pagebottom.include" -->