diff --git a/config.py.template b/config.py.template index e6e45bd..5defdb3 100644 --- a/config.py.template +++ b/config.py.template @@ -2,6 +2,11 @@ """ Configuation settings for Aberrant. """ +rtorrents = [ + 'scgi://localhost:5000', + 'scgi://localhost:5001', +] + prefix = '/aberrant' buckler = { 'url': "http://192.168.1.100:5400/buckler", diff --git a/rtorrent.py b/rtorrent.py index 9fae398..a2f9734 100644 --- a/rtorrent.py +++ b/rtorrent.py @@ -7,12 +7,12 @@ import time import threading from collections import defaultdict +import config import rtorrent_xmlrpc -NUM_INST = 10 WATCH_HANDLE = None sp = [] -torrents = [[]] * NUM_INST +torrents = [[]] * len(config.rtorrent_insts) class Torrent: def __init__(self, raw, rt_id): @@ -70,7 +70,7 @@ class Watch(threading.Thread): def run(self): global torrents while not self.stopped(): - for n in range(NUM_INST): + for n in range(len(torrents)): if self.stopped(): break torrents[n] = get_all(n) @@ -147,8 +147,8 @@ def init(): """Initializes the rTorrent interface.""" global WATCH_HANDLE global sp - for n in range(NUM_INST): - s = rtorrent_xmlrpc.SCGIServerProxy(f"scgi://localhost:500{n}") + for rt_port in config.rtorrent_insts: + s = rtorrent_xmlrpc.SCGIServerProxy(rt_port) sp.append(s) WATCH_HANDLE = Watch() WATCH_HANDLE.start()