Mercurial > audlegacy-plugins
annotate src/xspf/xspf.c @ 1668:4c088a45f839
More code cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 08 Sep 2007 04:22:31 +0300 |
parents | 7c32522b05b8 |
children | e1985da23d28 |
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 | 4 * Giacomo Lozito, Derek Pomery, Yoshiki Yazawa |
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 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 #include <config.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #include <glib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 #include <time.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 #include <unistd.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 #include <sys/types.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 #include <sys/stat.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 #include <sys/errno.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 #include "audacious/main.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 #include "audacious/util.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 #include "audacious/playlist.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 #include "audacious/playlist_container.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 #include "audacious/plugin.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 #include <libxml/tree.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 #include <libxml/parser.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 #include <libxml/xmlreader.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 #include <libxml/xpath.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 #include <libxml/xpathInternals.h> |
641 | 44 #include <libxml/uri.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 |
641 | 46 #define XSPF_ROOT_NODE_NAME "playlist" |
47 #define XSPF_XMLNS "http://xspf.org/ns/0/" | |
47 | 48 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
49 enum { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
50 CMP_DEF = 0, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
51 CMP_GT, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
52 CMP_NULL |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
53 } xspf_compare; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
54 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
55 typedef struct { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
56 gchar *tupleName; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
57 gchar *xspfName; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
58 TupleValueType type; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
59 gboolean isMeta; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
60 gint compare; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
61 } xspf_entry_t; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
62 |
47 | 63 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
64 static const xspf_entry_t xspf_entries[] = { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
65 { "title", "title", TUPLE_STRING, FALSE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
66 { "artist", "creator", TUPLE_STRING, FALSE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
67 { "comment", "annotation", TUPLE_STRING, FALSE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
68 { "album", "album", TUPLE_STRING, FALSE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
69 { "track-number", "trackNum", TUPLE_INT, FALSE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
70 { "length", "duration", TUPLE_INT, FALSE, CMP_GT }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
71 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
72 { "year", "year", TUPLE_INT, TRUE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
73 { "date", "date", TUPLE_STRING, TRUE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
74 { "genre", "genre", TUPLE_STRING, TRUE, CMP_DEF }, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
75 { "formatter", "formatter", TUPLE_STRING, TRUE, CMP_DEF }, |
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 |
641 | 80 |
892 | 81 static gboolean is_uri(gchar *uri) |
82 { | |
83 if(strstr(uri, "://")) | |
84 return TRUE; | |
85 else | |
86 return FALSE; | |
87 } | |
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 | 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 | 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 | 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 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
118 static void xspf_add_file(xmlNode *track, const gchar *filename, gint pos, const gchar *base) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
120 xmlNode *nptr; |
1444
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
121 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
|
122 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
|
123 Playlist *playlist = playlist_get_active(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
126 tuple = tuple_new(); |
1444
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
127 tuple_associate_int(tuple, "length", -1); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
128 tuple_associate_int(tuple, "mtime", -1); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
129 |
641 | 130 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
131 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
|
132 if (nptr->type == XML_ELEMENT_NODE) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
133 if (!xmlStrcmp(nptr->name, (xmlChar *)"location")) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
134 /* Location is a special case */ |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
135 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
657 | 136 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
137 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
|
138 xmlFree(str); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
139 str = g_filename_from_uri(location, NULL, NULL); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
140 if (str) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
141 g_free(location); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
142 location = g_strdup_printf("file://%s", str); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
143 } |
1594
78d8dd386d0b
Kludge xspf plugin to "work" better with playlist entries which have
Matti Hamalainen <ccr@tnsp.org>
parents:
1547
diff
changeset
|
144 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
145 g_free(str); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
146 } else { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
147 /* Rest of the nodes are handled here */ |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
148 gint i; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
149 gboolean isMeta; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
150 xmlChar *findName; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
151 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
152 if (!xmlStrcmp(nptr->name, (xmlChar *)"meta")) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
153 isMeta = TRUE; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
154 findName = xmlGetProp(nptr, (xmlChar *)"rel"); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
155 } else { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
156 isMeta = FALSE; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
157 findName = xmlStrdup(nptr->name); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
158 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
159 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
160 for (i = 0; i < xspf_nentries; i++) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
161 if ((xspf_entries[i].isMeta == isMeta) && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
162 !xmlStrcmp(findName, (xmlChar *)xspf_entries[i].xspfName)) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
163 xmlChar *str = xmlNodeGetContent(nptr); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
164 switch (xspf_entries[i].type) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
165 case TUPLE_STRING: |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
166 tuple_associate_string(tuple, xspf_entries[i].tupleName, (gchar *)str); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
167 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
168 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
169 case TUPLE_INT: |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
170 tuple_associate_int(tuple, xspf_entries[i].tupleName, atol((char *)str)); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
171 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
172 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
173 default: |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
174 /* FIXME! error! */ |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
175 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
176 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
177 xmlFree(str); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
178 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
179 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
180 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
181 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
182 xmlFree(findName); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
183 } |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
184 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
185 } |
47 | 186 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
187 if (location) { |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
188 gchar *uri = NULL; |
1444
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
189 gchar *scratch; |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
190 |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
191 scratch = g_path_get_basename(location); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
192 tuple_associate_string(tuple, "file-name", scratch); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
193 g_free(scratch); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
194 |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
195 scratch = g_path_get_dirname(location); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
196 tuple_associate_string(tuple, "file-path", scratch); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
197 g_free(scratch); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
198 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
199 tuple_associate_string(tuple, "file-ext", strrchr(location, '.')); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
200 |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
201 #ifdef DEBUG |
1444
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
202 printf("xspf: tuple->file_name = %s\n", tuple_get_string(tuple, "file-name")); |
3b1651d37b58
xspf: update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
203 printf("xspf: tuple->file_path = %s\n", tuple_get_string(tuple, "file-path")); |
1278
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 // add file to playlist |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
206 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
|
207 // 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
|
208 playlist_load_ins_file_tuple(playlist, uri ? uri: location, filename, pos, tuple); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
209 g_free(uri); |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
210 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
|
211 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 g_free(location); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
216 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
217 static void xspf_find_track(xmlNode *tracklist, const gchar *filename, gint pos, const gchar *base) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
219 xmlNode *nptr; |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
220 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
221 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
|
222 if (nptr->type == XML_ELEMENT_NODE && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
223 !xmlStrcmp(nptr->name, (xmlChar *)"track")) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
224 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
|
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 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
229 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
230 static void xspf_find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos) |
641 | 231 { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
233 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
|
234 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
235 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
|
236 if (nptr->type == XML_ELEMENT_NODE && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
237 !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
|
238 xmlChar *opt = NULL; |
884 | 239 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 opt = xmlGetProp(nptr, (xmlChar *)"staticlist"); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
241 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
|
242 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
|
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; |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
245 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
247 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
|
248 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
249 } |
641 | 250 } |
251 | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
252 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
253 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
|
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 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
|
256 xmlNode *nptr, *nptr2; |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
257 gchar *tmp = NULL, *base = 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
|
258 |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
259 g_return_if_fail(filename != NULL); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
260 |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
261 #ifdef DEBUG |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
262 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
|
263 #endif |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
264 |
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
|
265 doc = xmlRecoverFile(filename); |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
267 return; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 // find trackList |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
270 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
|
271 if (nptr->type == XML_ELEMENT_NODE && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
272 !xmlStrcmp(nptr->name, (xmlChar *)"playlist")) { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
273 base = (gchar *)xmlNodeGetBase(doc, nptr); |
892 | 274 #ifdef DEBUG |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
275 printf("playlist_load_xspf: base @1 = %s\n", base); |
892 | 276 #endif |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
277 // 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
|
278 tmp = xmlURIUnescapeString(base, -1, NULL); |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
279 if(tmp) { |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
280 if(!strcmp(tmp, filename)) { |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
281 xmlFree(base); |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
282 base = NULL; |
892 | 283 } |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
284 g_free(tmp); |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
285 tmp = NULL; |
892 | 286 } |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
287 #ifdef DEBUG |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
288 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
|
289 #endif |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
290 for (nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) { |
641 | 291 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
292 if (nptr2->type == XML_ELEMENT_NODE && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
293 !xmlStrcmp(nptr2->name, (xmlChar *)"extension")) { |
641 | 294 //check if application is audacious |
295 xmlChar *app = NULL; | |
296 app = xmlGetProp(nptr2, (xmlChar *)"application"); | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
297 if (!xmlStrcmp(app, (xmlChar *)"audacious")) |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
298 xspf_find_audoptions(nptr2, filename, pos); |
641 | 299 xmlFree(app); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
300 } else |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
301 if (nptr2->type == XML_ELEMENT_NODE && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
302 !xmlStrcmp(nptr2->name, (xmlChar *)"title")) { |
1528
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
303 Playlist *plist = playlist_get_active(); |
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
304 xmlChar *title = xmlNodeGetContent(nptr2); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
305 |
1528
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
306 if (title && *title) { |
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
307 gchar *old = plist->title; |
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
308 plist->title = g_strdup((gchar*)title); |
1547
b63e772ee21d
Useless use of if() with g_free().
Matti Hamalainen <ccr@tnsp.org>
parents:
1546
diff
changeset
|
309 g_free(old); |
1528
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
310 } |
8fddba1d94e4
xspf: When loading playlist, read title from xml if set
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1514
diff
changeset
|
311 xmlFree(title); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
312 } else |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
313 if(nptr2->type == XML_ELEMENT_NODE && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
314 !xmlStrcmp(nptr2->name, (xmlChar *)"trackList")) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
315 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
|
316 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
317 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
319 } |
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
320 xmlFreeDoc(doc); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
323 |
1668 | 324 static void xspf_add_node( |
325 xmlNodePtr node, TupleValueType type, gboolean isMeta, | |
326 const gchar *xspfName, const gchar *strVal, const gint intVal) | |
327 { | |
328 gchar tmps[64]; | |
329 xmlNodePtr tmp; | |
330 | |
331 if (isMeta) { | |
332 tmp = xmlNewNode(NULL, (xmlChar *) "meta"); | |
333 xmlSetProp(tmp, (xmlChar *) "rel", (xmlChar *) xspfName); | |
334 } else | |
335 tmp = xmlNewNode(NULL, (xmlChar *) xspfName); | |
336 | |
337 switch (type) { | |
338 case TUPLE_STRING: | |
339 xmlAddChild(tmp, xmlNewText((xmlChar *) strVal)); | |
340 break; | |
341 | |
342 case TUPLE_INT: | |
343 g_snprintf(tmps, sizeof(tmps), "%d", intVal); | |
344 xmlAddChild(tmp, xmlNewText((xmlChar *) tmps)); | |
345 break; | |
346 | |
347 default: | |
348 break; | |
349 } | |
350 | |
351 xmlAddChild(node, tmp); | |
352 } | |
353 | |
354 | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
355 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
|
356 { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
358 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
|
359 GList *node; |
892 | 360 gint baselen = 0; |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
361 gchar *base = 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
|
362 Playlist *playlist = playlist_get_active(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
364 #ifdef DEBUG |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
365 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
|
366 #endif |
892 | 367 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
368 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
|
369 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
|
370 doc->encoding = xmlStrdup((xmlChar *)"UTF-8"); |
585
2d20bc58a290
[svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents:
577
diff
changeset
|
371 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
372 rootnode = xmlNewNode(NULL, (xmlChar *)XSPF_ROOT_NODE_NAME); |
892 | 373 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
|
374 xmlSetProp(rootnode, (xmlChar *)"xmlns", (xmlChar *)XSPF_XMLNS); |
892 | 375 |
376 PLAYLIST_LOCK(playlist->mutex); | |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
377 |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
378 /* relative */ |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
379 if (playlist->attribute & PLAYLIST_USE_RELATIVE) { |
892 | 380 /* prescan to determine base uri */ |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
381 for (node = playlist->entries; node != NULL; node = g_list_next(node)) { |
892 | 382 gchar *ptr1, *ptr2; |
383 PlaylistEntry *entry = PLAYLIST_ENTRY(node->data); | |
384 gchar *tmp; | |
385 gint tmplen = 0; | |
386 | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
387 if (!is_uri(entry->filename)) { //obsolete |
892 | 388 gchar *tmp2; |
389 tmp2 = g_path_get_dirname(entry->filename); | |
390 tmp = g_strdup_printf("%s/", tmp2); | |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
391 g_free(tmp2); tmp2 = NULL; |
892 | 392 } |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
393 else { //uri |
892 | 394 tmp = g_strdup(entry->filename); |
395 } | |
396 | |
397 if(!base) { | |
398 base = strdup(tmp); | |
399 baselen = strlen(base); | |
400 } | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
401 |
892 | 402 ptr1 = base; |
403 ptr2 = tmp; | |
404 | |
405 while(ptr1 && ptr2 && *ptr1 && *ptr2 && *ptr1 == *ptr2) { | |
406 ptr1++; | |
407 ptr2++; | |
408 } | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
409 |
892 | 410 *ptr2 = '\0'; //terminate |
411 tmplen = ptr2 - tmp; | |
412 | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
413 if (tmplen <= baselen) { |
892 | 414 g_free(base); |
415 base = tmp; | |
416 baselen = tmplen; | |
417 #ifdef DEBUG | |
418 printf("base = \"%s\" baselen = %d\n", base, baselen); | |
419 #endif | |
420 } | |
421 else { | |
422 g_free(tmp); | |
423 tmp = NULL; | |
424 } | |
425 } | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
426 |
892 | 427 /* set base URI */ |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
428 if (base) { |
892 | 429 gchar *tmp; |
430 if(!is_uri(base)) { | |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
431 tmp = (gchar *) xspf_path_to_uri((xmlChar *)base); |
892 | 432 if(tmp) { |
433 g_free(base); | |
434 base = tmp; | |
435 } | |
436 } | |
437 | |
438 if(!is_uri(base)) { | |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
439 #ifdef DEBUG |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
440 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
|
441 #endif |
892 | 442 tmp = g_strdup_printf("file://%s", base); |
443 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)tmp); | |
444 g_free(tmp); | |
445 tmp = NULL; | |
446 } | |
447 else | |
448 xmlSetProp(rootnode, (xmlChar *)"xml:base", (xmlChar *)base); | |
449 } | |
450 } /* USE_RELATIVE */ | |
451 | |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
452 /* 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
|
453 xmlDocSetRootElement(doc, rootnode); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
455 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
|
456 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
|
457 xmlAddChild(rootnode, tmp); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
459 /* add staticlist marker */ |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
460 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
|
461 xmlNodePtr extension, options; |
884 | 462 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
463 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
|
464 xmlSetProp(extension, (xmlChar *)"application", (xmlChar *)"audacious"); |
884 | 465 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
467 xmlSetProp(options, (xmlChar *)"staticlist", (xmlChar *)"true"); |
884 | 468 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
469 xmlAddChild(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
|
470 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
|
471 } |
884 | 472 |
1531
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
473 /* save playlist title */ |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
474 if (playlist->title && playlist->title[0] && |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
475 g_utf8_validate(playlist->title, -1, NULL)) { |
1531
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
476 xmlNodePtr title; |
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
477 title = xmlNewNode(NULL, (xmlChar *)"title"); |
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
478 xmlAddChild(title, xmlNewText((xmlChar *)playlist->title)); |
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
479 xmlAddChild(rootnode, title); |
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
480 } |
10cfa5b51bce
xspf: Store playlist title when saving playlist
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
1528
diff
changeset
|
481 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
483 xmlAddChild(rootnode, tracklist); |
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 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
|
486 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
|
487 xmlNodePtr track, location; |
1668 | 488 gchar *filename = NULL; |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
489 const gchar *scratch = NULL; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
490 gint scratchi = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
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 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
|
493 location = xmlNewNode(NULL, (xmlChar *)"location"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
495 if(is_uri(entry->filename)) { /* uri */ |
892 | 496 #ifdef DEBUG |
497 printf("filename is uri\n"); | |
498 #endif | |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
499 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
|
500 } |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
501 else { /* local file (obsolete) */ |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
502 gchar *tmp = (gchar *) xspf_path_to_uri((const xmlChar *)entry->filename + baselen); |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
503 if(base) { /* relative */ |
892 | 504 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
|
505 } else { |
892 | 506 #ifdef DEBUG |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
507 printf("absolute and local (obsolete)\n"); |
892 | 508 #endif |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
509 filename = g_filename_to_uri(tmp, NULL, NULL); |
892 | 510 } |
1278
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
511 g_free(tmp); tmp = NULL; |
d1c66f8ccf73
adapt xspf for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1271
diff
changeset
|
512 } /* obsolete */ |
585
2d20bc58a290
[svn] tweak xspf plugin to conform xspf specification version 1.
yaz
parents:
577
diff
changeset
|
513 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code 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 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
|
515 continue; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
517 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
|
518 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
|
519 xmlAddChild(tracklist, track); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
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 /* do we have a tuple? */ |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
522 if (entry->tuple != NULL) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
523 gint i; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
524 for (i = 0; i < xspf_nentries; i++) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
525 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
|
526 gboolean isOK = FALSE; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
527 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
528 switch (xs->type) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
529 case TUPLE_STRING: |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
530 scratch = tuple_get_string(entry->tuple, xs->tupleName); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
531 switch (xs->compare) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
532 case CMP_DEF: isOK = (scratch != NULL); break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
533 case CMP_NULL: isOK = (scratch == NULL); break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
534 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
535 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
|
536 isOK = FALSE; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
537 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
538 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
539 case TUPLE_INT: |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
540 scratchi = tuple_get_int(entry->tuple, xs->tupleName); |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
541 switch (xs->compare) { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
542 case CMP_DEF: isOK = (scratchi != 0); break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
543 case CMP_GT: isOK = (scratchi > 0); break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
544 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
545 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
546 |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
547 default: |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
548 break; |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
549 } |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
550 |
1668 | 551 if (isOK) |
552 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
|
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 // mtime: write mtime unconditionally to support staticlist. |
1668 | 556 xspf_add_node(track, TUPLE_INT, TRUE, "mtime", NULL, tuple_get_int(entry->tuple, "mtime")); |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
557 } else { |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
558 |
1668 | 559 if (entry->title != NULL && g_utf8_validate(entry->title, -1, NULL)) |
560 xspf_add_node(track, TUPLE_STRING, FALSE, "title", entry->title, 0); | |
892 | 561 |
1668 | 562 if (entry->length > 0) |
563 xspf_add_node(track, TUPLE_INT, FALSE, "duration", NULL, entry->length); | |
892 | 564 |
565 /* add mtime of -1 */ | |
1668 | 566 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
|
567 } |
892 | 568 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
569 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
|
570 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
|
571 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
572 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
573 PLAYLIST_UNLOCK(playlist->mutex); |
92
fadf346ddde3
[svn] - pls doesn't go along with PLAYLIST_LOCK in playlist_save().
yaz
parents:
87
diff
changeset
|
574 |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
575 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
|
576 xmlFreeDoc(doc); |
892 | 577 doc = NULL; |
578 | |
579 xmlFree(base); | |
580 base = NULL; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
583 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 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
|
585 .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
|
586 .ext = "xspf", |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
587 .plc_read = xspf_playlist_load, |
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
588 .plc_write = xspf_playlist_save, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
591 static void xspf_init(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
593 playlist_container_register(&plc_xspf); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
596 static void xspf_cleanup(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 { |
891
502222ed5dd4
[svn] justify indentation by gnu indent. current state is a mixture of some styles and very hard to maintain. the code is exactly same to previous revision. this is preparation for upcoming commit so that to make taking diff easier.
yaz
parents:
884
diff
changeset
|
598 playlist_container_unregister(&plc_xspf); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 |
1661
927d341eecb8
Partial rewrite/sanitation of the xspf plugin.
Matti Hamalainen <ccr@tnsp.org>
parents:
1594
diff
changeset
|
601 DECLARE_PLUGIN(xspf, xspf_init, xspf_cleanup, NULL, NULL, NULL, NULL, NULL, NULL); |