Fixed 'connection test' for Transmission and Sabnzbd

This commit is contained in:
mikke89
2014-01-26 18:17:23 +01:00
parent f20cce0176
commit ebc5a66375
2 changed files with 4 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ class Sabnzbd(Downloader):
def test(self):
try:
sab_data = self.call({
'mode': 'version',
'mode': 'qstatus',
})
except:
return False

View File

@@ -20,20 +20,20 @@ class Transmission(Downloader):
trpc = None
testable = True
def connect(self):
def connect(self, reconnect = True):
# Load host from config and split out port.
host = cleanHost(self.conf('host'), protocol = False).split(':')
if not isInt(host[1]):
log.error('Config properties are not filled in correctly, port is missing.')
return False
if not (self.trpc and self.trpc.get_session()):
if not self.trpc or reconnect:
self.trpc = TransmissionRPC(host[0], port = host[1], rpc_url = self.conf('rpc_url').strip('/ '), username = self.conf('username'), password = self.conf('password'))
return self.trpc
def test(self):
if self.connect() and self.trpc.get_session():
if self.connect(True) and self.trpc.get_session():
return True
return False