annotate src/xspf/xspf.c @ 1271:173a67e7e4f8

disable unescape local file for now.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sun, 15 Jul 2007 19:50:15 +0900
parents 38b9c5765929
children d1c66f8ccf73
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 * Audacious: A cross-platform multimedia player
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 * Copyright (c) 2006 William Pitcock, Tony Vroon, George Averill,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 * Giacomo Lozito, Derek Pomery and Yoshiki Yazawa.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 * (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 * GNU General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 #include <config.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 #include <glib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 #include <time.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 #include <unistd.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 #include <sys/types.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 #include <sys/stat.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 #include <sys/errno.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include "audacious/main.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include "audacious/util.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 #include "audacious/playlist.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 #include "audacious/playlist_container.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 #include "audacious/plugin.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include <libxml/tree.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 #include <libxml/parser.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 #include <libxml/xmlreader.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42 #include <libxml/xpath.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
43 #include <libxml/xpathInternals.h>
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
44 #include <libxml/uri.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
46 #define XSPF_ROOT_NODE_NAME "playlist"
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
47 #define XSPF_XMLNS "http://xspf.org/ns/0/"
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
48
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
49 #define TMP_BUF_LEN 128
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
50
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
51 gchar *base = NULL;
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
52
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
53 static gboolean is_uri(gchar *uri)
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
54 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
55 if(strstr(uri, "://"))
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
56 return TRUE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
57 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
58 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
59 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
60
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
61 static gboolean is_remote(gchar *uri)
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
62 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
63 if(strstr(uri, "file://"))
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
64 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
65
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
66 if(strstr(uri, "://"))
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
67 return TRUE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
68 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
69 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
70 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
71
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
72 // this function is taken from libxml2-2.6.27.
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
73 static xmlChar *audPathToURI(const xmlChar *path)
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
74 {
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
75 xmlURIPtr uri;
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
76 xmlURI temp;
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
77 xmlChar *ret, *cal;
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
78
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
79 if(path == NULL)
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
80 return NULL;
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
81
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
82 if((uri = xmlParseURI((const char *)path)) != NULL) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
83 xmlFreeURI(uri);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
84 return xmlStrdup(path);
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
85 }
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
86 cal = xmlCanonicPath(path);
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
87 if(cal == NULL)
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
88 return NULL;
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
89 memset(&temp, 0, sizeof(temp));
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
90 temp.path = (char *)cal;
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
91 ret = xmlSaveUri(&temp);
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
92 xmlFree(cal);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
93 return ret;
652
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
94 }
7f865e3cd285 [svn] - import xmlPathToURI() from libxml2-2.6.27 as audPathToURI(). this function is newly introduced at 2.6.27.
yaz
parents: 647
diff changeset
95
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
96 static void add_file(xmlNode *track, const gchar *filename, gint pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
97 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
98 xmlNode *nptr;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
99 TitleInput *tuple;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
100 gchar *location = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
101 Playlist *playlist = playlist_get_active();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
103 tuple = bmp_title_input_new();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
104
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
105 tuple->length = -1;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
106 tuple->mtime = -1; // mark as uninitialized.
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
107
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
108 // creator, album, title, duration, trackNum, annotation, image,
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
109 for(nptr = track->children; nptr != NULL; nptr = nptr->next) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
110 if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
111 && !xmlStrcmp(nptr->name, (xmlChar *)"location")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
112 gchar *str = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
113 gchar *tmp;
657
f46c9abe09d4 [svn] - do not unescape streaming uri.
yaz
parents: 652
diff changeset
114
1271
173a67e7e4f8 disable unescape local file for now.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1211
diff changeset
115 #if 0
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
116 if(!is_remote(str)) { /* local file */
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
117 tmp = (gchar *)xmlURIUnescapeString(str, -1, NULL);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
118 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
119 else { /* streaming */
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
120 tmp = g_strdup(str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
121 }
1271
173a67e7e4f8 disable unescape local file for now.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1211
diff changeset
122 #else
173a67e7e4f8 disable unescape local file for now.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1211
diff changeset
123 tmp = g_strdup(str); // XXX
173a67e7e4f8 disable unescape local file for now.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1211
diff changeset
124 #endif
1211
38b9c5765929 Remove workarounds for non-VFS compliant plugins. URIs are now mandatory.
William Pitcock <nenolod@atheme-project.org>
parents: 1145
diff changeset
125 location = g_strdup_printf("%s%s", base ? base : "", tmp);
38b9c5765929 Remove workarounds for non-VFS compliant plugins. URIs are now mandatory.
William Pitcock <nenolod@atheme-project.org>
parents: 1145
diff changeset
126
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
127 xmlFree(str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
128 g_free(tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
129 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
130 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
131 && !xmlStrcmp(nptr->name, (xmlChar *)"title")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
132 tuple->track_name = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
133 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
134 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
135 && !xmlStrcmp(nptr->name, (xmlChar *)"creator")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
136 tuple->performer = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
137 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
138 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
139 && !xmlStrcmp(nptr->name, (xmlChar *)"annotation")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
140 tuple->comment = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
141 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
142 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
143 && !xmlStrcmp(nptr->name, (xmlChar *)"album")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
144 tuple->album_name = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
145 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
146 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
147 && !xmlStrcmp(nptr->name, (xmlChar *)"trackNum")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
148 xmlChar *str = xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
149 tuple->track_number = atol((char *)str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
150 xmlFree(str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
151 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
152 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
153 && !xmlStrcmp(nptr->name, (xmlChar *)"duration")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
154 xmlChar *str = xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
155 tuple->length = atol((char *)str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
156 xmlFree(str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
157 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
158
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
159 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
160 // additional metadata
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
161 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
162 // year, date, genre, formatter, mtime
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
163 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
164 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
165 && !xmlStrcmp(nptr->name, (xmlChar *)"meta")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
166 xmlChar *rel = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
167
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
168 rel = xmlGetProp(nptr, (xmlChar *)"rel");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
169
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
170 if(!xmlStrcmp(rel, (xmlChar *)"year")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
171 xmlChar *cont = xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
172 tuple->year = atol((char *)cont);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
173 xmlFree(cont);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
174 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
175 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
176 else if(!xmlStrcmp(rel, (xmlChar *)"date")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
177 tuple->date = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
178 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
179 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
180 else if(!xmlStrcmp(rel, (xmlChar *)"genre")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
181 tuple->genre = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
182 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
183 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
184 else if(!xmlStrcmp(rel, (xmlChar *)"formatter")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
185 tuple->formatter = (gchar *)xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
186 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
187 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
188 else if(!xmlStrcmp(rel, (xmlChar *)"mtime")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
189 xmlChar *str = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
190 str = xmlNodeGetContent(nptr);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
191 tuple->mtime = (time_t) atoll((char *)str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
192 xmlFree(str);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
193 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
194 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
195 xmlFree(rel);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
196 rel = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
197 }
87
fabe64e89949 [svn] - mtime=-1 has been introduced to represent "uninitialized".
yaz
parents: 47
diff changeset
198
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
199 }
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
200
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
201 if(location) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
202 tuple->file_name = g_path_get_basename(location);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
203 tuple->file_path = g_path_get_dirname(location);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
204 tuple->file_ext = g_strdup(strrchr(location, '.'));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
205 // add file to playlist
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
206 playlist_load_ins_file_tuple(playlist, location, filename, pos, tuple);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
207 pos++;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
208 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
209
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
210 g_free(location);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
211 location = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
212 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
213
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
214 static void find_track(xmlNode *tracklist, const gchar *filename, gint pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
215 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
216 xmlNode *nptr;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
217 for(nptr = tracklist->children; nptr != NULL; nptr = nptr->next) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
218 if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
219 && !xmlStrcmp(nptr->name, (xmlChar *)"track")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
220 add_file(nptr, filename, pos);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
221 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
222 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
223 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
224
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
225 static void find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos)
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
226 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
227 xmlNode *nptr;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
228 Playlist *playlist = playlist_get_active();
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
229
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
230 for(nptr = tracklist->children; nptr != NULL; nptr = nptr->next) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
231 if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
232 && !xmlStrcmp(nptr->name, (xmlChar *)"options")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
233 xmlChar *opt = NULL;
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
234
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
235 opt = xmlGetProp(nptr, (xmlChar *)"staticlist");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
236 if(!strcasecmp((char *)opt, "true")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
237 playlist->attribute |= PLAYLIST_STATIC;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
238 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
239 else
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
240 playlist->attribute ^= PLAYLIST_STATIC;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
241 xmlFree(opt);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
242 opt = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
243 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
244 }
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
245 }
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
246
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
247 static void playlist_load_xspf(const gchar *filename, gint pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
248 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
249 xmlDocPtr doc;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
250 xmlNode *nptr, *nptr2;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
251
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
252 g_return_if_fail(filename != NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
253
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
254 doc = xmlParseFile(filename);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
255 if(doc == NULL)
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
256 return;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
257
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
258 xmlFree(base);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
259 base = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
260
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
261 // find trackList
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
262 for(nptr = doc->children; nptr != NULL; nptr = nptr->next) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
263 if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
264 && !xmlStrcmp(nptr->name, (xmlChar *)"playlist")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
265 base = (gchar *)xmlNodeGetBase(doc, nptr);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
266 #ifdef DEBUG
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
267 printf("load: base = %s\n", base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
268 #endif
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
269 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
270 gchar *tmp = xmlURIUnescapeString(base, -1, NULL);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
271 if(tmp) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
272 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
273 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
274 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
275 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
276
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
277 if(!strcmp(base, filename)) { // filename is specified as a base URI. ignore.
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
278 xmlFree(base);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
279 base = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
280 }
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
281
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
282 for(nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) {
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
283
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
284 if(nptr2->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
285 && !xmlStrcmp(nptr2->name, (xmlChar *)"extension")) {
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
286 //check if application is audacious
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
287 xmlChar *app = NULL;
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
288 app = xmlGetProp(nptr2, (xmlChar *)"application");
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
289 if(!xmlStrcmp(app, (xmlChar *)"audacious")) {
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
290 find_audoptions(nptr2, filename, pos);
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
291 }
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
292 xmlFree(app);
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
293 }
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
294
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
295 if(nptr2->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
296 && !xmlStrcmp(nptr2->name, (xmlChar *)"trackList")) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
297 find_track(nptr2, filename, pos);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
298 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
299 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
300 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
301 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
302 xmlFreeDoc(doc);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
303 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
304
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
305 static void playlist_save_xspf(const gchar *filename, gint pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
306 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
307 xmlDocPtr doc;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
308 xmlNodePtr rootnode, tmp, tracklist;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
309 GList *node;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
310 gint baselen = 0;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
311 Playlist *playlist = playlist_get_active();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
312
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
313 xmlFree(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
314 base = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
315
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
316 doc = xmlNewDoc((xmlChar *)"1.0");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
317
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
318 doc->charset = XML_CHAR_ENCODING_UTF8;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
319 doc->encoding = xmlStrdup((xmlChar *)"UTF-8");
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
320
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
321 rootnode = xmlNewNode(NULL, (xmlChar *)XSPF_ROOT_NODE_NAME);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
322 xmlSetProp(rootnode, (xmlChar *)"version", (xmlChar *)"1");
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
323 xmlSetProp(rootnode, (xmlChar *)"xmlns", (xmlChar *)XSPF_XMLNS);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
324
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
325 PLAYLIST_LOCK(playlist->mutex);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
326 if(playlist->attribute & PLAYLIST_USE_RELATIVE) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
327 /* prescan to determine base uri */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
328 for(node = playlist->entries; node != NULL; node = g_list_next(node)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
329 gchar *ptr1, *ptr2;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
330 PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
331 gchar *tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
332 gint tmplen = 0;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
333
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
334 if(!is_uri(entry->filename)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
335 gchar *tmp2;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
336 tmp2 = g_path_get_dirname(entry->filename);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
337 tmp = g_strdup_printf("%s/", tmp2);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
338 g_free(tmp2);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
339 tmp2 = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
340 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
341 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
342 tmp = g_strdup(entry->filename);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
343 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
344
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
345 if(!base) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
346 base = strdup(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
347 baselen = strlen(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
348 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
349 ptr1 = base;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
350 ptr2 = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
351
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
352 while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
353 ptr1++;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
354 ptr2++;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
355 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
356 *ptr2 = '\0'; //terminate
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
357 tmplen = ptr2 - tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
358
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
359 if(tmplen <= baselen) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
360 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
361 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
362 baselen = tmplen;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
363 #ifdef DEBUG
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
364 printf("base = \"%s\" baselen = %d\n", base, baselen);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
365 #endif
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
366 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
367 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
368 g_free(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
369 tmp = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
370 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
371 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
372 /* set base URI */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
373 if(base) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
374 gchar *tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
375 if(!is_uri(base)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
376 tmp = (gchar *)audPathToURI((xmlChar *)base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
377 if(tmp) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
378 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
379 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
380 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
381 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
382 // xmlNodeSetBase(rootnode, base); // it blindly escapes characters.
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
383
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
384 if(!is_uri(base)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
385 tmp = g_strdup_printf("file://%s", base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
386 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
387 g_free(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
388 tmp = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
389 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
390 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
391 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
392 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
393 } /* USE_RELATIVE */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
394
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
395
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
396 xmlDocSetRootElement(doc, rootnode);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
397
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
398 tmp = xmlNewNode(NULL, (xmlChar *)"creator");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
399 xmlAddChild(tmp, xmlNewText((xmlChar *)PACKAGE "-" VERSION));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
400 xmlAddChild(rootnode, tmp);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
401
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
402 // add staticlist marker
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
403 if(playlist->attribute & PLAYLIST_STATIC) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
404 xmlNodePtr extension, options;
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
405
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
406 extension = xmlNewNode(NULL, (xmlChar *)"extension");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
407 xmlSetProp(extension, (xmlChar *)"application", (xmlChar *)"audacious");
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
408
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
409 options = xmlNewNode(NULL, (xmlChar *)"options");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
410 xmlSetProp(options, (xmlChar *)"staticlist", (xmlChar *)"true");
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
411
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
412 xmlAddChild(extension, options);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
413 xmlAddChild(rootnode, extension);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
414 }
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
415
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
416 tracklist = xmlNewNode(NULL, (xmlChar *)"trackList");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
417 xmlAddChild(rootnode, tracklist);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
418
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
419 // PLAYLIST_LOCK(playlist->mutex);
92
fadf346ddde3 [svn] - pls doesn't go along with PLAYLIST_LOCK in playlist_save().
yaz
parents: 87
diff changeset
420
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
421 for(node = playlist->entries; node != NULL; node = g_list_next(node)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
422 PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
423 xmlNodePtr track, location;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
424 gchar *filename = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
425
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
426 track = xmlNewNode(NULL, (xmlChar *)"track");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
427 location = xmlNewNode(NULL, (xmlChar *)"location");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
428
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
429 if(is_uri(entry->filename)) { /* remote uri */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
430 gchar *tmp = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
431 #ifdef DEBUG
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
432 printf("filename is uri\n");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
433 #endif
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
434 tmp = (gchar *)xmlURIEscape((xmlChar *)entry->filename);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
435 filename = g_strdup(entry->filename + baselen);
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
436 g_free(tmp);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
437 tmp = NULL;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
438 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
439 else { /* local file */
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
440 gchar *tmp =
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
441 (gchar *)audPathToURI((const xmlChar *)entry->filename + baselen);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
442 if(base) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
443 filename = g_strdup_printf("%s", tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
444 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
445 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
446 #ifdef DEBUG
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
447 printf("absolule, local\n");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
448 #endif
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
449 filename = g_strdup_printf("file://%s", tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
450 }
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
451 g_free(tmp);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
452 tmp = NULL;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
453 }
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
454
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
455 if(!g_utf8_validate(filename, -1, NULL))
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
456 continue;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
457
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
458 xmlAddChild(location, xmlNewText((xmlChar *)filename));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
459 xmlAddChild(track, location);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
460 xmlAddChild(tracklist, track);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
461
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
462 /* do we have a tuple? */
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
463 if(entry->tuple != NULL) {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
464
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
465 if(entry->tuple->track_name != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
466 g_utf8_validate(entry->tuple->track_name, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
467 tmp = xmlNewNode(NULL, (xmlChar *)"title");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
468 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->track_name));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
469 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
470 }
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
471
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
472 if(entry->tuple->performer != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
473 g_utf8_validate(entry->tuple->performer, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
474 tmp = xmlNewNode(NULL, (xmlChar *)"creator");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
475 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->performer));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
476 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
477 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
478
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
479 if(entry->tuple->comment != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
480 g_utf8_validate(entry->tuple->comment, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
481 tmp = xmlNewNode(NULL, (xmlChar *)"annotation");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
482 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->comment));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
483 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
484 }
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
485
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
486 if(entry->tuple->album_name != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
487 g_utf8_validate(entry->tuple->album_name, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
488 tmp = xmlNewNode(NULL, (xmlChar *)"album");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
489 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->album_name));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
490 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
491 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
492
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
493 if(entry->tuple->track_number != 0) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
494 gchar *str;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
495 str = g_malloc(TMP_BUF_LEN);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
496 tmp = xmlNewNode(NULL, (xmlChar *)"trackNum");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
497 sprintf(str, "%d", entry->tuple->track_number);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
498 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
499 g_free(str);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
500 str = NULL;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
501 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
502 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
503
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
504 if(entry->tuple->length > 0) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
505 gchar *str;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
506 str = g_malloc(TMP_BUF_LEN);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
507 tmp = xmlNewNode(NULL, (xmlChar *)"duration");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
508 sprintf(str, "%d", entry->tuple->length);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
509 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
510 g_free(str);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
511 str = NULL;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
512 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
513 }
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
514
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
515 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
516 // additional metadata
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
517 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
518 // year, date, genre, formatter, mtime
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
519 //
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
520
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
521 if(entry->tuple->year != 0) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
522 gchar *str;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
523 str = g_malloc(TMP_BUF_LEN);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
524 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
525 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"year");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
526 sprintf(str, "%d", entry->tuple->year);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
527 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
528 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
529 g_free(str);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
530 str = NULL;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
531 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
532
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
533 if(entry->tuple->date != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
534 g_utf8_validate(entry->tuple->date, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
535 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
536 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"date");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
537 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->date));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
538 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
539 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
540
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
541 if(entry->tuple->genre != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
542 g_utf8_validate(entry->tuple->genre, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
543 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
544 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"genre");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
545 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->genre));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
546 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
547 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
548
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
549 if(entry->tuple->formatter != NULL &&
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
550 g_utf8_validate(entry->tuple->formatter, -1, NULL)) {
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
551 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
552 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"formatter");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
553 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->tuple->formatter));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
554 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
555 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
556
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
557 // mtime: write mtime unconditionally to support staticlist.
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
558 {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
559 gchar *str = g_malloc(TMP_BUF_LEN);
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
560 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
561 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"mtime");
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
562 sprintf(str, "%ld", (long)entry->tuple->mtime);
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
563
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
564 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
565 xmlAddChild(track, tmp);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
566 g_free(str);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
567 str = NULL;
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
568 }
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
569
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
570 } /* tuple */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
571 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
572
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
573 if(entry->title != NULL && g_utf8_validate(entry->title, -1, NULL)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
574 tmp = xmlNewNode(NULL, (xmlChar *)"title");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
575 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->title));
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
576 xmlAddChild(track, tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
577 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
578
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
579 if(entry->length > 0) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
580 gchar *str;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
581 str = g_malloc(TMP_BUF_LEN);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
582 tmp = xmlNewNode(NULL, (xmlChar *)"duration");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
583 sprintf(str, "%d", entry->length);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
584 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
585 g_free(str);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
586 str = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
587 xmlAddChild(track, tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
588 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
589
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
590 /* add mtime of -1 */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
591 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
592 gchar *str = g_malloc(TMP_BUF_LEN);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
593 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
594 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"mtime");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
595 sprintf(str, "%ld", -1L);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
596
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
597 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
598 xmlAddChild(track, tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
599 g_free(str);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
600 str = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
601 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
602
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
603 } /* no tuple */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
604
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
605 g_free(filename);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
606 filename = NULL;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
607 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
608
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
609 PLAYLIST_UNLOCK(playlist->mutex);
92
fadf346ddde3 [svn] - pls doesn't go along with PLAYLIST_LOCK in playlist_save().
yaz
parents: 87
diff changeset
610
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
611 xmlSaveFormatFile(filename, doc, 1);
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
612 xmlFreeDoc(doc);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
613 doc = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
614
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
615 xmlFree(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
616 base = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
617 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
618
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
619 PlaylistContainer plc_xspf = {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
620 .name = "XSPF Playlist Format",
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
621 .ext = "xspf",
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
622 .plc_read = playlist_load_xspf,
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
623 .plc_write = playlist_save_xspf,
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
624 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
625
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
626 static void init(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
627 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
628 playlist_container_register(&plc_xspf);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
629 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
630
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
631 static void cleanup(void)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
632 {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
633 playlist_container_unregister(&plc_xspf);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
634 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
635
1145
40c1ffbe34d0 [svn] - xspf, m3u, pls: convert to plugin2 architecture
nenolod
parents: 892
diff changeset
636 DECLARE_PLUGIN(xspf, init, cleanup, NULL, NULL, NULL, NULL, NULL);