mirror of
https://github.com/rembo10/headphones.git
synced 2026-09-10 00:32:52 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e879af6b0e | ||
|
|
70eadcd330 | ||
|
|
ae9c1042cf | ||
|
|
d51cdca1d8 |
@@ -85,11 +85,23 @@ def torrentAction(method, arguments):
|
|||||||
if host.endswith('/'):
|
if host.endswith('/'):
|
||||||
host = host[:-1]
|
host = host[:-1]
|
||||||
|
|
||||||
|
# Either the host ends with a port, or some directory, or rpc
|
||||||
|
# If it ends with /rpc we don't have to do anything
|
||||||
|
# If it ends with a port we add /transmission/rpc
|
||||||
|
# anything else we just add rpc
|
||||||
if not host.endswith('/rpc'):
|
if not host.endswith('/rpc'):
|
||||||
if host.endswith(':\d{2,6}'):
|
# Check if it ends in a port number
|
||||||
host = host + "/transmission/rpc"
|
i = host.rfind(':')
|
||||||
|
if i >= 0:
|
||||||
|
possible_port = host[i+1:]
|
||||||
|
try:
|
||||||
|
port = int(possible_port)
|
||||||
|
host = host + "/transmission/rpc"
|
||||||
|
except ValueError:
|
||||||
|
host = host + "/rpc"
|
||||||
else:
|
else:
|
||||||
host = host + "/rpc"
|
logger.error('Transmission port missing')
|
||||||
|
return
|
||||||
|
|
||||||
request = urllib2.Request(host)
|
request = urllib2.Request(host)
|
||||||
if username and password:
|
if username and password:
|
||||||
|
|||||||
Reference in New Issue
Block a user