annotate src/xspf/xspf.c @ 1395:761e17b23e0c

added Discovery plugin type
author Cristi Magherusan <majeru@atheme-project.org>
date Fri, 03 Aug 2007 07:21:36 +0300
parents d1c66f8ccf73
children 3b1651d37b58
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 * Audacious: A cross-platform multimedia player
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 * Copyright (c) 2006 William Pitcock, Tony Vroon, George Averill,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 * Giacomo Lozito, Derek Pomery and Yoshiki Yazawa.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 * (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 * GNU General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 #include <config.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 #include <glib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 #include <time.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 #include <unistd.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 #include <sys/types.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 #include <sys/stat.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 #include <sys/errno.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include "audacious/main.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include "audacious/util.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 #include "audacious/playlist.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 #include "audacious/playlist_container.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 #include "audacious/plugin.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include <libxml/tree.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 #include <libxml/parser.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 #include <libxml/xmlreader.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42 #include <libxml/xpath.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
43 #include <libxml/xpathInternals.h>
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
44 #include <libxml/uri.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
46 #define XSPF_ROOT_NODE_NAME "playlist"
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
47 #define XSPF_XMLNS "http://xspf.org/ns/0/"
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
48
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
49 #define TMP_BUF_LEN 128
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
50
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
51 gchar *base = NULL;
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
52
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
53 static gboolean is_uri(gchar *uri)
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
54 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
55 if(strstr(uri, "://"))
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
56 return TRUE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
57 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
58 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
59 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
60
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
61 #if 0
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
62 static gboolean is_remote(gchar *uri)
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
63 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
64 if(strstr(uri, "file://"))
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
65 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
66
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
67 if(strstr(uri, "://"))
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
68 return TRUE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
69 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
70 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
71 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
72 #endif
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
73
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 // 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
75 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
76 {
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 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
78 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
79 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
80
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
81 if(path == NULL)
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
82 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
83
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
84 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
85 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
86 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
87 }
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
88 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
89 if(cal == NULL)
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
90 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
91 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
92 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
93 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
94 xmlFree(cal);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
95 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
96 }
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
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 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
99 {
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
100 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
101 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
102 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
103 Playlist *playlist = playlist_get_active();
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 = bmp_title_input_new();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
106
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
107 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
108 tuple->mtime = -1; // mark as uninitialized.
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
109
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
110 // 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
111 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
112 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
113 && !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
114 gchar *str = (gchar *)xmlNodeGetContent(nptr);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
115 gchar *tmp = NULL;
657
f46c9abe09d4 [svn] - do not unescape streaming uri.
yaz
parents: 652
diff changeset
116
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
117 // tmp is escaped uri or a part of escaped uri.
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
118 tmp = g_strdup_printf("%s%s", base ? base : "", str);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
119 location = g_filename_from_uri(tmp, NULL, NULL);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
120 if(!location) // http:// or something.
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
121 location = g_strdup(tmp);
1211
38b9c5765929 Remove workarounds for non-VFS compliant plugins. URIs are now mandatory.
William Pitcock <nenolod@atheme-project.org>
parents: 1145
diff changeset
122
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
123 xmlFree(str); str = NULL;
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
124 g_free(tmp); 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
125 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
127 && !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
128 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
129 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
130 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
131 && !xmlStrcmp(nptr->name, (xmlChar *)"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
132 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
133 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
134 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
135 && !xmlStrcmp(nptr->name, (xmlChar *)"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
136 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
137 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
138 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
139 && !xmlStrcmp(nptr->name, (xmlChar *)"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
140 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
141 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
142 else if(nptr->type == XML_ELEMENT_NODE
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
143 && !xmlStrcmp(nptr->name, (xmlChar *)"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
144 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
145 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
146 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
147 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
149 && !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
150 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
151 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
152 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
153 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
154
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
155 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // 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
157 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // 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
159 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
160 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
161 && !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
162 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
163
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
164 rel = xmlGetProp(nptr, (xmlChar *)"rel");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
165
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
166 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
167 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
168 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
169 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
170 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
171 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
173 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
174 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
175 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
176 else if(!xmlStrcmp(rel, (xmlChar *)"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
177 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
178 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
179 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
180 else if(!xmlStrcmp(rel, (xmlChar *)"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
181 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
182 continue;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
183 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
184 else if(!xmlStrcmp(rel, (xmlChar *)"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
185 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
186 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
187 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
188 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
189 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
190 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
192 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
193 }
87
fabe64e89949 [svn] - mtime=-1 has been introduced to represent "uninitialized".
yaz
parents: 47
diff changeset
194
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
195 }
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
196
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
197 if(location) {
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
198 gchar *uri = 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
199 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
200 tuple->file_path = g_path_get_dirname(location);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
201 #ifdef DEBUG
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
202 printf("xspf: tuple->file_name = %s\n", tuple->file_name);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
203 printf("xspf: tuple->file_path = %s\n", tuple->file_path);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
204 #endif
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
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
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
207 uri = g_filename_to_uri(location, NULL, NULL);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
208 // uri would be NULL if location is already uri. --yaz
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
209 playlist_load_ins_file_tuple(playlist, uri ? uri: location, filename, pos, tuple);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
210 g_free(uri); uri = 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
211 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
212 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
213
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
214 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
215 location = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
216 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
217
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
218 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
219 {
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
220 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
221 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
222 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
223 && !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
224 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
225 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
227 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
228
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
229 static void find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos)
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
230 {
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
231 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
232 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
233
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
235 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
236 && !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
237 xmlChar *opt = NULL;
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
238
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
239 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
240 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
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 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
244 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
245 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
246 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
247 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 }
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
249 }
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
250
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
251 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
252 {
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
253 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
254 xmlNode *nptr, *nptr2;
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
255 gchar *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
256
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 g_return_if_fail(filename != NULL);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
258 #ifdef DEBUG
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
259 printf("playlist_load_xspf: filename = %s\n", filename);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
260 #endif
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
261 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
262 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
263 return;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
264
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
265 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
266 base = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
267
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
268 // 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
269 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
270 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
271 && !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
272 base = (gchar *)xmlNodeGetBase(doc, nptr);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
273 #ifdef DEBUG
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
274 printf("playlist_load_xspf: base @1 = %s\n", base);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
275 #endif
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
276 // if filename is specified as a base, ignore it.
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
277 tmp = xmlURIUnescapeString(base, -1, NULL);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
278 if(tmp) {
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
279 if(!strcmp(tmp, filename)) {
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
280 xmlFree(base);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
281 base = NULL;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
282 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
283 g_free(tmp);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
284 tmp = NULL;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
285 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
286 #ifdef DEBUG
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
287 printf("playlist_load_xspf: base @2 = %s\n", base);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
288 #endif
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
289 for(nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) {
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
290
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
291 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
292 && !xmlStrcmp(nptr2->name, (xmlChar *)"extension")) {
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
293 //check if application is audacious
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
294 xmlChar *app = NULL;
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
295 app = xmlGetProp(nptr2, (xmlChar *)"application");
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
296 if(!xmlStrcmp(app, (xmlChar *)"audacious")) {
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
297 find_audoptions(nptr2, filename, pos);
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
298 }
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
299 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
300 }
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
301
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
302 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
303 && !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
304 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
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 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
309 xmlFreeDoc(doc);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
310 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
311
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
312 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
313 {
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
314 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
315 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
316 GList *node;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
317 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
318 Playlist *playlist = playlist_get_active();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
319
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
320 #ifdef DEBUG
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
321 printf("playlist_save_xspf: filename = %s\n", filename);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
322 #endif
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
323 xmlFree(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
324 base = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
325
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
326 doc = xmlNewDoc((xmlChar *)"1.0");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
327
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
328 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
329 doc->encoding = xmlStrdup((xmlChar *)"UTF-8");
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
330
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
331 rootnode = xmlNewNode(NULL, (xmlChar *)XSPF_ROOT_NODE_NAME);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
332 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
333 xmlSetProp(rootnode, (xmlChar *)"xmlns", (xmlChar *)XSPF_XMLNS);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
334
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
335 PLAYLIST_LOCK(playlist->mutex);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
336
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
337 /* relative */
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
338 if(playlist->attribute & PLAYLIST_USE_RELATIVE) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
339 /* prescan to determine base uri */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
340 for(node = playlist->entries; node != NULL; node = g_list_next(node)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
341 gchar *ptr1, *ptr2;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
342 PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
343 gchar *tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
344 gint tmplen = 0;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
345
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
346 if(!is_uri(entry->filename)) { //obsolete
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
347 gchar *tmp2;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
348 tmp2 = g_path_get_dirname(entry->filename);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
349 tmp = g_strdup_printf("%s/", tmp2);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
350 g_free(tmp2); tmp2 = NULL;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
351 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
352 else { //uri
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
353 tmp = g_strdup(entry->filename);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
354 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
355
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
356 if(!base) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
357 base = strdup(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
358 baselen = strlen(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
359 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
360 ptr1 = base;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
361 ptr2 = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
362
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
363 while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
364 ptr1++;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
365 ptr2++;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
366 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
367 *ptr2 = '\0'; //terminate
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
368 tmplen = ptr2 - tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
369
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
370 if(tmplen <= baselen) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
371 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
372 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
373 baselen = tmplen;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
374 #ifdef DEBUG
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
375 printf("base = \"%s\" baselen = %d\n", base, baselen);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
376 #endif
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
377 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
378 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
379 g_free(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
380 tmp = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
381 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
382 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
383 /* set base URI */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
384 if(base) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
385 gchar *tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
386 if(!is_uri(base)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
387 tmp = (gchar *)audPathToURI((xmlChar *)base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
388 if(tmp) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
389 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
390 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
391 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
392 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
393
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
394 if(!is_uri(base)) {
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
395 #ifdef DEBUG
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
396 printf("base is not uri. something is wrong.\n");
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
397 #endif
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
398 tmp = g_strdup_printf("file://%s", base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
399 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
400 g_free(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
401 tmp = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
402 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
403 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
404 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
405 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
406 } /* USE_RELATIVE */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
407
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
408 /* common */
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
409 xmlDocSetRootElement(doc, rootnode);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
410
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
411 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
412 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
413 xmlAddChild(rootnode, tmp);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
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 // 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
416 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
417 xmlNodePtr extension, options;
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
418
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
419 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
420 xmlSetProp(extension, (xmlChar *)"application", (xmlChar *)"audacious");
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
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 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
423 xmlSetProp(options, (xmlChar *)"staticlist", (xmlChar *)"true");
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
424
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
425 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
426 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
427 }
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
428
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
429 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
430 xmlAddChild(rootnode, tracklist);
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 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
433 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
434 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
435 gchar *filename = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
436
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
437 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
438 location = xmlNewNode(NULL, (xmlChar *)"location");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
439
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
440 if(is_uri(entry->filename)) { /* uri */
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
441 #ifdef DEBUG
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
442 printf("filename is uri\n");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
443 #endif
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
444 filename = g_strdup(entry->filename + baselen); // entry->filename is always uri now.
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
445 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
446 else { /* local file (obsolete) */
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
447 gchar *tmp =
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
448 (gchar *)audPathToURI((const xmlChar *)entry->filename + baselen);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
449 if(base) { /* relative */
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
450 filename = g_strdup_printf("%s", tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
451 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
452 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
453 #ifdef DEBUG
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
454 printf("absolute and local (obsolete)\n");
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
455 #endif
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
456 filename = g_filename_to_uri(tmp, NULL, NULL);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
457 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
458 g_free(tmp); tmp = NULL;
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
459 } /* obsolete */
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
520
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
521 //
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
575
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
576 } /* tuple */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
577 else {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
578
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
579 if(entry->title != NULL && g_utf8_validate(entry->title, -1, NULL)) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
580 tmp = xmlNewNode(NULL, (xmlChar *)"title");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
581 xmlAddChild(tmp, xmlNewText((xmlChar *)entry->title));
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
582 xmlAddChild(track, tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
583 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
584
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
585 if(entry->length > 0) {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
586 gchar *str;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
587 str = g_malloc(TMP_BUF_LEN);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
588 tmp = xmlNewNode(NULL, (xmlChar *)"duration");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
589 sprintf(str, "%d", entry->length);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
590 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
591 g_free(str);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
592 str = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
593 xmlAddChild(track, tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
594 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
595
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
596 /* add mtime of -1 */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
597 {
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
598 gchar *str = g_malloc(TMP_BUF_LEN);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
599 tmp = xmlNewNode(NULL, (xmlChar *)"meta");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
600 xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"mtime");
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
601 sprintf(str, "%ld", -1L);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
602
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
603 xmlAddChild(tmp, xmlNewText((xmlChar *)str));
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
604 xmlAddChild(track, tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
605 g_free(str);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
606 str = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
607 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
608
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
609 } /* no tuple */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
610
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
611 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
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
619 doc = NULL;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
620
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
621 xmlFree(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
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
1395
761e17b23e0c added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 1278
diff changeset
642 DECLARE_PLUGIN(xspf, init, cleanup, NULL, NULL, NULL, NULL, NULL, NULL);