XSPF support in Amarok

Sebastian Pipping webmaster at hartwork.org
Sat Sep 22 16:34:50 UTC 2007


@xspf mailing list
  full discussion can be found here:
  http://mail.kde.org/pipermail/amarok/2007-September/thread.html



Ian Monroe wrote:
>> Yes, XSPF is quite simple compared to other formats.
>> However there are details hard to do right e.g. whitespace
>> handling.
> 
> Whitespace handling, that sounds like an issue for the XML library to
> handle, unless there's something we should know about?

--------------------------------------------------------------
An XML parser cannot take whitespace handling off your
shoulders because that depends on the concrete "language"
you are parsing: for some element types whitespace has
to be stripped and for some preserved. What the XML
parser has to do is report all whitespace. Details on
whitespace in XSPF are documented at [1].

XML is not nearly as easy to do right as it might seem at
first. That's part of why you really need to use an
XSPF library.
--------------------------------------------------------------



>>  It's easy to write an XSPF reader and writer that
>> understand each other within a single application. What is not
>> simple is to be interoperable with other applications.
> 
> This doesn't make any sense to me.

--------------------------------------------------------------
Let's use a real life example here: If some application
writes and reads XSPF files with the namespace set to
"http://xspf.org/ns/1/" instead of "http://xspf.org/ns/0/"
which is the right one for XSPFv1(!) then that application
can re-read the files it created itself but neither

 * can it read files produces by anybody else
 * nor can other apps read its files

That's bad and even worse very easy to run into.
It can be avoided by building upon the reference
implementation.
--------------------------------------------------------------



> So OK here is my opinion, it should up to whoever wants to improve
> XSPF support in Amarok.

--------------------------------------------------------------
Sounds good! Count me and the whole XSPF mailing list [2]
in for mentoring on libSpiff integration.

Any volunteers?
--------------------------------------------------------------



> Expat appears to have Windows support so that wouldn't be an issue.
> And yea, pretty much everyone already has Expat.  It would take some
> work creating a QXmlStreamReader/QXmlStreamWriter obviously. Looking
> at the libspiff API, it would also take some elbow grease interfacing
> with it (just the normal abstract data type conversions). The fact
> that a  QXmlStream[Reader|Writer] could interface with 'native' Amarok
> data types could be an advantage, but I'm not sure how much of one.
> Either way we end up with a stream-based XSPF writer/reader.

--------------------------------------------------------------
It should be nothing more than making QStrings from char/wchar_t.
I'm looking forward to proper XSPF support in Amarok!



Sebastian


[1] http://wiki.xiph.org/index.php/XSPF_v1_Notes_and_Errata#Whitespace
[2] http://lists.musicbrainz.org/mailman/listinfo/playlist



More information about the Amarok mailing list