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.
"""
rtorrents = [
'scgi://localhost:5000',
'scgi://localhost:5001',
]
prefix = '/aberrant'
buckler = {
'url': "http://192.168.1.100:5400/buckler",

View File

@ -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()