summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/TransmissionRPC.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-19 04:48:07 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-19 04:48:07 +0200
commitffd38f027ed103f7b39ec78c6af0d182774950a4 (patch)
treee6d88b064a38bb44932674f32ac602efc786468b /module/plugins/hooks/TransmissionRPC.py
parentMerge pull request #2054 from GammaC0de/patch-1 (diff)
downloadpyload-ffd38f027ed103f7b39ec78c6af0d182774950a4.tar.xz
Spare fixes
Diffstat (limited to 'module/plugins/hooks/TransmissionRPC.py')
-rw-r--r--module/plugins/hooks/TransmissionRPC.py41
1 files changed, 18 insertions, 23 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)