annotate src/streambrowser/shoutcast.c @ 2815:cc6f02424609

added initial support for xiph streaming directory; small bug fixes & code cleanups
author Calin Crisan ccrisan@gmail.com
date Sun, 13 Jul 2008 04:00:04 +0300
parents 7977bdc02664
children fbb32674bfd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2811
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
1 /*
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
2 * Audacious Streambrowser Plugin
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
3 *
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
4 * Copyright (c) 2008 Calin Crisan <ccrisan@gmail.com>
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
5 *
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
6 * This program is free software; you can redistribute it and/or modify
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
7 * it under the terms of the GNU General Public License as published by
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
8 * the Free Software Foundation; under version 3 of the License.
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
9 *
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
10 * This program is distributed in the hope that it will be useful,
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
13 * GNU General Public License for more details.
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
14 *
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
15 * You should have received a copy of the GNU General Public License
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses>.
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
17 */
7977bdc02664 added GPL headers
Calin Crisan ccrisan@gmail.com
parents: 2809
diff changeset
18
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
19
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
20 #include <string.h>
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
21 #include <glib.h>
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
22 #include <libxml/parser.h>
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
23 #include <libxml/tree.h>
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
24 #include <audacious/plugin.h>
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
25
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
26 #include "streambrowser.h"
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
27 #include "shoutcast.h"
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
28
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
29
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
30 gboolean shoutcast_category_fetch(category_t *category)
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
31 {
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
32 gchar url[DEF_STRING_LEN];
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
33 g_snprintf(url, DEF_STRING_LEN, SHOUTCAST_CATEGORY_URL, category->name);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
34
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
35 /* generate a valid, temporary filename */
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
36 char *temp_filename = tempnam(NULL, "aud_sb");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
37 if (temp_filename == NULL) {
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
38 failure("shoutcast: failed to create a temporary file\n");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
39 return FALSE;
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
40 }
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
41
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
42 char temp_pathname[DEF_STRING_LEN];
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
43 sprintf(temp_pathname, "file://%s", temp_filename);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
44
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
45 debug("shoutcast: fetching category file '%s'\n", url);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
46 if (!fetch_remote_to_local_file(url, temp_pathname)) {
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
47 failure("shoutcast: category file '%s' could not be downloaded to '%s'\n", url, temp_pathname);
2809
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
48 free(temp_filename);
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
49 return FALSE;
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
50 }
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
51 debug("shoutcast: category file '%s' successfuly downloaded to '%s'\n", url, temp_pathname);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
52
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
53 xmlDoc *doc = xmlReadFile(temp_pathname, NULL, 0);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
54 if (doc == NULL) {
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
55 failure("shoutcast: failed to read '%s' category file\n", category->name);
2809
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
56 free(temp_filename);
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
57 return FALSE;
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
58 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
59
2815
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
60 /* free/remove any existing streaminfos in this category */
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
61 while (streaminfo_get_count(category) > 0)
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
62 streaminfo_remove(category, streaminfo_get_by_index(category, 0));
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
63
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
64 xmlNode *root_node = xmlDocGetRootElement(doc);
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
65 xmlNode *node;
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
66
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
67 root_node = root_node->children;
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
68
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
69 for (node = root_node; node != NULL; node = node->next) {
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
70 if (node->type == XML_ELEMENT_NODE && !strcmp((char *) node->name, "station")) {
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
71 gchar *streaminfo_name = (gchar*) xmlGetProp(node, (xmlChar *) "name");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
72 gchar *streaminfo_id = (gchar*) xmlGetProp(node, (xmlChar *) "id");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
73 gchar streaminfo_playlist_url[DEF_STRING_LEN];
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
74 gchar *streaminfo_current_track = (gchar*) xmlGetProp(node, (xmlChar *) "ct");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
75
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
76 g_snprintf(streaminfo_playlist_url, DEF_STRING_LEN, SHOUTCAST_STREAMINFO_URL, streaminfo_id);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
77
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
78 debug("shoutcast: fetching stream info for '%s/%d' from '%s'\n", streaminfo_name, streaminfo_id, url);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
79
2815
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
80 streaminfo_t *streaminfo = streaminfo_new(streaminfo_name, streaminfo_playlist_url, "", streaminfo_current_track);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
81 streaminfo_add(category, streaminfo);
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
82
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
83 xmlFree(streaminfo_name);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
84 xmlFree(streaminfo_id);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
85 xmlFree(streaminfo_current_track);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
86
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
87 debug("shoutcast: stream info added\n");
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
88 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
89 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
90
2815
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
91 xmlFreeDoc(doc);
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
92
2809
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
93 if (remove(temp_filename) != 0) {
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
94 failure("shoutcast: cannot remove the temporary file: %s\n", strerror(errno));
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
95 }
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
96 free(temp_filename);
2815
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
97
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
98 return TRUE;
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
99 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
100
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
101
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
102 streamdir_t* shoutcast_streamdir_fetch()
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
103 {
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
104 streamdir_t *streamdir = streamdir_new(SHOUTCAST_NAME);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
105
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
106 /* generate a valid, temporary filename */
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
107 char *temp_filename = tempnam(NULL, "aud_sb");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
108 if (temp_filename == NULL) {
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
109 failure("shoutcast: failed to create a temporary file\n");
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
110 return NULL;
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
111 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
112
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
113 char temp_pathname[DEF_STRING_LEN];
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
114 sprintf(temp_pathname, "file://%s", temp_filename);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
115
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
116 debug("shoutcast: fetching streaming directory file '%s'\n", SHOUTCAST_STREAMDIR_URL);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
117 if (!fetch_remote_to_local_file(SHOUTCAST_STREAMDIR_URL, temp_pathname)) {
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
118 failure("shoutcast: stream directory file '%s' could not be downloaded to '%s'\n", SHOUTCAST_STREAMDIR_URL, temp_pathname);
2809
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
119 free(temp_filename);
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
120 return NULL;
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
121 }
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
122 debug("shoutcast: stream directory file '%s' successfuly downloaded to '%s'\n", SHOUTCAST_STREAMDIR_URL, temp_pathname);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
123
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
124 xmlDoc *doc = xmlReadFile(temp_pathname, NULL, 0);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
125 if (doc == NULL) {
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
126 failure("shoutcast: failed to read stream directory file\n");
2809
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
127 free(temp_filename);
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
128 return NULL;
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
129 }
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
130
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
131 xmlNode *root_node = xmlDocGetRootElement(doc);
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
132 xmlNode *node;
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
133
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
134 root_node = root_node->children;
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
135
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
136 for (node = root_node; node != NULL; node = node->next) {
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
137 if (node->type == XML_ELEMENT_NODE) {
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
138 gchar *category_name = (gchar*) xmlGetProp(node, (xmlChar *) "name");
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
139
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
140 debug("shoutcast: fetching category '%s'\n", category_name);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
141
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
142 category_t *category = category_new(category_name);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
143 category_add(streamdir, category);
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
144
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
145 xmlFree(category_name);
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
146
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
147 debug("shoutcast: category added\n", category_name);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
148 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
149 }
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
150
2815
cc6f02424609 added initial support for xiph streaming directory; small bug fixes & code cleanups
Calin Crisan ccrisan@gmail.com
parents: 2811
diff changeset
151 xmlFreeDoc(doc);
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
152
2809
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
153 if (remove(temp_filename) != 0) {
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
154 failure("shoutcast: cannot remove the temporary file: %s\n", strerror(errno));
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
155 }
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
156 free(temp_filename);
d608b16a710b fixed temporary files deletion
Calin Crisan ccrisan@gmail.com
parents: 2735
diff changeset
157
2735
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
158 debug("shoutcast: streaming directory successfuly loaded\n");
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
159
6d6a3eb67510 some work on the streambrowser
Calin Crisan ccrisan@gmail.com
parents: 2570
diff changeset
160 return streamdir;
2570
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
161 }
28498c0bde64 Initial commit for the streambrowser plugin
Calin Crisan ccrisan@gmail.com
parents:
diff changeset
162