# HG changeset patch # User Tomasz Mon # Date 1200308912 -3600 # Node ID 3f684f1b18405f0e0b25c7702e2f8c0e1d211e59 # Parent 76e5c5bc0969330f52449d742910f328b69a76eb don't create scrobblerqueue.txt/gerpokqueue.txt when no username nor password for last.fm/gerpok is entered diff -r 76e5c5bc0969 -r 3f684f1b1840 src/scrobbler/plugin.c --- a/src/scrobbler/plugin.c Mon Jan 14 04:33:50 2008 +0100 +++ b/src/scrobbler/plugin.c Mon Jan 14 12:08:32 2008 +0100 @@ -189,6 +189,10 @@ pdebug("about to lock mutex", DEBUG); g_mutex_lock(m_scrobbler); pdebug("locked mutex", DEBUG); + if (sc_going) + sc_cleaner(); + if (ge_going) + gerpok_sc_cleaner(); sc_going = 0; ge_going = 0; g_mutex_unlock(m_scrobbler); @@ -211,9 +215,6 @@ g_mutex_free(xs_mutex); g_mutex_free(m_scrobbler); - sc_cleaner(); - gerpok_sc_cleaner(); - aud_hook_dissociate("playback begin", aud_hook_playback_begin); aud_hook_dissociate("playback end", aud_hook_playback_end); } @@ -261,9 +262,11 @@ "submitting artist: %s, title: %s", aud_tuple_get_string(tuple, FIELD_ARTIST, NULL), aud_tuple_get_string(tuple, FIELD_TITLE, NULL)), DEBUG); - - sc_addentry(m_scrobbler, tuple, aud_tuple_get_int(tuple, FIELD_LENGTH, NULL) / 1000); - gerpok_sc_addentry(m_scrobbler, tuple, aud_tuple_get_int(tuple, FIELD_LENGTH, NULL) / 1000); + + if (sc_going) + sc_addentry(m_scrobbler, tuple, aud_tuple_get_int(tuple, FIELD_LENGTH, NULL) / 1000); + if (ge_going) + gerpok_sc_addentry(m_scrobbler, tuple, aud_tuple_get_int(tuple, FIELD_LENGTH, NULL) / 1000); if (!track_timeout) track_timeout = g_timeout_add_seconds(1, sc_timeout, NULL); } @@ -297,7 +300,7 @@ while(run) { - if(sc_idle(m_scrobbler)) + if(sc_going && sc_idle(m_scrobbler)) { pdebug("Giving up due to fatal error", DEBUG); g_mutex_lock(m_scrobbler); @@ -305,7 +308,7 @@ g_mutex_unlock(m_scrobbler); } - if(gerpok_sc_idle(m_scrobbler)) + if(ge_going && gerpok_sc_idle(m_scrobbler)) { pdebug("Giving up due to fatal error", DEBUG); g_mutex_lock(m_scrobbler);