Mercurial > audlegacy-plugins
annotate src/xspf/xspf.c @ 892:d0b558bcf704 trunk
[svn] - initial support for writing relative path.
author | yaz |
---|---|
date | Thu, 22 Mar 2007 22:19:41 -0700 |
parents | 502222ed5dd4 |
children | 40c1ffbe34d0 |
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 | 44 #include <libxml/uri.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 |
641 | 46 #define XSPF_ROOT_NODE_NAME "playlist" |
47 #define XSPF_XMLNS "http://xspf.org/ns/0/" | |
47 | 48 |
49 #define TMP_BUF_LEN 128 | |
50 | |
641 | 51 gchar *base = NULL; |
52 | |
892 | 53 static gboolean is_uri(gchar *uri) |
54 { | |
55 if(strstr(uri, "://")) | |
56 return TRUE; | |
57 else | |
58 return FALSE; | |
59 } | |
60 | |
61 static gboolean is_remote(gchar *uri) | |
62 { | |
63 if(strstr(uri, "file://")) | |
64 return FALSE; | |
65 | |
66 if(strstr(uri, "://")) | |
67 return TRUE; | |
68 else | |
69 return FALSE; | |
70 } | |
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 | 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 | 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 | 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 | 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 | 114 |
892 | 115 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
|
116 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
|
117 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
119 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
|
120 } |
641 | 121 |
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
|
122 if(strstr(tmp, "file://")) { |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
123 location = g_strdup_printf("%s%s", base ? base : "", tmp + 7); |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
124 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
125 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
|
126 location = g_strdup_printf("%s%s", base ? base : "", 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
|
127 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
129 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
|
130 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
132 && !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
|
133 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
|
134 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
136 && !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
|
137 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
|
138 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
140 && !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
|
141 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
|
142 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
144 && !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
|
145 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
|
146 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
148 && !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
|
149 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
|
150 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
|
151 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
|
152 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
154 && !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
|
155 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
|
156 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
|
157 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
|
158 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 |
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
|
160 // |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // 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
|
162 // |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // 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
|
164 // |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
166 && !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
|
167 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
|
168 |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
169 rel = xmlGetProp(nptr, (xmlChar *)"rel"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 |
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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
178 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
|
179 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
|
180 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
182 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
|
183 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
|
184 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
186 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
|
187 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
|
188 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
190 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
|
191 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
|
192 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
|
193 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
|
194 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
|
195 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
197 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
|
198 } |
87
fabe64e89949
[svn] - mtime=-1 has been introduced to represent "uninitialized".
yaz
parents:
47
diff
changeset
|
199 |
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
|
200 } |
47 | 201 |
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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 // 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
|
207 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
|
208 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
|
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 |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
212 location = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 |
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
|
215 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
|
216 { |
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
|
217 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
|
218 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
|
219 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
|
220 && !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
|
221 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
|
222 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
223 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 |
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
|
226 static void find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos) |
641 | 227 { |
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
|
228 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
|
229 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
|
230 |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
232 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
|
233 && !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
|
234 xmlChar *opt = NULL; |
884 | 235 |
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
|
236 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
|
237 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
|
238 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
|
239 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
241 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
|
242 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
|
243 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
|
244 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
245 } |
641 | 246 } |
247 | |
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
|
248 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
|
249 { |
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
|
250 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
|
251 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
|
252 |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
253 g_return_if_fail(filename != NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
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
|
255 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
|
256 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
|
257 return; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 |
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
|
259 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
|
260 base = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 |
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
|
262 // 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
|
263 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
|
264 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
|
265 && !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
|
266 base = (gchar *)xmlNodeGetBase(doc, nptr); |
892 | 267 #ifdef DEBUG |
268 printf("load: base = %s\n", base); | |
269 #endif | |
270 { | |
271 gchar *tmp = xmlURIUnescapeString(base, -1, NULL); | |
272 if(tmp) { | |
273 if(strstr(tmp, "file://")) { | |
274 gchar *tmp2 = g_strdup(tmp + 7); | |
275 g_free(tmp); | |
276 tmp = tmp2; | |
277 } | |
278 g_free(base); | |
279 base = tmp; | |
280 } | |
281 } | |
282 | |
283 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
|
284 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
|
285 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
|
286 } |
641 | 287 |
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
|
288 for(nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) { |
641 | 289 |
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
|
290 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
|
291 && !xmlStrcmp(nptr2->name, (xmlChar *)"extension")) { |
641 | 292 //check if application is audacious |
293 xmlChar *app = NULL; | |
294 app = xmlGetProp(nptr2, (xmlChar *)"application"); | |
295 if(!xmlStrcmp(app, (xmlChar *)"audacious")) { | |
296 find_audoptions(nptr2, filename, pos); | |
297 } | |
298 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
|
299 } |
641 | 300 |
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
|
301 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
|
302 && !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
|
303 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
|
304 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
306 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 xmlFreeDoc(doc); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 |
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 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
|
312 { |
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
|
313 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
|
314 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
|
315 GList *node; |
892 | 316 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
|
317 Playlist *playlist = playlist_get_active(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 |
892 | 319 xmlFree(base); |
320 base = NULL; | |
321 | |
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
|
322 doc = xmlNewDoc((xmlChar *)"1.0"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 |
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
|
324 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
|
325 doc->encoding = xmlStrdup((xmlChar *)"UTF-8"); |
585
2d20bc58a290
[svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents:
577
diff
changeset
|
326 |
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
|
327 rootnode = xmlNewNode(NULL, (xmlChar *)XSPF_ROOT_NODE_NAME); |
892 | 328 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
|
329 xmlSetProp(rootnode, (xmlChar *)"xmlns", (xmlChar *)XSPF_XMLNS); |
892 | 330 |
331 PLAYLIST_LOCK(playlist->mutex); | |
332 if(playlist->attribute & PLAYLIST_USE_RELATIVE) { | |
333 /* prescan to determine base uri */ | |
334 for(node = playlist->entries; node != NULL; node = g_list_next(node)) { | |
335 gchar *ptr1, *ptr2; | |
336 PlaylistEntry *entry = PLAYLIST_ENTRY(node->data); | |
337 gchar *tmp; | |
338 gint tmplen = 0; | |
339 | |
340 if(!is_uri(entry->filename)) { | |
341 gchar *tmp2; | |
342 tmp2 = g_path_get_dirname(entry->filename); | |
343 tmp = g_strdup_printf("%s/", tmp2); | |
344 g_free(tmp2); | |
345 tmp2 = NULL; | |
346 } | |
347 else { | |
348 tmp = g_strdup(entry->filename); | |
349 } | |
350 | |
351 if(!base) { | |
352 base = strdup(tmp); | |
353 baselen = strlen(base); | |
354 } | |
355 ptr1 = base; | |
356 ptr2 = tmp; | |
357 | |
358 while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) { | |
359 ptr1++; | |
360 ptr2++; | |
361 } | |
362 *ptr2 = '\0'; //terminate | |
363 tmplen = ptr2 - tmp; | |
364 | |
365 if(tmplen <= baselen) { | |
366 g_free(base); | |
367 base = tmp; | |
368 baselen = tmplen; | |
369 #ifdef DEBUG | |
370 printf("base = \"%s\" baselen = %d\n", base, baselen); | |
371 #endif | |
372 } | |
373 else { | |
374 g_free(tmp); | |
375 tmp = NULL; | |
376 } | |
377 } | |
378 /* set base URI */ | |
379 if(base) { | |
380 gchar *tmp; | |
381 if(!is_uri(base)) { | |
382 tmp = (gchar *)audPathToURI((xmlChar *)base); | |
383 if(tmp) { | |
384 g_free(base); | |
385 base = tmp; | |
386 } | |
387 } | |
388 // xmlNodeSetBase(rootnode, base); // it blindly escapes characters. | |
389 | |
390 if(!is_uri(base)) { | |
391 tmp = g_strdup_printf("file://%s", base); | |
392 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp); | |
393 g_free(tmp); | |
394 tmp = NULL; | |
395 } | |
396 else | |
397 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)base); | |
398 } | |
399 } /* USE_RELATIVE */ | |
400 | |
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 xmlDocSetRootElement(doc, rootnode); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 |
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
|
404 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
|
405 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
|
406 xmlAddChild(rootnode, tmp); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 |
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
|
408 // 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
|
409 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
|
410 xmlNodePtr extension, options; |
884 | 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 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
|
413 xmlSetProp(extension, (xmlChar *)"application", (xmlChar *)"audacious"); |
884 | 414 |
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
|
415 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
|
416 xmlSetProp(options, (xmlChar *)"staticlist", (xmlChar *)"true"); |
884 | 417 |
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
|
418 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
|
419 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
|
420 } |
884 | 421 |
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
|
422 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
|
423 xmlAddChild(rootnode, tracklist); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 |
892 | 425 // PLAYLIST_LOCK(playlist->mutex); |
92
fadf346ddde3
[svn] - pls doesn't go along with PLAYLIST_LOCK in playlist_save().
yaz
parents:
87
diff
changeset
|
426 |
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
|
427 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
|
428 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
|
429 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
|
430 gchar *filename = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 |
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
|
432 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
|
433 location = xmlNewNode(NULL, (xmlChar *)"location"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 |
892 | 435 if(is_uri(entry->filename)) { /* remote uri */ |
436 gchar *tmp = NULL; | |
437 #ifdef DEBUG | |
438 printf("filename is uri\n"); | |
439 #endif | |
440 tmp = (gchar *)xmlURIEscape((xmlChar *)entry->filename); | |
441 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
|
442 g_free(tmp); |
892 | 443 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
|
444 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
445 else { /* local file */ |
892 | 446 gchar *tmp = |
447 (gchar *)audPathToURI((const xmlChar *)entry->filename + baselen); | |
448 if(base) { | |
449 filename = g_strdup_printf("%s", tmp); | |
450 } | |
451 else { | |
452 #ifdef DEBUG | |
453 printf("absolule, local\n"); | |
454 #endif | |
455 filename = g_strdup_printf("file://%s", tmp); | |
456 } | |
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
|
457 g_free(tmp); |
892 | 458 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
|
459 } |
585
2d20bc58a290
[svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents:
577
diff
changeset
|
460 |
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
|
461 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
|
462 continue; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 |
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
|
464 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
|
465 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
|
466 xmlAddChild(tracklist, track); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 |
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
|
468 /* 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
|
469 if(entry->tuple != NULL) { |
892 | 470 |
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
|
471 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
|
472 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
|
473 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
|
474 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
|
475 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
|
476 } |
585
2d20bc58a290
[svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents:
577
diff
changeset
|
477 |
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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 |
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
|
485 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
|
486 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
|
487 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
|
488 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
|
489 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
|
490 } |
585
2d20bc58a290
[svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents:
577
diff
changeset
|
491 |
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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 |
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
|
499 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
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 g_free(str); |
892 | 506 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
|
507 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
|
508 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 |
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
|
510 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
|
511 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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 g_free(str); |
892 | 517 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
|
518 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
|
519 } |
47 | 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 // |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // 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
|
523 // |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // 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
|
525 // |
892 | 526 |
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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 g_free(str); |
892 | 536 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
|
537 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 |
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
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 |
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
|
547 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
|
548 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
|
549 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
|
550 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
|
551 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
|
552 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
|
553 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 |
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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
562 |
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
|
563 // 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
|
564 { |
892 | 565 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
|
566 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
|
567 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
|
568 sprintf(str, "%ld", (long)entry->tuple->mtime); |
884 | 569 |
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
|
570 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
|
571 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
|
572 g_free(str); |
892 | 573 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
|
574 } |
892 | 575 |
576 } /* tuple */ | |
577 else { | |
578 | |
579 if(entry->title != NULL && g_utf8_validate(entry->title, -1, NULL)) { | |
580 tmp = xmlNewNode(NULL, (xmlChar *)"title"); | |
581 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->title)); | |
582 xmlAddChild(track, tmp); | |
583 } | |
584 | |
585 if(entry->length > 0) { | |
586 gchar *str; | |
587 str = g_malloc(TMP_BUF_LEN); | |
588 tmp = xmlNewNode(NULL, (xmlChar *)"duration"); | |
589 sprintf(str, "%d", entry->length); | |
590 xmlAddChild(tmp, xmlNewText((xmlChar *)str)); | |
591 g_free(str); | |
592 str = NULL; | |
593 xmlAddChild(track, tmp); | |
594 } | |
595 | |
596 /* add mtime of -1 */ | |
597 { | |
598 gchar *str = g_malloc(TMP_BUF_LEN); | |
599 tmp = xmlNewNode(NULL, (xmlChar *)"meta"); | |
600 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"mtime"); | |
601 sprintf(str, "%ld", -1L); | |
602 | |
603 xmlAddChild(tmp, xmlNewText((xmlChar *)str)); | |
604 xmlAddChild(track, tmp); | |
605 g_free(str); | |
606 str = NULL; | |
607 } | |
608 | |
609 } /* no tuple */ | |
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 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
|
612 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
|
613 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 |
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
|
615 PLAYLIST_UNLOCK(playlist->mutex); |
92
fadf346ddde3
[svn] - pls doesn't go along with PLAYLIST_LOCK in playlist_save().
yaz
parents:
87
diff
changeset
|
616 |
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
|
617 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
|
618 xmlFreeDoc(doc); |
892 | 619 doc = NULL; |
620 | |
621 xmlFree(base); | |
622 base = NULL; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 } |
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 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
|
626 .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
|
627 .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
|
628 .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
|
629 .plc_write = playlist_save_xspf, |
0
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 static void init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 { |
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
|
634 playlist_container_register(&plc_xspf); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 static void cleanup(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 { |
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
|
639 playlist_container_unregister(&plc_xspf); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 LowlevelPlugin llp_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
|
643 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
|
644 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
|
645 "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
|
646 init, |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
647 cleanup, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
649 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 LowlevelPlugin *get_lplugin_info(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 { |
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
|
652 return &llp_xspf; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
653 } |