This patch is actually not totally correct. A better patch is attached.
--- lastfmsubmit.py	2007-06-25 17:19:33.000000000 -0400
+++ /usr/share/quodlibet/plugins/events/lastfmsubmit.py	2007-12-05 00:13:41.000000000 -0500
@@ -22,16 +23,20 @@
     PLUGIN_NAME = _("Last.fm Submission")
     PLUGIN_DESC = "Submit songs to Last.fm via lastfmsubmitd."
     PLUGIN_ICON = gtk.STOCK_CONNECT
-    PLUGIN_VERSION = "0.3"
+    PLUGIN_VERSION = "0.4"
 
     __exclude = ""
     __song = None
     __timeout_id = -1
-    __log = lastfm.logger('quodlibet')
+    __cli = None
 
     def __init__(self):
-        try: self.__exclude = config.get("plugins", "scrobbler_exclude")
-        except: pass
+        try:
+            self.__exclude = config.get("plugins", "scrobbler_exclude")
+        except:
+            pass
+        self.__cli = lastfm.client.Client('quodlibet')
+        self.__cli.open_log()
 
     def unprepare(self):
         if self.__timeout_id > 0:
@@ -131,6 +136,8 @@
         for key in data.keys():
             if not data[key]: del(data[key])
         try:
-            lastfm.submit([data])
-            self.__log.info("Sent %s", lastfm.repr(data))
-        except IOError, e: self.__log.error("Error: %s" % e)
+            self.__cli.submit(data)
+            self.__cli.log.info("Sent %s", lastfm.repr(data))
+        except IOError, e:
+            print >>sys.stderr, e
+            self.__cli.log.error("Error: %s" % e)

Reply via email to