diff options
author | 2015-10-19 04:48:07 +0200 | |
---|---|---|
committer | 2015-10-19 04:48:07 +0200 | |
commit | ffd38f027ed103f7b39ec78c6af0d182774950a4 (patch) | |
tree | e6d88b064a38bb44932674f32ac602efc786468b /module/plugins/hooks | |
parent | Merge pull request #2054 from GammaC0de/patch-1 (diff) | |
download | pyload-ffd38f027ed103f7b39ec78c6af0d182774950a4.tar.xz |
Spare fixes
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/TransmissionRPC.py | 41 | ||||
-rw-r--r-- | module/plugins/hooks/UpdateManager.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/XFileSharing.py (renamed from module/plugins/hooks/XFileSharingPro.py) | 18 |
3 files changed, 28 insertions, 33 deletions
diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index fa19a5f91..7d166ef20 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -14,7 +14,7 @@ from module.plugins.internal.Addon import Addon class TransmissionRPC(Addon): __name__ = "TransmissionRPC" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r"https?://.+\.torrent|magnet:\?.+" @@ -52,29 +52,24 @@ class TransmissionRPC(Addon): 'tag' : client_request_id}), req=req) - except BadHeader, e: - if e.code == 409: - headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", req.header)) - session_id = headers['X-Transmission-Session-Id'] - req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) - try: - response = self.load(transmission_rpc_url, - post=json.dumps({'arguments': {'filename': url}, - 'method' : 'torrent-add', - 'tag' : client_request_id}), - req=req) - - except Exception, e: - self.log_error(e, trace=True) - return - - else: - self.log_error(e, trace=True) - return - except Exception, e: - self.log_error(e, trace=True) + self.log_error(e) return + + if req.code == 409: + headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", req.header)) + session_id = headers['X-Transmission-Session-Id'] + req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) + try: + response = self.load(transmission_rpc_url, + post=json.dumps({'arguments': {'filename': url}, + 'method' : 'torrent-add', + 'tag' : client_request_id}), + req=req) + + except Exception, e: + self.log_error(e) + return try: res = json.loads(response) @@ -82,4 +77,4 @@ class TransmissionRPC(Addon): self.log_debug("Result: %s" % res['result']) except Exception, e: - self.log_error(e, trace=True) + self.log_error(e) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 24b05ba22..b2f5c9648 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -361,7 +361,7 @@ class UpdateManager(Addon): os.remove(filename) except OSError, e: - self.log_warning(_("Error removing: %s") % filename, e) + self.log_warning(_("Error removing `%s`") % filename, e) else: id = (type, name) diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharing.py index 75f8323ef..50068fc72 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharing.py @@ -5,8 +5,8 @@ import re from module.plugins.internal.Addon import Addon -class XFileSharingPro(Addon): - __name__ = "XFileSharingPro" +class XFileSharing(Addon): + __name__ = "XFileSharing" __type__ = "hook" __version__ = "0.46" __status__ = "testing" @@ -18,7 +18,7 @@ class XFileSharingPro(Addon): ("hoster_list" , "str" , "Hoster list (comma separated)" , "" ), ("crypter_list" , "str" , "Crypter list (comma separated)", "" )] - __description__ = """Load XFileSharingPro based hosters and crypters which don't need a own plugin to run""" + __description__ = """Load XFileSharing based hosters and crypters which don't need a own plugin to run""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] @@ -53,8 +53,8 @@ class XFileSharingPro(Addon): def load_pattern(self): use_builtin_list = self.get_config('use_builtin_list') - for type, plugin in (("hoster", "XFileSharingPro"), - ("crypter", "XFileSharingProFolder")): + for type, plugin in (("hoster", "XFileSharing"), + ("crypter", "XFileSharingFolder")): every_plugin = not self.get_config("use_%s_list" % type) if every_plugin: @@ -99,14 +99,14 @@ class XFileSharingPro(Addon): def deactivate(self): # self.unload_hoster("BasePlugin") - for type, plugin in (("hoster", "XFileSharingPro"), - ("crypter", "XFileSharingProFolder")): + for type, plugin in (("hoster", "XFileSharing"), + ("crypter", "XFileSharingFolder")): self._unload(type, plugin) def unload_hoster(self, hoster): hdict = self.pyload.pluginManager.hosterPlugins[hoster] - if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro": + if "new_name" in hdict and hdict['new_name'] == "XFileSharing": if "module" in hdict: hdict.pop('module', None) @@ -124,5 +124,5 @@ class XFileSharingPro(Addon): # and pyfile.hasStatus("failed") \ # and not self.get_config('use_hoster_list') \ # and self.unload_hoster("BasePlugin"): - # self.log_debug("Unloaded XFileSharingPro from BasePlugin") + # self.log_debug("Unloaded XFileSharing from BasePlugin") # pyfile.setStatus("queued") |