Always reconnect Transmission. fix #3631

This commit is contained in:
Ruud
2014-07-17 23:58:51 +02:00
parent 324920cd8c
commit cd0afd20e5
+3 -6
View File
@@ -23,17 +23,14 @@ class Transmission(DownloaderBase):
log = CPLog(__name__) log = CPLog(__name__)
trpc = None trpc = None
def connect(self, reconnect = False): def connect(self):
# Load host from config and split out port. # Load host from config and split out port.
host = cleanHost(self.conf('host'), protocol = False).split(':') host = cleanHost(self.conf('host'), protocol = False).split(':')
if not isInt(host[1]): if not isInt(host[1]):
log.error('Config properties are not filled in correctly, port is missing.') log.error('Config properties are not filled in correctly, port is missing.')
return False return False
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'))
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 download(self, data = None, media = None, filedata = None): def download(self, data = None, media = None, filedata = None):
if not media: media = {} if not media: media = {}
@@ -88,7 +85,7 @@ class Transmission(DownloaderBase):
return self.downloadReturnId(remote_torrent['torrent-added']['hashString']) return self.downloadReturnId(remote_torrent['torrent-added']['hashString'])
def test(self): def test(self):
if self.connect(True) and self.trpc.get_session(): if self.connect() and self.trpc.get_session():
return True return True
return False return False