diff 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
line wrap: on
line diff
--- a/src/streambrowser/shoutcast.c	Sat Jul 12 16:00:03 2008 +0200
+++ b/src/streambrowser/shoutcast.c	Sun Jul 13 04:00:04 2008 +0300
@@ -57,6 +57,10 @@
 		return FALSE;
 	}
 	
+	/* free/remove any existing streaminfos in this category */
+	while (streaminfo_get_count(category) > 0)
+		streaminfo_remove(category, streaminfo_get_by_index(category, 0));
+	
 	xmlNode *root_node = xmlDocGetRootElement(doc);
 	xmlNode *node;
 	
@@ -73,7 +77,7 @@
 
 			debug("shoutcast: fetching stream info for '%s/%d' from '%s'\n", streaminfo_name, streaminfo_id, url);
 
-			streaminfo_t *streaminfo = streaminfo_new(streaminfo_name, streaminfo_playlist_url, streaminfo_current_track);
+			streaminfo_t *streaminfo = streaminfo_new(streaminfo_name, streaminfo_playlist_url, "", streaminfo_current_track);
 			streaminfo_add(category, streaminfo);
 			
 			xmlFree(streaminfo_name);
@@ -84,12 +88,13 @@
 		}
 	}
 	
+	xmlFreeDoc(doc);
+	
 	if (remove(temp_filename) != 0) {
 		failure("shoutcast: cannot remove the temporary file: %s\n", strerror(errno));
 	}
 	free(temp_filename);
-	// todo: free the xml mallocs()
-	
+
 	return TRUE;
 }
 
@@ -143,7 +148,7 @@
 		}
 	}
 
-	// todo: free the xml mallocs()
+	xmlFreeDoc(doc);
 	
 	if (remove(temp_filename) != 0) {
 		failure("shoutcast: cannot remove the temporary file: %s\n", strerror(errno));