aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/PlaylistFormats
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-02-09 16:19:45 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-02-09 16:19:45 +0000
commit6cc877dcc77fbc68d747acd393426fcc6379ea92 (patch)
tree40b84e984c47439bda991ff117ee8c913bbfeb96 /src/plugins/PlaylistFormats
parentfa2ef0a83b931b93fdd3cbd98bf7091a3c265ac1 (diff)
downloadqmmp-6cc877dcc77fbc68d747acd393426fcc6379ea92.tar.gz
qmmp-6cc877dcc77fbc68d747acd393426fcc6379ea92.tar.bz2
qmmp-6cc877dcc77fbc68d747acd393426fcc6379ea92.zip
fixed xspf format support (thanks to Sebastian Pipping)
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@783 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/PlaylistFormats')
-rw-r--r--src/plugins/PlaylistFormats/xspf/xspfplaylistformat.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/plugins/PlaylistFormats/xspf/xspfplaylistformat.cpp b/src/plugins/PlaylistFormats/xspf/xspfplaylistformat.cpp
index 60a1c27bd..997867caa 100644
--- a/src/plugins/PlaylistFormats/xspf/xspfplaylistformat.cpp
+++ b/src/plugins/PlaylistFormats/xspf/xspfplaylistformat.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008 by Ilya Kotov *
+ * Copyright (C) 2008-2009 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -59,7 +59,7 @@ QStringList XSPFPlaylistFormat::decode(const QString & contents)
{
QUrl url (child.firstChildElement("location").text());
if (url.scheme() == "file") //remove scheme for local files only
- out << url.toString(QUrl::RemoveScheme);
+ out << QUrl::fromPercentEncoding(url.toString(QUrl::RemoveScheme).toAscii());
else
out << url.toString();
child = child.nextSiblingElement();
@@ -75,7 +75,7 @@ QString XSPFPlaylistFormat::encode(const QList<AbstractPlaylistItem*> & files)
QDomDocument doc;
QDomElement root = doc.createElement("playlist");
root.setAttribute("version",QString("1"));
- root.setAttribute("xmlns",QString("http://xspf.org/ns/0"));
+ root.setAttribute("xmlns",QString("http://xspf.org/ns/0/"));
QDomElement creator = doc.createElement("creator");
QDomText text = doc.createTextNode("qmmp-" + QString(QMMP_STR_VERSION));
@@ -92,9 +92,10 @@ QString XSPFPlaylistFormat::encode(const QList<AbstractPlaylistItem*> & files)
QDomElement ch = doc.createElement("location");
QDomText text;
if (f->url().contains("://"))
- text = doc.createTextNode(f->url());
+ text = doc.createTextNode(QUrl::toPercentEncoding(f->url(), ":/"));
else //append protocol
- text = doc.createTextNode(QString("file://") + QFileInfo(f->url()).absoluteFilePath());
+ text = doc.createTextNode(QUrl::toPercentEncoding(QString("file://") +
+ QFileInfo(f->url()).absoluteFilePath(), ":/"));
ch.appendChild(text);
track.appendChild(ch);
@@ -103,12 +104,28 @@ QString XSPFPlaylistFormat::encode(const QList<AbstractPlaylistItem*> & files)
ch.appendChild(text);
track.appendChild(ch);
+ ch = doc.createElement("creator");
+ text = doc.createTextNode(f->artist());
+ ch.appendChild(text);
+ track.appendChild(ch);
+
+ ch = doc.createElement("annotation");
+ text = doc.createTextNode(f->comment());
+ ch.appendChild(text);
+ track.appendChild(ch);
+
+ ch = doc.createElement("album");
+ text = doc.createTextNode(f->album());
+ ch.appendChild(text);
+ track.appendChild(ch);
+
ch = doc.createElement("trackNum");
text = doc.createTextNode(QString::number(counter));
ch.appendChild(text);
track.appendChild(ch);
- ch = doc.createElement("year");
+ ch = doc.createElement("meta");
+ ch.setAttribute("rel", "year");
text = doc.createTextNode(f->year());
ch.appendChild(text);
track.appendChild(ch);