define scgi uris in config

This commit is contained in:
iou1name 2019-10-23 12:41:24 -04:00
parent b43038cf18
commit 3f1d8c4ae4
2 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,11 @@
""" """
Configuation settings for Aberrant. Configuation settings for Aberrant.
""" """
rtorrents = [
'scgi://localhost:5000',
'scgi://localhost:5001',
]
prefix = '/aberrant' prefix = '/aberrant'
buckler = { buckler = {
'url': "http://192.168.1.100:5400/buckler", 'url': "http://192.168.1.100:5400/buckler",

View File

@ -7,12 +7,12 @@ import time
import threading import threading
from collections import defaultdict from collections import defaultdict
import config
import rtorrent_xmlrpc import rtorrent_xmlrpc
NUM_INST = 10
WATCH_HANDLE = None WATCH_HANDLE = None
sp = [] sp = []
torrents = [[]] * NUM_INST torrents = [[]] * len(config.rtorrent_insts)
class Torrent: class Torrent:
def __init__(self, raw, rt_id): def __init__(self, raw, rt_id):
@ -70,7 +70,7 @@ class Watch(threading.Thread):
def run(self): def run(self):
global torrents global torrents
while not self.stopped(): while not self.stopped():
for n in range(NUM_INST): for n in range(len(torrents)):
if self.stopped(): if self.stopped():
break break
torrents[n] = get_all(n) torrents[n] = get_all(n)
@ -147,8 +147,8 @@ def init():
"""Initializes the rTorrent interface.""" """Initializes the rTorrent interface."""
global WATCH_HANDLE global WATCH_HANDLE
global sp global sp
for n in range(NUM_INST): for rt_port in config.rtorrent_insts:
s = rtorrent_xmlrpc.SCGIServerProxy(f"scgi://localhost:500{n}") s = rtorrent_xmlrpc.SCGIServerProxy(rt_port)
sp.append(s) sp.append(s)
WATCH_HANDLE = Watch() WATCH_HANDLE = Watch()
WATCH_HANDLE.start() WATCH_HANDLE.start()