[Playlist] Questions on spec about meaning of identifier and link
Lucas Gonze
lgonze at panix.com
Wed Jun 13 23:53:06 UTC 2007
I should give a little more detail on how a Musicbrainz track URI in an
identifier element can be converted into a URL that can be dereferenced to
return a song file.
Let's say you are an XSPF reader and you have been invoked to open a
playlist which contains this XML fragment:
<track><identifier>http://musicbrainz.org/track/541f8f37-c9f3-4567-b234-9806d25ca433.html</identifier></track>
(A fancy name for a "reader" is "content resolver," but I'm going to use
the wording "reader" here).
If you happened to support this identifier style, one way you might do it
is like this. You would have code which knew that a URI in the above
style could be converted into a URI which could be dereferenced to get an
XML file of metadata about the music being identified. In this case the
XML URI is:
http://musicbrainz.org/ws/1/track/541f8f37-c9f3-4567-b234-9806d25ca433?type=xml&inc=artist+releases
It appears that there is a track identifier shared between these two URIs,
and you (the reader) might have code which took a URI in the <identifier>
style, parsed out the shared portion, and inserted it into an XML URI.
You then parse the XML to get metadata, and you learn that the track title
is "Mandy", the artist name is "Barry Manilow", and the album title is
"Greatest Hits: The Platinum Collection."
Now that you have metadata, you can go get a dereferenceable URI for the
song. Your user might have told you already that they have a subscription
to the Napster subscription service; if you supported that, you would
probably use a web service provided by the subscription service to query
for a URL, using the song metadata as query terms. Another approach would
be to construct a Magnet URI
(http://en.wikipedia.org/wiki/Magnet:_URI_scheme) along these lines:
magnet:?kt="Mandy"+"Barry Manilow"+"Greatest Hits: The Platinum
Collection."
I hope this all makes sense. The identifier element is an important
feature of XSPF, but it's subtle and poorly documented. Please don't
hesitate to ask for clarification on- or off- list.
-Lucas
On 6/13/07, Lucas Gonze <lucas.gonze at gmail.com> wrote:
> There is a subtle thing to realize about http:// URIs -- they can be
> just identifiers and not at all locators. Because of this they have
> absorbed the function of URNs, which are now a subset of URIs (the
> subset which is just an identifier and not a locator).
>
> For example, let's say you wanted to have the recording of the song
> "Mandy" on the album "Greatest Hits: The Platinum Collection" by the
> artist "Barry Manilow" in your playlist, and you wanted your song
> reference to work regardless of where the listener happened to be able
> to fetch the song from.
>
> One thing you could do is go look it up on Musicbrainz.org and find
> the track page, then use the URI of the track page as the identifier.
> That URI happens to be at
> http://musicbrainz.org/track/541f8f37-c9f3-4567-b234-9806d25ca433.html
> , so the XSPF for this recording would be:
>
>
<track><identifier>http://musicbrainz.org/track/541f8f37-c9f3-4567-b234-9806d25ca433.html</identifier></track>
>
> Notice that dereferencing this URI does not give you a copy of the
> song. The URI is just an identifier, and not a locator.
>
> Also, it doesn't matter that this particular URI goes to a page of
> text and metadata. The URI doesn't have to even be real. It just has
> to be usable as an identifier which the publisher and content resolver
> can both understand. For example, the domain example.com is forbidden
> (by the rules of DNS) to map to any real world web server, but the URI
> http://example.com/track/541f8f37-c9f3-4567-b234-9806d25ca433.html is
> perfectly legal in an XSPF identifier element.
>
> -L
>
> (Hey Tomas, nice to see you. :)
>
> On 6/13/07, Tomas Franzn <tomas at lightheadsw.com> wrote:
> > On 13 jun 2007, at 22.12, Ross Mohn wrote:
> > > 1. Why does the spec indicate that a track identifier "MUST be a
legal
> > > URI"? I would think of this element as specifying a CD id code or
> > > something of that sort, not a URI. Doesn't the phrase "MUST be a
legal
> > > URI" conflict with the phrase "location-independent name"?
> >
> > Hi,
> >
> > Remember that URIs are not the same as URLs (the L stands for
> > Location). URIs can be URNs, meaning something like this (for ISBN
> > numbers):
> > urn:isbn:0-395-36341-1
> >
> > Note that the above does not specify a location. It's up the client
> > to figure that out.
> > Wikipedia has more info. http://en.wikipedia.org/wiki/URI
> >
> > (Hi everyone, BTW. It's been awhile since I last posted here.)
> >
> > Tomas Franzn
> > Lighthead Software
> > http://www.lightheadsw.com/
> >
> >
> > _______________________________________________
> > Playlist mailing list
> > Playlist at lists.musicbrainz.org
> > http://lists.musicbrainz.org/mailman/listinfo/playlist
> >
>
More information about the Playlist
mailing list