diff src/scrobbler/plugin.c @ 990:238055a6cb8f trunk

[svn] - remove support for hatena music as hatena ceased their musical profile service.
author yaz
date Tue, 01 May 2007 07:03:49 -0700
parents eb5fe37b785d
children 69cf6184edef
line wrap: on
line diff
--- a/src/scrobbler/plugin.c	Mon Apr 30 22:03:19 2007 -0700
+++ b/src/scrobbler/plugin.c	Tue May 01 07:03:49 2007 -0700
@@ -24,7 +24,6 @@
 
 #include "scrobbler.h"
 #include "gerpok.h"
-#include "hatena.h"
 #include "gtkstuff.h"
 #include "config.h"
 #include "fmt.h"
@@ -43,7 +42,7 @@
 static void cleanup(void);
 static void *xs_thread(void *);
 static void *hs_thread(void *);
-static int sc_going, ge_going, ha_going;
+static int sc_going, ge_going;
 static GtkWidget *cfgdlg;
 
 static GMutex *m_scrobbler;
@@ -69,11 +68,9 @@
 {
 	char *username = NULL, *password = NULL;
 	char *ge_username = NULL, *ge_password = NULL;
-	char *ha_username = NULL, *ha_password = NULL;
 	ConfigDb *cfgfile;
 	sc_going = 1;
 	ge_going = 1;
-	ha_going = 1;
 	GError **moo = NULL;
 	cfgdlg = create_cfgdlg();
 
@@ -88,10 +85,6 @@
 				&ge_username);
 		bmp_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_password",
 				&ge_password);
-		bmp_cfg_db_get_string(cfgfile, "audioscrobbler", "ha_username",
-				&ha_username);
-		bmp_cfg_db_get_string(cfgfile, "audioscrobbler", "ha_password",
-				&ha_password);
 		bmp_cfg_db_close(cfgfile);
 	}
 
@@ -123,20 +116,6 @@
 		g_free(ge_password);
 	}
 
-	if ((!ha_username || !ha_password) || (!*ha_username || !*ha_password))
-	{
-		pdebug("username/password not found - not starting Hatena support",
-			DEBUG);
-		ha_going = 0;
-	}
-	else
-	{
-		hatena_sc_init(ha_username, ha_password);
-
-		g_free(ha_username);
-		g_free(ha_password);
-	}
-
 	m_scrobbler = g_mutex_new();
 	hs_mutex = g_mutex_new();
 	xs_mutex = g_mutex_new();
@@ -148,7 +127,6 @@
 		pdebug(fmt_vastr("Error creating scrobbler thread: %s", moo), DEBUG);
 		sc_going = 0;
 		ge_going = 0;
-		ha_going = 0;
 		return;
 	}
 
@@ -157,7 +135,6 @@
 		pdebug(fmt_vastr("Error creating handshake thread: %s", moo), DEBUG);
 		sc_going = 0;
 		ge_going = 0;
-		ha_going = 0;
 		return;
 	}
 
@@ -171,14 +148,13 @@
 
         prefswin_page_destroy(cfgdlg);
 
-	if (!sc_going && !ge_going && ! ha_going)
+	if (!sc_going && !ge_going)
 		return;
 	pdebug("about to lock mutex", DEBUG);
 	g_mutex_lock(m_scrobbler);
 	pdebug("locked mutex", DEBUG);
 	sc_going = 0;
 	ge_going = 0;
-	ha_going = 0;
 	g_mutex_unlock(m_scrobbler);
 	pdebug("joining threads", DEBUG);
 
@@ -201,7 +177,6 @@
 
 	sc_cleaner();
 	gerpok_sc_cleaner();
-	hatena_sc_cleaner();
 }
 
 static gboolean ishttp(const char *a)
@@ -459,12 +434,6 @@
 			gerpok_sc_clear_error();
 		}
 
-		if(hatena_sc_catch_error())
-		{
-			errorbox_show(hatena_sc_fetch_error());
-			hatena_sc_clear_error();
-		}
-
 		/* Check for ability to submit */
 		dosubmit = get_song_status();
 
@@ -513,8 +482,6 @@
 					tuple->performer, tuple->track_name), DEBUG);
 				sc_addentry(m_scrobbler, tuple,
 					dosubmit.len/1000);
-				hatena_sc_addentry(m_scrobbler, tuple,
-					dosubmit.len/1000);
 			}
 			else
 				pdebug("tuple does not contain an artist or a title, not submitting.", DEBUG);
@@ -523,7 +490,7 @@
 		sleeptime.tv_sec += XS_SLEEP;
 
 		g_mutex_lock(m_scrobbler);
-		run = (sc_going != 0 || ge_going != 0 || ha_going != 0);
+		run = (sc_going != 0 || ge_going != 0);
 		g_mutex_unlock(m_scrobbler);
 
 		g_mutex_lock(xs_mutex);
@@ -559,16 +526,8 @@
 			g_mutex_unlock(m_scrobbler);
 		}
 
-		if(hatena_sc_idle(m_scrobbler))
-		{
-			pdebug("Giving up due to fatal error", DEBUG);
-			g_mutex_lock(m_scrobbler);
-			ha_going = 0;
-			g_mutex_unlock(m_scrobbler);
-		}
-
 		g_mutex_lock(m_scrobbler);
-		run = (sc_going != 0 || ge_going != 0 || ha_going != 0);
+		run = (sc_going != 0 || ge_going != 0);
 		g_mutex_unlock(m_scrobbler);
 
 		if(run) {