[Playlist] an alternate xspf over json implementation

Chris Anderson jchris at mfdz.com
Sat Jun 16 22:42:18 UTC 2007


Unless there's more input from other list members, I think we've got
ourselves a format. I'll start updating my Javascript XSPF parser to
produce this version.

On 6/16/07, Lucas Gonze <lgonze at panix.com> wrote:
> Sebastian Pipping wrote:
> > I think we should not introduce additional features
> > for JSPF. I think we should keep XSPF and JSON in sync.
> > If we really need more features we should make a successor
> > version of both JSON and XSPF in my eyes.
>
> I strongly agree.  There is no bigger mistake.

Here here!

But we've got to remember that hanging additional attributes on the
Javascript object will be the normal course of action when people are
using JSPF in the wild. I'll suggest that an object which has all the
fields in the specification, and is valid on those fields, but which
has some additional keys thrown on, is still valid JSPF. I see this as
a structural hallmark of any Javascript process which would use the
format, as well as defacto fallout from the existing world of JSON
applications.

I realize this practice is not nearly as scalable as XML namespaces -
but it think any kind of validator we create will be better served by
validating on the Javascript object result of parsing a JSPF document,
rather than on the JSPF document-string itself.

(I'm playing a little bit of devil's advocate here - I would avoid
private enrichments of the JSPF schema in my own projects - but I
think the fast and loose world of JSON really is better served by this
sort of permissiveness. Think of it as duck-typed validation.)

In other words, valid JSPF is valid JSON that when parsed yields an
object that responds to the correct set of messages.

eg.

my_jspf.playlist.track MUST be an array with zero or more elements

and

my_jspf.playlist.track[3].meta MAY be null or an array of zero or more elements.

to specify that for instance

my_jspf.playlist.nonstandard_property must be null

I think is an overspecification.

Thoughts?

-- 
Chris Anderson
http://jchris.mfdz.com



More information about the Playlist mailing list