diff --git a/backends/transmission.py b/backends/transmission.py index fbc2d26..972dc01 100644 --- a/backends/transmission.py +++ b/backends/transmission.py @@ -4,14 +4,15 @@ class Client: """Handles connection to torrent client.""" - def __init__(self, host, port): + def __init__(self, config): """Creates new torrent client connection. Args: host (str): Hostname or IP address where client is litening. port (int): Port where client is listening. """ - self.transmission = transmissionrpc.Client(host, port) + self.transmission = transmissionrpc.Client(config['host'], + config['port']) def add_torrent(self, torrent, timeout=None, **kwargs): return Torrent(self.transmission.add_torrent(torrent, timeout, **kwargs)) diff --git a/tdpt.py b/tdpt.py index 4912c8d..cb2d7a8 100644 --- a/tdpt.py +++ b/tdpt.py @@ -149,8 +149,7 @@ def main(): backend_name = CONFIG.get('General', 'backend') backend = importlib.import_module('backends.' + backend_name.lower()) - client = backend.Client(CONFIG.get(backend_name, 'host'), - CONFIG.get(backend_name, 'port')) + client = backend.Client(CONFIG[backend_name]) init_polling(client) torrents_tracked = set()