diff options
| author | 2013-07-17 13:53:09 +0200 | |
|---|---|---|
| committer | 2013-07-17 13:53:09 +0200 | |
| commit | 96e9e7503f34260a2c34dd4f17d03287936e4d31 (patch) | |
| tree | ec6a7049ec03e91fb856850e0a50cb372d2b3aaf /module/plugins/hooks | |
| parent | BitshareCom: fixed #188 (diff) | |
| parent | fixed log api call for several plugins (diff) | |
| download | pyload-96e9e7503f34260a2c34dd4f17d03287936e4d31.tar.xz | |
Merge pull request #199 from vuolter/pluginlogfix
Fix log api call for several plugins
Diffstat (limited to 'module/plugins/hooks')
| -rw-r--r-- | module/plugins/hooks/ClickAndLoad.py | 6 | ||||
| -rw-r--r-- | module/plugins/hooks/Ev0InFetcher.py | 8 | ||||
| -rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 4 | ||||
| -rw-r--r-- | module/plugins/hooks/HotFolder.py | 4 | ||||
| -rw-r--r-- | module/plugins/hooks/IRCInterface.py | 14 | ||||
| -rw-r--r-- | module/plugins/hooks/MergeFiles.py | 10 | ||||
| -rw-r--r-- | module/plugins/hooks/MultiHome.py | 4 | ||||
| -rw-r--r-- | module/plugins/hooks/RehostTo.py | 4 | ||||
| -rw-r--r-- | module/plugins/hooks/UpdateManager.py | 18 | ||||
| -rw-r--r-- | module/plugins/hooks/XMPPInterface.py | 20 | 
10 files changed, 46 insertions, 46 deletions
| diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 97e5cd57d..230143cef 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -25,7 +25,7 @@ from module.plugins.Hook import Hook  class ClickAndLoad(Hook):      __name__ = "ClickAndLoad" -    __version__ = "0.2" +    __version__ = "0.21"      __description__ = """Gives abillity to use jd's click and load. depends on webinterface"""      __config__ = [("activated", "bool", "Activated", "True"),                    ("extern", "bool", "Allow external link adding", "False")] @@ -43,7 +43,7 @@ class ClickAndLoad(Hook):                  thread.start_new_thread(proxy, (self, ip, self.port, 9666))              except: -                self.log.error("ClickAndLoad port already in use.") +                self.logError("ClickAndLoad port already in use.")  def proxy(self, *settings): @@ -71,7 +71,7 @@ def server(self, *settings):              errno = e.args[0]          if errno == 98: -            self.core.log.warning(_("Click'N'Load: Port 9666 already in use")) +            self.logWarning(_("Click'N'Load: Port 9666 already in use"))              return          thread.start_new_thread(server, (self,) + settings)      except: diff --git a/module/plugins/hooks/Ev0InFetcher.py b/module/plugins/hooks/Ev0InFetcher.py index 5941cf38c..d29f89c2f 100644 --- a/module/plugins/hooks/Ev0InFetcher.py +++ b/module/plugins/hooks/Ev0InFetcher.py @@ -22,7 +22,7 @@ from module.plugins.Hook import Hook  class Ev0InFetcher(Hook):      __name__ = "Ev0InFetcher" -    __version__ = "0.2" +    __version__ = "0.21"      __description__ = """checks rss feeds for ev0.in"""      __config__ = [("activated", "bool", "Activated", "False"),                    ("interval", "int", "Check interval in minutes", "10"), @@ -73,15 +73,15 @@ class Ev0InFetcher(Hook):                  if show.lower() in normalizefiletitle(item['title']) and lastfound < int(mktime(item.date_parsed)):                      links = self.filterLinks(item['description'].split("<br />"))                      packagename = item['title'].encode("utf-8") -                    self.core.log.info("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show)) +                    self.logInfo("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show))                      self.core.api.addPackage(packagename, links, 1 if self.getConfig("queue") else 0)                      self.setStorage("show_%s_lastfound" % show, int(mktime(item.date_parsed)))                      found = True          if not found: -            #self.core.log.debug("Ev0InFetcher: no new episodes found") +            #self.logDebug("Ev0InFetcher: no new episodes found")              pass          for show, lastfound in self.getStorage().iteritems():              if int(lastfound) > 0 and int(lastfound) + (3600*24*30) < int(time()):                  self.delStorage("show_%s_lastfound" % show) -                self.core.log.debug("Ev0InFetcher: cleaned '%s' record" % show) +                self.logDebug("Ev0InFetcher: cleaned '%s' record" % show) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index f55589fec..bc5aa0f49 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ class ExtractArchive(Hook):      Provides: unrarFinished (folder, filename)      """      __name__ = "ExtractArchive" -    __version__ = "0.13" +    __version__ = "0.14"      __description__ = "Extract different kind of archives"      __config__ = [("activated", "bool", "Activated", True),          ("fullpath", "bool", "Extract full path", True), @@ -310,4 +310,4 @@ class ExtractArchive(Hook):                      gid = getgrnam(self.config["permission"]["group"])[2]                      chown(f, uid, gid)              except Exception, e: -                self.log.warning(_("Setting User and Group failed"), e) +                self.logWarning(_("Setting User and Group failed"), e) diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index ee1031ad5..fd889fa22 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -30,7 +30,7 @@ from module.plugins.Hook import Hook  class HotFolder(Hook):      __name__ = "HotFolder" -    __version__ = "0.1" +    __version__ = "0.11"      __description__ = """observe folder and file for changes and add container and links"""      __config__ = [ ("activated", "bool", "Activated" , "False"),                     ("folder", "str", "Folder to observe", "container"), @@ -79,7 +79,7 @@ class HotFolder(Hook):              newpath = join(self.getConfig("folder"), "finished", f if self.getConfig("keep") else "tmp_"+f)              move(path, newpath) -            self.log.info(_("Added %s from HotFolder") % f) +            self.logInfo(_("Added %s from HotFolder") % f)              self.core.api.addPackage(f, [newpath], 1)          
\ No newline at end of file diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index a9fc11f53..b9f3c1ba6 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -36,7 +36,7 @@ from pycurl import FORM_FILE  class IRCInterface(Thread, Hook):      __name__ = "IRCInterface" -    __version__ = "0.1" +    __version__ = "0.11"      __description__ = """connect to irc and let owner perform different tasks"""      __config__ = [("activated", "bool", "Activated", "False"),          ("host", "str", "IRC-Server Address", "Enter your server here!"), @@ -105,8 +105,8 @@ class IRCInterface(Thread, Hook):          for t in self.getConfig("owner").split():              if t.strip().startswith("#"):                  self.sock.send("JOIN %s\r\n" % t.strip()) -        self.log.info("pyLoad IRC: Connected to %s!" % host) -        self.log.info("pyLoad IRC: Switching to listening mode!") +        self.logInfo("pyLoad IRC: Connected to %s!" % host) +        self.logInfo("pyLoad IRC: Switching to listening mode!")          try:                      self.main_loop() @@ -167,15 +167,15 @@ class IRCInterface(Thread, Hook):          # HANDLE CTCP ANTI FLOOD/BOT PROTECTION          if msg["text"] == "\x01VERSION\x01": -            self.log.debug("Sending CTCP VERSION.") +            self.logDebug("Sending CTCP VERSION.")              self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))              return          elif msg["text"] == "\x01TIME\x01": -            self.log.debug("Sending CTCP TIME.") +            self.logDebug("Sending CTCP TIME.")              self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))              return          elif msg["text"] == "\x01LAG\x01": -            self.log.debug("Received CTCP LAG.") # don't know how to answer +            self.logDebug("Received CTCP LAG.") # don't know how to answer              return          trigger = "pass" @@ -195,7 +195,7 @@ class IRCInterface(Thread, Hook):              for line in res:                  self.response(line, msg["origin"])          except Exception, e: -            self.log.error("pyLoad IRC: "+ repr(e)) +            self.logError("pyLoad IRC: "+ repr(e))      def response(self, msg, origin=""): diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index 02d343096..613e6575a 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -30,7 +30,7 @@ BUFFER_SIZE = 4096  class MergeFiles(Hook):      __name__ = "MergeFiles" -    __version__ = "0.1" +    __version__ = "0.11"      __description__ = "Merges parts splitted with hjsplit"      __config__ = [          ("activated" , "bool" , "Activated"  , "False"), @@ -60,11 +60,11 @@ class MergeFiles(Hook):              download_folder = save_join(download_folder, pack.folder)          for name, file_list in files.iteritems(): -            self.core.log.info("Starting merging of %s" % name) +            self.logInfo("Starting merging of %s" % name)              final_file = open(join(download_folder, fs_encode(name)), "wb")              for splitted_file in file_list: -                self.core.log.debug("Merging part %s" % splitted_file) +                self.logDebug("Merging part %s" % splitted_file)                  pyfile = self.core.files.getFile(fid_dict[splitted_file])                  pyfile.setStatus("processing")                  try: @@ -80,7 +80,7 @@ class MergeFiles(Hook):                          else:                              break                      s_file.close() -                    self.core.log.debug("Finished merging part %s" % splitted_file) +                    self.logDebug("Finished merging part %s" % splitted_file)                  except Exception, e:                      print traceback.print_exc()                  finally: @@ -89,6 +89,6 @@ class MergeFiles(Hook):                      pyfile.release()              final_file.close() -            self.core.log.info("Finished merging of %s" % name) +            self.logInfo("Finished merging of %s" % name) diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index f15148538..ddf8db69f 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -22,7 +22,7 @@ from time import time  class MultiHome(Hook):      __name__ = "MultiHome" -    __version__ = "0.1" +    __version__ = "0.11"      __description__ = """ip address changer"""      __config__ = [ ("activated", "bool", "Activated" , "False"),                     ("interfaces", "str", "Interfaces" , "None") ] @@ -54,7 +54,7 @@ class MultiHome(Hook):              if iface:                  iface.useFor(pluginName, account)                  requestFactory.iface = lambda: iface.adress -                self.log.debug("Multihome: using address: "+iface.adress) +                self.logDebug("Multihome: using address: "+iface.adress)              return oldGetRequest(pluginName, account)          requestFactory.getRequest = getRequest diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 7ca5e5cde..cd9f7ccef 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -5,7 +5,7 @@ from module.plugins.internal.MultiHoster import MultiHoster  class RehostTo(MultiHoster):      __name__ = "RehostTo" -    __version__ = "0.42" +    __version__ = "0.43"      __type__ = "hook"      __config__ = [("activated", "bool", "Activated", "False"), @@ -31,7 +31,7 @@ class RehostTo(MultiHoster):          user = self.account.selectAccount()[0]          if not user: -            self.log.error("Rehost.to: "+ _("Please add your rehost.to account first and restart pyLoad")) +            self.logError("Rehost.to: "+ _("Please add your rehost.to account first and restart pyLoad"))              return          data = self.account.getAccountInfo(user) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index c800b44bf..b30289287 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -29,7 +29,7 @@ from module.plugins.Hook import threaded, Expose, Hook  class UpdateManager(Hook):      __name__ = "UpdateManager" -    __version__ = "0.13" +    __version__ = "0.15"      __description__ = """checks for updates"""      __config__ = [("activated", "bool", "Activated", "True"),          ("interval", "int", "Check interval in minutes", "480"), @@ -70,12 +70,12 @@ class UpdateManager(Hook):          if self.updated and not self.reloaded:              self.info["plugins"] = True -            self.log.info(_("*** Plugins have been updated, please restart pyLoad ***")) +            self.logInfo(_("*** Plugins have been updated, please restart pyLoad ***"))          elif self.updated and self.reloaded: -            self.log.info(_("Plugins updated and reloaded")) +            self.logInfo(_("Plugins updated and reloaded"))              self.updated = False          elif self.version == "None": -            self.log.info(_("No plugin updates available")) +            self.logInfo(_("No plugin updates available"))      @Expose      def recheckForUpdates(self): @@ -92,16 +92,16 @@ class UpdateManager(Hook):                  # Still no updates, plugins will be checked                  if self.version == "None": -                    self.log.info(_("No Updates for pyLoad")) +                    self.logInfo(_("No Updates for pyLoad"))                      return version_check[1:]              self.info["pyload"] = True -            self.log.info(_("***  New pyLoad Version %s available  ***") % self.version) -            self.log.info(_("***  Get it here: http://pyload.org/download  ***")) +            self.logInfo(_("***  New pyLoad Version %s available  ***") % self.version) +            self.logInfo(_("***  Get it here: http://pyload.org/download  ***"))          except: -            self.log.warning(_("Not able to connect server for updates")) +            self.logWarning(_("Not able to connect server for updates"))          return None # Nothing will be done @@ -145,7 +145,7 @@ class UpdateManager(Hook):              if name in IGNORE or (type, name) in IGNORE:                  continue -            self.log.info(_("New version of %(type)s|%(name)s : %(version).2f") % { +            self.logInfo(_("New version of %(type)s|%(name)s : %(version).2f") % {                  "type": type,                  "name": name,                  "version": float(version) diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index a96adf524..13a5aaadd 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -28,7 +28,7 @@ from module.plugins.hooks.IRCInterface import IRCInterface  class XMPPInterface(IRCInterface, JabberClient):      __name__ = "XMPPInterface" -    __version__ = "0.1" +    __version__ = "0.11"      __description__ = """connect to jabber and let owner perform different tasks"""      __config__ = [("activated", "bool", "Activated", "False"),              ("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"), @@ -97,22 +97,22 @@ class XMPPInterface(IRCInterface, JabberClient):          try:              self.loop()          except Exception, ex: -            self.core.log.error("pyLoad XMPP: %s" % str(ex)) +            self.logError("pyLoad XMPP: %s" % str(ex))      def stream_state_changed(self, state, arg):          """This one is called when the state of stream connecting the component          to a server changes. This will usually be used to let the user          know what is going on.""" -        self.log.debug("pyLoad XMPP: *** State changed: %s %r ***" % (state, arg)) +        self.logDebug("pyLoad XMPP: *** State changed: %s %r ***" % (state, arg))      def disconnected(self): -        self.log.debug("pyLoad XMPP: Client was disconnected") +        self.logDebug("pyLoad XMPP: Client was disconnected")      def stream_closed(self, stream): -        self.log.debug("pyLoad XMPP: Stream was closed | %s" % stream) +        self.logDebug("pyLoad XMPP: Stream was closed | %s" % stream)      def stream_error(self, err): -        self.log.debug("pyLoad XMPP: Stream Error: %s" % err) +        self.logDebug("pyLoad XMPP: Stream Error: %s" % err)      def get_message_handlers(self):          """Return list of (message_type, message_handler) tuples. @@ -128,8 +128,8 @@ class XMPPInterface(IRCInterface, JabberClient):          subject = stanza.get_subject()          body = stanza.get_body()          t = stanza.get_type() -        self.log.debug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(), ))) -        self.log.debug(u'pyLoad XMPP: Body: %s Subject: %s Type: %s' % (body, subject, t)) +        self.logDebug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(), ))) +        self.logDebug(u'pyLoad XMPP: Body: %s Subject: %s Type: %s' % (body, subject, t))          if t == "headline":              # 'headline' messages should never be replied to @@ -173,7 +173,7 @@ class XMPPInterface(IRCInterface, JabberClient):                      messages.append(m)              except Exception, e: -                self.log.error("pyLoad XMPP: " + repr(e)) +                self.logError("pyLoad XMPP: " + repr(e))              return messages @@ -186,7 +186,7 @@ class XMPPInterface(IRCInterface, JabberClient):      def announce(self, message):          """ send message to all owners"""          for user in self.getConfig("owners").split(";"): -            self.log.debug("pyLoad XMPP: Send message to %s" % user) +            self.logDebug("pyLoad XMPP: Send message to %s" % user)              to_jid = JID(user) | 
