annotate src/xspf/xspf.c @ 2576:bd3a24b39058

Removed #includes that should not be included anymore.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 May 2008 04:20:50 +0300
parents 42a5c9d5830b
children 3f931f933750
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,
1667
7c32522b05b8 Add myself into credits.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
4 * Giacomo Lozito, Derek Pomery, Yoshiki Yazawa
7c32522b05b8 Add myself into credits.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
5 * and Matti Hämäläinen.
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * 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
8 * 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
9 * 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
10 * (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * 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
13 * 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
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 * 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
18 * 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
19 * 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
20 */
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
21
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
22 /* #define AUD_DEBUG 1 */
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
23
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 #include <config.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 #include <glib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 #include <time.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 #include <unistd.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 #include <sys/types.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include <sys/stat.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include <sys/errno.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
36 #include <audacious/plugin.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 #include <libxml/tree.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include <libxml/parser.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 #include <libxml/xmlreader.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 #include <libxml/xpath.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42 #include <libxml/xpathInternals.h>
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
43 #include <libxml/uri.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
45 #define XSPF_ROOT_NODE_NAME "playlist"
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
46 #define XSPF_XMLNS "http://xspf.org/ns/0/"
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
47
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
48 enum {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
49 CMP_DEF = 0,
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
50 CMP_GT,
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
51 CMP_NULL
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
52 } xspf_compare;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
53
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
54 typedef struct {
1693
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
55 gint tupleField;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
56 gchar *xspfName;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
57 TupleValueType type;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
58 gboolean isMeta;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
59 gint compare;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
60 } xspf_entry_t;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
61
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
62
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
63 static const xspf_entry_t xspf_entries[] = {
1693
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
64 { FIELD_TITLE, "title", TUPLE_STRING, FALSE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
65 { FIELD_ARTIST, "creator", TUPLE_STRING, FALSE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
66 { FIELD_COMMENT, "annotation", TUPLE_STRING, FALSE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
67 { FIELD_ALBUM, "album", TUPLE_STRING, FALSE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
68 { FIELD_TRACK_NUMBER, "trackNum", TUPLE_INT, FALSE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
69 { FIELD_LENGTH, "duration", TUPLE_INT, FALSE, CMP_GT },
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
70
1693
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
71 { FIELD_YEAR, "year", TUPLE_INT, TRUE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
72 { FIELD_DATE, "date", TUPLE_STRING, TRUE, CMP_DEF },
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
73 { FIELD_GENRE, "genre", TUPLE_STRING, TRUE, CMP_DEF },
2234
ef61e0c66000 xspf had not read mtime from some time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2213
diff changeset
74 { FIELD_MTIME, "mtime", TUPLE_INT, TRUE, CMP_DEF },
1693
62e89e392227 Branch merge.
Matti Hamalainen <ccr@tnsp.org>
parents: 1687 1669
diff changeset
75 { FIELD_FORMATTER, "formatter", TUPLE_STRING, TRUE, CMP_DEF },
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
76 };
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
77
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
78 static const gint xspf_nentries = (sizeof(xspf_entries) / sizeof(xspf_entry_t));
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
79
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
80 static gboolean is_uri(gchar *uri)
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
81 {
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
82 if (strstr(uri, "://"))
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
83 return TRUE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
84 else
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
85 return FALSE;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
86 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
87
1963
b9b62802b072 Define a preprocessor macro XSDEBUG() for printing debugging messages, if DEBUG is defined.
Matti Hamalainen <ccr@tnsp.org>
parents: 1962
diff changeset
88
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
89 /* This function is taken from libxml2-2.6.27.
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
90 */
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
91 static xmlChar *xspf_path_to_uri(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
92 {
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 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
94 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
95 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
96
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
97 if (path == NULL)
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
98 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
99
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
100 if ((uri = xmlParseURI((const char *)path)) != 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
101 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
102 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
103 }
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
104
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
105 cal = xmlCanonicPath(path);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
106 if (cal == NULL)
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
107 return NULL;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
108
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
109 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
110 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
111 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
112 xmlFree(cal);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
113
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
114 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
115 }
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
116
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
117
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
118 static void xspf_add_file(xmlNode *track, const gchar *filename,
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
119 gint pos, const gchar *base)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 {
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
121 xmlNode *nptr;
1444
3b1651d37b58 xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents: 1395
diff changeset
122 Tuple *tuple;
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
123 gchar *location = NULL;
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2053
diff changeset
124 Playlist *playlist = aud_playlist_get_active();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
126
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
127 tuple = aud_tuple_new();
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
128 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1);
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
129 aud_tuple_associate_int(tuple, FIELD_MTIME, NULL, -1);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
130
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
131
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
132 for (nptr = track->children; nptr != NULL; nptr = nptr->next) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
133 if (nptr->type == XML_ELEMENT_NODE) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
134 if (!xmlStrcmp(nptr->name, (xmlChar *)"location")) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
135 /* Location is a special case */
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
136 gchar *str = (gchar *)xmlNodeGetContent(nptr);
657
f46c9abe09d4 [svn] - do not unescape streaming uri.
yaz
parents: 652
diff changeset
137
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
138 location = g_strdup_printf("%s%s", base ? base : "", str);
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
139 xmlFree(str);
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
140 } else {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
141 /* Rest of the nodes are handled here */
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
142 gint i;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
143 gboolean isMeta;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
144 xmlChar *findName;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
145
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
146 if (!xmlStrcmp(nptr->name, (xmlChar *)"meta")) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
147 isMeta = TRUE;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
148 findName = xmlGetProp(nptr, (xmlChar *)"rel");
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
149 } else {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
150 isMeta = FALSE;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
151 findName = xmlStrdup(nptr->name);
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
152 }
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
153
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
154 for (i = 0; i < xspf_nentries; i++)
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
155 if ((xspf_entries[i].isMeta == isMeta) &&
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
156 !xmlStrcmp(findName, (xmlChar *)xspf_entries[i].xspfName)) {
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
157 xmlChar *str = xmlNodeGetContent(nptr);
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
158 switch (xspf_entries[i].type) {
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
159 case TUPLE_STRING:
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
160 aud_tuple_associate_string(tuple, xspf_entries[i].tupleField, NULL, (gchar *)str);
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
161 break;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
162
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
163 case TUPLE_INT:
2234
ef61e0c66000 xspf had not read mtime from some time.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2213
diff changeset
164 AUDDBG("field=%s val=%s\n", xspf_entries[i].xspfName, str);
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
165 aud_tuple_associate_int(tuple, xspf_entries[i].tupleField, NULL, atol((char *)str));
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
166 break;
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
167
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
168 default:
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
169 break;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
170 }
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
171 xmlFree(str);
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
172 break;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
173 }
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
174
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
175 xmlFree(findName);
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
176 }
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
177 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 }
47
85d7e55b29d2 [svn] - redundant metadata has been removed.
yaz
parents: 12
diff changeset
179
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
180 if (location) {
2243
58b89671b395 make use of aud_uri_to_display_*()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2234
diff changeset
181 gchar *scratch = NULL;
1444
3b1651d37b58 xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents: 1395
diff changeset
182
2166
9fa5a7884514 unescape uri before write into tuple.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2126
diff changeset
183 /* filename and path in tuple must be unescaped. */
2243
58b89671b395 make use of aud_uri_to_display_*()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2234
diff changeset
184 scratch = aud_uri_to_display_basename(location);
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
185 aud_tuple_associate_string(tuple, FIELD_FILE_NAME, NULL, scratch);
1444
3b1651d37b58 xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents: 1395
diff changeset
186 g_free(scratch);
3b1651d37b58 xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents: 1395
diff changeset
187
2243
58b89671b395 make use of aud_uri_to_display_*()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2234
diff changeset
188 scratch = aud_uri_to_display_dirname(location);
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
189 aud_tuple_associate_string(tuple, FIELD_FILE_PATH, NULL, scratch);
1444
3b1651d37b58 xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents: 1395
diff changeset
190 g_free(scratch);
3b1651d37b58 xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents: 1395
diff changeset
191
2243
58b89671b395 make use of aud_uri_to_display_*()
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2234
diff changeset
192 aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, strrchr(location, '.'));
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
193
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
194 AUDDBG("tuple->file_name = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
195 AUDDBG("tuple->file_path = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL));
1963
b9b62802b072 Define a preprocessor macro XSDEBUG() for printing debugging messages, if DEBUG is defined.
Matti Hamalainen <ccr@tnsp.org>
parents: 1962
diff changeset
196
2166
9fa5a7884514 unescape uri before write into tuple.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2126
diff changeset
197 /* add file to playlist */
2170
02cfac0efbdc remove unnecessary code. (I can't recall why I used "uri", actually.)
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2169
diff changeset
198 aud_playlist_load_ins_file_tuple(playlist, location, filename, pos, tuple);
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 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
200 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
201
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
202 g_free(location);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
203 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
205
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
206 static void xspf_find_track(xmlNode *tracklist, const gchar *filename,
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
207 gint pos, const gchar *base)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
208 {
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
209 xmlNode *nptr;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
210
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
211 for (nptr = tracklist->children; nptr != NULL; nptr = nptr->next) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
212 if (nptr->type == XML_ELEMENT_NODE &&
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
213 !xmlStrcmp(nptr->name, (xmlChar *)"track")) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
214 xspf_add_file(nptr, filename, pos, base);
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
215 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
216 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
217 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
218
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
219
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
220 static void xspf_find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos)
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
221 {
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
222 xmlNode *nptr;
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2053
diff changeset
223 Playlist *playlist = aud_playlist_get_active();
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
224
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
225 for (nptr = tracklist->children; nptr != NULL; nptr = nptr->next) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
226 if (nptr->type == XML_ELEMENT_NODE &&
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
227 !xmlStrcmp(nptr->name, (xmlChar *)"options")) {
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
228 xmlChar *opt = NULL;
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
229
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
230 opt = xmlGetProp(nptr, (xmlChar *)"staticlist");
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
231 if (!g_strcasecmp((char *)opt, "true"))
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
232 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
233 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
234 playlist->attribute ^= PLAYLIST_STATIC;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
235
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
236 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
237 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
238 }
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
239 }
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
240
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
241
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
242 static void xspf_playlist_load(const gchar *filename, gint pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
243 {
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
244 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
245 xmlNode *nptr, *nptr2;
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
246
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 g_return_if_fail(filename != NULL);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
248
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
249 AUDDBG("filename='%s', pos=%d\n", filename, pos);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
250
1512
7b1b24af319f now xspf plugin try to load non well formed xspf file. closes #969.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1462
diff changeset
251 doc = xmlRecoverFile(filename);
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
252 if (doc == 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
253 return;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
254
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
255 // find trackList
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
256 for (nptr = doc->children; nptr != NULL; nptr = nptr->next) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
257 if (nptr->type == XML_ELEMENT_NODE &&
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
258 !xmlStrcmp(nptr->name, (xmlChar *)"playlist")) {
1965
41d726acb915 Remove useless NULL assignations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1964
diff changeset
259 gchar *tmp, *base;
41d726acb915 Remove useless NULL assignations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1964
diff changeset
260
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
261 base = (gchar *)xmlNodeGetBase(doc, nptr);
1963
b9b62802b072 Define a preprocessor macro XSDEBUG() for printing debugging messages, if DEBUG is defined.
Matti Hamalainen <ccr@tnsp.org>
parents: 1962
diff changeset
262
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
263 AUDDBG("base = %s\n", base);
1963
b9b62802b072 Define a preprocessor macro XSDEBUG() for printing debugging messages, if DEBUG is defined.
Matti Hamalainen <ccr@tnsp.org>
parents: 1962
diff changeset
264
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
265 // 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
266 tmp = xmlURIUnescapeString(base, -1, NULL);
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
267 if (tmp) {
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
268 if (!strcmp(tmp, filename)) {
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
269 xmlFree(base);
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
270 base = NULL;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
271 }
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
272 g_free(tmp);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
273 }
1963
b9b62802b072 Define a preprocessor macro XSDEBUG() for printing debugging messages, if DEBUG is defined.
Matti Hamalainen <ccr@tnsp.org>
parents: 1962
diff changeset
274
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
275 AUDDBG("base = %s\n", base);
1963
b9b62802b072 Define a preprocessor macro XSDEBUG() for printing debugging messages, if DEBUG is defined.
Matti Hamalainen <ccr@tnsp.org>
parents: 1962
diff changeset
276
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
277 for (nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) {
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
278
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
279 if (nptr2->type == XML_ELEMENT_NODE &&
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
280 !xmlStrcmp(nptr2->name, (xmlChar *)"extension")) {
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
281 //check if application is audacious
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
282 xmlChar *app = NULL;
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
283 app = xmlGetProp(nptr2, (xmlChar *)"application");
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
284 if (!xmlStrcmp(app, (xmlChar *)"audacious"))
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
285 xspf_find_audoptions(nptr2, filename, pos);
641
3f0a3c24f2b9 [svn] libxspf improvements:
yaz
parents: 585
diff changeset
286 xmlFree(app);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
287 } else
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
288 if (nptr2->type == XML_ELEMENT_NODE &&
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
289 !xmlStrcmp(nptr2->name, (xmlChar *)"title")) {
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2053
diff changeset
290 Playlist *plist = aud_playlist_get_active();
1528
8fddba1d94e4 xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 1514
diff changeset
291 xmlChar *title = xmlNodeGetContent(nptr2);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
292
1528
8fddba1d94e4 xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 1514
diff changeset
293 if (title && *title) {
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2053
diff changeset
294 aud_playlist_set_current_name(plist, (gchar*)title);
1528
8fddba1d94e4 xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 1514
diff changeset
295 }
8fddba1d94e4 xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 1514
diff changeset
296 xmlFree(title);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
297 } else
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
298 if (nptr2->type == XML_ELEMENT_NODE &&
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
299 !xmlStrcmp(nptr2->name, (xmlChar *)"trackList")) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
300 xspf_find_track(nptr2, filename, pos, base);
891
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
301 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
304 }
502222ed5dd4 [svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents: 884
diff changeset
305 xmlFreeDoc(doc);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
306 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
307
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
308
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
309 static void xspf_add_node(xmlNodePtr node, TupleValueType type,
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
310 gboolean isMeta, const gchar *xspfName, const gchar *strVal,
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
311 const gint intVal)
1668
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
312 {
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
313 gchar tmps[64];
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
314 xmlNodePtr tmp;
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
315
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
316 if (isMeta) {
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
317 tmp = xmlNewNode(NULL, (xmlChar *) "meta");
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
318 xmlSetProp(tmp, (xmlChar *) "rel", (xmlChar *) xspfName);
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
319 } else
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
320 tmp = xmlNewNode(NULL, (xmlChar *) xspfName);
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
321
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
322 switch (type) {
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
323 case TUPLE_STRING:
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
324 xmlAddChild(tmp, xmlNewText((xmlChar *) strVal));
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
325 break;
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
326
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
327 case TUPLE_INT:
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
328 g_snprintf(tmps, sizeof(tmps), "%d", intVal);
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
329 xmlAddChild(tmp, xmlNewText((xmlChar *) tmps));
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
330 break;
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
331
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
332 default:
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
333 break;
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
334 }
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
335
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
336 xmlAddChild(node, tmp);
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
337 }
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
338
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
339
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
340 static void xspf_playlist_save(const gchar *filename, gint pos)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
341 {
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
342 xmlDocPtr doc;
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
343 xmlNodePtr rootnode, tracklist;
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
344 GList *node;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
345 gint baselen = 0;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
346 gchar *base = NULL;
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2053
diff changeset
347 Playlist *playlist = aud_playlist_get_active();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
348
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
349 AUDDBG("filename='%s', pos=%d\n", filename, pos);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
350
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
351 doc = xmlNewDoc((xmlChar *)"1.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
352 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
353 doc->encoding = xmlStrdup((xmlChar *)"UTF-8");
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
354
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
355 rootnode = xmlNewNode(NULL, (xmlChar *)XSPF_ROOT_NODE_NAME);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
356 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
357 xmlSetProp(rootnode, (xmlChar *)"xmlns", (xmlChar *)XSPF_XMLNS);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
358
1675
ae9b0327b620 Fix plugins to conform with PLAYLIST_{UN}LOCK() change.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
359 PLAYLIST_LOCK(playlist);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
360
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
361 /* relative */
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
362 if (playlist->attribute & PLAYLIST_USE_RELATIVE) {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
363 /* prescan to determine base uri */
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
364 for (node = playlist->entries; node != NULL; node = g_list_next(node)) {
2455
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
365 gchar *ptr1, *ptr2, *ptrslash;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
366 PlaylistEntry *entry = PLAYLIST_ENTRY(node->data);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
367 gchar *tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
368 gint tmplen = 0;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
369
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
370 if (!is_uri(entry->filename)) { //obsolete
1966
f85a079573c3 More slight cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1965
diff changeset
371 gchar *tmp2 = g_path_get_dirname(entry->filename);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
372 tmp = g_strdup_printf("%s/", tmp2);
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
373 g_free(tmp2);
1966
f85a079573c3 More slight cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1965
diff changeset
374 } else
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
375 tmp = g_strdup(entry->filename);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
376
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
377 if (!base) {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
378 base = strdup(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
379 baselen = strlen(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
380 }
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
381
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
382 ptr1 = base;
2455
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
383 ptrslash = ptr2 = tmp;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
384
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
385 while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) {
2455
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
386 if (*ptr2 == '/') ptrslash = ptr2 + 1;
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
387
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
388 ptr1++;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
389 ptr2++;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
390 }
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
391
2455
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
392 if (!(*ptrslash)) ptrslash--;
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
393 *ptrslash = '\0'; //terminate
50ae65a59351 patch by chrome
mf0102 <0102@gmx.at>
parents: 2243
diff changeset
394 tmplen = ptrslash - tmp;
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
395
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
396 if (tmplen <= baselen) {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
397 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
398 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
399 baselen = tmplen;
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
400 AUDDBG("base='%s', baselen=%d\n", base, baselen);
1966
f85a079573c3 More slight cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1965
diff changeset
401 } else
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
402 g_free(tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
403 }
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
404
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
405 /* set base URI */
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
406 if (base) {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
407 gchar *tmp;
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
408 if (!is_uri(base)) {
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
409 tmp = (gchar *) xspf_path_to_uri((xmlChar *)base);
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
410 if (tmp) {
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
411 g_free(base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
412 base = tmp;
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
413 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
414 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
415
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
416 if (!is_uri(base)) {
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
417 AUDDBG("base is not uri. something is wrong.\n");
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
418 tmp = g_strdup_printf("file://%s", base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
419 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
420 g_free(tmp);
1966
f85a079573c3 More slight cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1965
diff changeset
421 } else
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
422 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)base);
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
423 }
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
424 } /* USE_RELATIVE */
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
425
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
426 /* 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
427 xmlDocSetRootElement(doc, rootnode);
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
428 xspf_add_node(rootnode, TUPLE_STRING, FALSE, "creator", PACKAGE "-" VERSION, 0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
429
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
430 /* add staticlist marker */
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
431 if (playlist->attribute & PLAYLIST_STATIC) {
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 xmlNodePtr extension, options;
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
433
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
434 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
435 xmlSetProp(extension, (xmlChar *)"application", (xmlChar *)"audacious");
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
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 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
438 xmlSetProp(options, (xmlChar *)"staticlist", (xmlChar *)"true");
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
439
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
440 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
441 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
442 }
884
4fd90f2d1832 [svn] improve support for static playlist:
yaz
parents: 657
diff changeset
443
1531
10cfa5b51bce xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 1528
diff changeset
444 /* save playlist title */
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
445 if (playlist->title && playlist->title[0] &&
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
446 g_utf8_validate(playlist->title, -1, NULL))
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
447 xspf_add_node(rootnode, TUPLE_STRING, FALSE, "title", playlist->title, 0);
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
448
1531
10cfa5b51bce xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 1528
diff changeset
449
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
450 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
451 xmlAddChild(rootnode, tracklist);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
452
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
453 for (node = playlist->entries; node != NULL; node = g_list_next(node)) {
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
454 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
455 xmlNodePtr track, location;
1668
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
456 gchar *filename = NULL;
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
457 const gchar *scratch = NULL;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
458 gint scratchi = 0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
459
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
460 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
461 location = xmlNewNode(NULL, (xmlChar *)"location");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
462
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
463 if (is_uri(entry->filename)) { /* uri */
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
464 AUDDBG("filename is uri\n");
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
465 filename = g_strdup(entry->filename + baselen); // entry->filename is always uri now.
1966
f85a079573c3 More slight cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1965
diff changeset
466 } else { /* local file (obsolete) */
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
467 gchar *tmp = (gchar *) xspf_path_to_uri((const xmlChar *)entry->filename + baselen);
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
468 if (base) { /* relative */
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
469 filename = g_strdup_printf("%s", tmp);
1546
a8436c6e3753 Some cleanups; Removed useless heap allocations, use a small static buffer
Matti Hamalainen <ccr@tnsp.org>
parents: 1531
diff changeset
470 } else {
2213
137187e7a379 make use of AUDDBG() for debug print out.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2170
diff changeset
471 AUDDBG("absolute and local (obsolete)\n");
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
472 filename = g_filename_to_uri(tmp, NULL, NULL);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
473 }
1965
41d726acb915 Remove useless NULL assignations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1964
diff changeset
474 g_free(tmp);
1278
d1c66f8ccf73 adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1271
diff changeset
475 } /* obsolete */
585
2d20bc58a290 [svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents: 577
diff changeset
476
1964
375950feec51 Cosmetic whitespace changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1963
diff changeset
477 if (!g_utf8_validate(filename, -1, 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
478 continue;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
479
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
480 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
481 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
482 xmlAddChild(tracklist, track);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
483
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
484 /* Do we have a tuple? */
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
485 if (entry->tuple != NULL) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
486 gint i;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
487 for (i = 0; i < xspf_nentries; i++) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
488 const xspf_entry_t *xs = &xspf_entries[i];
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
489 gboolean isOK = FALSE;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
490
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
491 switch (xs->type) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
492 case TUPLE_STRING:
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
493 scratch = aud_tuple_get_string(entry->tuple, xs->tupleField, NULL);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
494 switch (xs->compare) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
495 case CMP_DEF: isOK = (scratch != NULL); break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
496 case CMP_NULL: isOK = (scratch == NULL); break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
497 }
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
498 if (scratch != NULL && !g_utf8_validate(scratch, -1, NULL))
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
499 isOK = FALSE;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
500 break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
501
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
502 case TUPLE_INT:
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1966
diff changeset
503 scratchi = aud_tuple_get_int(entry->tuple, xs->tupleField, NULL);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
504 switch (xs->compare) {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
505 case CMP_DEF: isOK = (scratchi != 0); break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
506 case CMP_GT: isOK = (scratchi > 0); break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
507 }
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
508 break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
509
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
510 default:
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
511 break;
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
512 }
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
513
1668
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
514 if (isOK)
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
515 xspf_add_node(track, xs->type, xs->isMeta, xs->xspfName, scratch, scratchi);
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
516 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
517
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
518 } else {
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
519
1668
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
520 if (entry->title != NULL && g_utf8_validate(entry->title, -1, NULL))
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
521 xspf_add_node(track, TUPLE_STRING, FALSE, "title", entry->title, 0);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
522
1668
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
523 if (entry->length > 0)
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
524 xspf_add_node(track, TUPLE_INT, FALSE, "duration", NULL, entry->length);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
525
1669
e1985da23d28 And yet more cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
526 /* Add mtime of -1 */
1668
4c088a45f839 More code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1667
diff changeset
527 xspf_add_node(track, TUPLE_INT, TRUE, "mtime", NULL, -1);
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
528 }
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
529
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
530 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
531 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
532
1675
ae9b0327b620 Fix plugins to conform with PLAYLIST_{UN}LOCK() change.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
533 PLAYLIST_UNLOCK(playlist);
92
fadf346ddde3 [svn] - pls doesn't go along with PLAYLIST_LOCK in playlist_save().
yaz
parents: 87
diff changeset
534
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
535 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
536 xmlFreeDoc(doc);
892
d0b558bcf704 [svn] - initial support for writing relative path.
yaz
parents: 891
diff changeset
537 xmlFree(base);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
538 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
539
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
540
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
541 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
542 .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
543 .ext = "xspf",
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
544 .plc_read = xspf_playlist_load,
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
545 .plc_write = xspf_playlist_save,
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
546 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
547
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
548
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
549 static void xspf_init(void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
550 {
2053
059bd21a0c80 PlaylistContainer API updates
William Pitcock <nenolod@atheme.org>
parents: 1976
diff changeset
551 aud_playlist_container_register(&plc_xspf);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
552 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
553
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
554
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
555 static void xspf_cleanup(void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
556 {
2053
059bd21a0c80 PlaylistContainer API updates
William Pitcock <nenolod@atheme.org>
parents: 1976
diff changeset
557 aud_playlist_container_unregister(&plc_xspf);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
558 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
559
1962
076126300dd8 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1952
diff changeset
560
1661
927d341eecb8 Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
561 DECLARE_PLUGIN(xspf, xspf_init, xspf_cleanup, NULL, NULL, NULL, NULL, NULL, NULL);