<!--#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>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;playlist version="1" xmlns="http://xspf.org/ns/0/"&gt;
    &lt;trackList&gt;
        &lt;track&gt;&lt;location&gt;file:///mp3s/song_1.mp3&lt;/location&gt;&lt;/track&gt;
        &lt;track&gt;&lt;location&gt;file:///mp3s/song_2.mp3&lt;/location&gt;&lt;/track&gt;
        &lt;track&gt;&lt;location&gt;file:///mp3s/song_3.mp3&lt;/location&gt;&lt;/track&gt;
    &lt;/trackList&gt;
&lt;/playlist&gt;
</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>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;playlist version="1" xmlns="http://xspf.org/ns/0/"&gt;
    &lt;trackList&gt;
        &lt;track&gt;&lt;location&gt;<span class="callout">http://</span>example.com/song_1.mp3&lt;/location&gt;&lt;/track&gt;
        &lt;track&gt;&lt;location&gt;<span class="callout">http://</span>example.com/song_2.mp3&lt;/location&gt;&lt;/track&gt;
        &lt;track&gt;&lt;location&gt;<span class="callout">http://</span>example.com/song_3.mp3&lt;/location&gt;&lt;/track&gt;
    &lt;/trackList&gt;
&lt;/playlist&gt;
</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>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;playlist version="1" xmlns="http://xspf.org/ns/0/"&gt;
    &lt;trackList&gt;
        &lt;track&gt;
            &lt;location&gt;http://example.com/song_1.mp3&lt;/location&gt;
        &lt;/track&gt;
    &lt;/trackList&gt;
&lt;/playlist&gt;
</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>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;playlist version="1" xmlns="http://xspf.org/ns/0/"&gt;

    &lt;!-- title of the playlist --&gt;
    <span class="callout">&lt;title&gt;80s Music&lt;/title&gt;</span>

    &lt;!-- name of the author --&gt;
    <span class="callout">&lt;creator&gt;Jane Doe&lt;/creator&gt;</span>

    &lt;!-- homepage of the author --&gt;
    <span class="callout">&lt;info&gt;http://example.com/~jane&lt;/info&gt;</span>

    &lt;trackList&gt;
        &lt;track&gt;
            &lt;location&gt;http://example.com/song_1.mp3&lt;/location&gt;
        &lt;/track&gt;
    &lt;/trackList&gt;
&lt;/playlist&gt;
</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>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;playlist version="1" xmlns="http://xspf.org/ns/0/"&gt;
    &lt;trackList&gt;
        &lt;track&gt;
            &lt;location&gt;http://example.com/song_1.mp3&lt;/location&gt;

            &lt;!-- artist or band name --&gt;
            <span class="callout">&lt;creator&gt;Led Zeppelin&lt;/creator&gt;</span>

            &lt;!-- album title --&gt;
            <span class="callout">&lt;album&gt;Houses of the Holy&lt;/album&gt;</span>

            &lt;!-- name of the song --&gt;
            <span class="callout">&lt;title&gt;No Quarter&lt;/title&gt;</span>

            &lt;!-- comment on the song --&gt;
            <span class="callout">&lt;annotation&gt;I love this song&lt;/annotation&gt;</span>

            &lt;!-- song length, in milliseconds --&gt;
            <span class="callout">&lt;duration&gt;271066&lt;/duration&gt;</span>

            &lt;!-- album art --&gt;
            <span class="callout">&lt;image&gt;http://images.amazon.com/images/P/B000002J0B.01.MZZZZZZZ.jpg&lt;/image&gt;</span>

            &lt;!-- if this is a deep link, URL of the original web page --&gt;
            <span class="callout">&lt;info&gt;http://example.com&lt;/info&gt;</span>

        &lt;/track&gt;
    &lt;/trackList&gt;
&lt;/playlist&gt;
</pre></div>
</dd>


</dl>


<!--#include virtual="/ssi/pagebottom.include" -->