XSPF support in Amarok

Ian Monroe ian at monroe.nu
Sat Sep 22 14:56:41 UTC 2007


On 9/19/07, Sebastian Pipping <webmaster at hartwork.org> 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?

>  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.

> Choosing libSpiff automatically makes Amarok interoperable with
> any other application using libSpiff. And that is what especially
> the XML Sharable Playlist Format is about.
>
> Btw libSpiff has more than 140 testcases already.

Well that is nice really.

> It also does proper indentation for you when writing XSPF files
> so you also make sure to really produce human-readable output.

But this is what XML libraries do, though I suppose you probably coded
the writing part yourself since I see that Expat is just a XML parser.

> -------------------------------------------------------------------------
>
>
>
> > Currently I don't think we have a dependency of the Expat XML library
> > and depending on a new XML library when we already have Qt doesn't
> > seem logical.
>
> -------------------------------------------------------------------------
> I found out Amarok already is linked against Expat.
> Actually the list of programs linking against Expat is not only
> quite long but also includes many big names (like vim):
>
>   for i in /usr/bin/* ; do (ldd $i 2> /dev/null | \
>       grep expat > /dev/null) && echo $i ; done
>
> There is no problem "adding" Expat as a dependency. :-)
> -------------------------------------------------------------------------

I think this is just because of libfontconfig, which is X11-only I'd assume.

> > But you said you were willing to work on new stuff. :) A XSPF library
> > that depended on Qt 4 would be great. Our current XSPF code is a bit
> > wonky and uses the memory-intensive QDom. An QXmlStreamReader/Writer
> > implementation would be highly appreciated.
>
> -------------------------------------------------------------------------
> Expat is a streaming parser so libSpiff gives you exactly that.
>
> Yes, I offered help on a new library. But after thinking more
> about this, creating another library clearly is the wrong way:
> next week Gnome people using libxml2 will want a third libxml2-based
> libary - I hope that shows where it would lead us.

Actually libxml2 wouldn't be adding a new dependency for us since
Strigi depends on it, and KDE4 depends on Strigi.

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

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.



More information about the Amarok mailing list