changeset 1018:3484d9da7f7c trunk

[svn] - make metadata display in Audacious again.
author nenolod
date Fri, 11 May 2007 09:48:31 -0700
parents 2f0b7056f354
children 6f1848706fc4
files ChangeLog src/lastfm/lastfm.c
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri May 11 09:41:34 2007 -0700
+++ b/ChangeLog	Fri May 11 09:48:31 2007 -0700
@@ -1,3 +1,11 @@
+2007-05-11 16:41:34 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [2198]
+  - returning -1 is invalid here for fsize(). make metadata display in Audacious.
+  
+  trunk/src/lastfm/lastfm.c |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2007-05-11 16:37:33 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [2196]
   - don't report content-length
--- a/src/lastfm/lastfm.c	Fri May 11 09:41:34 2007 -0700
+++ b/src/lastfm/lastfm.c	Fri May 11 09:48:31 2007 -0700
@@ -173,6 +173,7 @@
 			{
 				if (g_str_has_prefix(split[i], "artist="))
 				{
+					if (handle->lastfm_artist) g_free(handle->lastfm_artist);
 					handle->lastfm_artist = g_strdup(split[i] + 7);
 #ifdef DEBUG
 					g_print("Artist: %s\n", handle->lastfm_artist);
@@ -180,6 +181,7 @@
 				}
 				if (g_str_has_prefix(split[i], "track="))
 				{
+					if (handle->lastfm_title) g_free(handle->lastfm_title);
 					handle->lastfm_title = g_strdup(split[i] + 6);
 #ifdef DEBUG
 					g_print("Title: %s\n", handle->lastfm_title);
@@ -223,10 +225,8 @@
 #endif
 
 		sleep(sleep_time);
-#if 0
 		if (handle->proxy_fd == NULL)
 			opened_file = FALSE;
-#endif
 	}
 
 #ifdef DEBUG
@@ -238,6 +238,7 @@
 
 VFSFile *lastfm_vfs_fopen_impl(const gchar * path, const gchar * mode)
 {
+	static GThread *th;
 	VFSFile *file;
 	LastFM *handle;
 	file = g_new0(VFSFile, 1);
@@ -258,9 +259,9 @@
 	handle->lastfm_session_id = g_strdup(LastFMGlobalData->lastfm_session_id);
 	handle->lastfm_station_name = g_strdup(LastFMGlobalData->lastfm_station_name);
 
-	if (lastfm_adjust(path) && metadata_thread == NULL)
+	if (lastfm_adjust(path))
 	{
-		if ((metadata_thread = g_thread_create(lastfm_get_metadata, handle, FALSE, NULL)) == NULL)
+		if ((th = g_thread_create(lastfm_get_metadata, handle, FALSE, NULL)) == NULL)
 		{
 #ifdef DEBUG
 			g_print("Error creating metadata thread!!!\n");
@@ -287,7 +288,6 @@
 {
 	gint ret = 0;
 
-
 	if (file == NULL)
 		return -1;
 
@@ -301,7 +301,6 @@
 
 size_t lastfm_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file)
 {
-
 	LastFM *handle = file->handle;
 	size_t ret = vfs_fread(ptr, size, nmemb, handle->proxy_fd);
 	return ret;
@@ -364,7 +363,7 @@
 	LastFM *handle = file->handle;
 
 #ifdef DEBUG
-	g_print("Interesting metadata:\n");
+	g_print("Interesting metadata (want: %s):\n", field);
 
 	if (handle->lastfm_station_name != NULL)
 		g_print("%s\n", handle->lastfm_station_name);