From 62f294a51dc4de81713e34d511677a014d36b1b7 Mon Sep 17 00:00:00 2001 From: Quentin Date: Sat, 11 Jan 2014 13:19:15 +0100 Subject: [PATCH] The transmission url detection now : - is executed only if the url is not already ending with rpc - detects ports up to 6 digits long (changed from 4) --- headphones/transmission.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/headphones/transmission.py b/headphones/transmission.py index 72b60ff1..f0b477e3 100644 --- a/headphones/transmission.py +++ b/headphones/transmission.py @@ -85,10 +85,12 @@ def torrentAction(method, arguments): if host.endswith('/'): host = host[:-1] - if host.endswith(':\d{2,4}'): - host = host + "/transmission/rpc" - else - host = host + "/rpc" + if not host.endswith('/rpc'): + if host.endswith(':\d{2,6}'): + host = host + "/transmission/rpc" + else: + host = host + "/rpc" + request = urllib2.Request(host) if username and password: base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')