1

I'm working on a music software and I would like to use the XSPF specifications since its a standard, but there is something I don't get.
Or maybe it doesn't even exists, since the last update of the specs are... 14 years old.

For tracks, they have the location tag to set the source file of a song.

    <track>
        <location>http://example.com/song_1.mp3</location>
    </track>

But what if, with my code, I don't know the URL of a source file, but instead I know the links to one or several music services that could stream that track (spotify/soundcloud/...), depending of what the user is able to play ?

Can I, and how can I declare one or several links of that track on music services, in my XSPF ?

eg for a same track:

https://geo.music.apple.com/be/album/_/1444279072?i=1444279073&mt=1&app=music&at=1000lHKX
https://open.spotify.com/track/6XBaTMiZa77Du2XEl1RNaa
https://www.deezer.com/track/66644816
https://music.amazon.com/albums/B082QWLFM7?trackAsin=B082QMC1C9&do=play
https://www.youtube.com/watch?v=PA3P1-aSvKQ
https://www.youtube.com/watch?v=vUes9-tFWm4

Maybe it as simple as declaring several location tags ?

URI of resource to be rendered. Probably an audio resource, but MAY be any type of resource with a well-known duration, such as video, a SMIL document, or an XSPF document. The duration of the resource defined in this element defines the duration of rendering. xspf:track elements MAY contain zero or more location elements, but a user-agent MUST NOT render more than one of the named resources.

<track>
    <location>https://geo.music.apple.com/be/album/_/1444279072?i=1444279073&mt=1&app=music&at=1000lHKX</location>
    <location>https://open.spotify.com/track/6XBaTMiZa77Du2XEl1RNaa</location>
    <location>https://www.deezer.com/track/66644816</location>
    <location>https://music.amazon.com/albums/B082QWLFM7?trackAsin=B082QMC1C9&do=play</location>
    <location>https://www.youtube.com/watch?v=PA3P1-aSvKQ</location>
</track>

Or should it be done using the identifier tag ?

Canonical ID for this resource. Likely to be a hash or other location-independent name, such as a MusicBrainz identifier. MUST be a legal URI. xspf:track elements MAY contain zero or more identifier elements.

For example, the URI http://musicbrainz.org/track/7e1d6f5f-0ac3-4889-8b57-506a67b459fc.html is an identifier for a specific song, but dereferencing that identifier will not yield a copy of the song.

Or using the link tag - which was my first idea but I'm less and less sure it has been designed for this ?

The link element allows XSPF to be extended without the use of XML namespaces. xspf:track elements MAY contain zero or more link elements.

The documentation is not really obvious about that.

Can anyone help ?

Thanks !

gordie
  • 1,637
  • 3
  • 21
  • 41

1 Answers1

1

You should use the identifier element (http://xspf.org/xspf-v1.html#rfc.section.4.1.1.2.14.1.1.1.2) for things like Spotify links.

The info element can also do what you need (http://xspf.org/xspf-v1.html#rfc.section.4.1.1.2.14.1.1.1.6), but you can only have one per track, so you couldn't cover more than one streaming service.

Regarding the many years since the last update of the spec, maybe it's time to work on one. A blessed JSON version would be useful.

It's productive to discover that the spec is not clearly communicating this information. In the time we wrote the spec most functioning Internet music was an MP3 on a web server. Now streaming services do the job. We could possibly fix this with an update to the documentation. For example, the sample playlists at http://xspf.org/quickstart/ could show how to do it.

Lucas Gonze
  • 575
  • 1
  • 5
  • 13