passed influx_seraver to sonarrapi class

This commit is contained in:
Nicholas St. Germain 2018-11-28 22:26:00 -06:00
parent 01370d92dc
commit 7910efc641
2 changed files with 5 additions and 6 deletions

View file

@ -6,19 +6,18 @@ import argparse
from influxdb import InfluxDBClient
from datetime import datetime, timezone, date, timedelta
from Varken import configuration as config
from Varken.helpers import TVShow, Queue
class SonarrAPI(object):
def __init__(self, servers):
def __init__(self, sonarr_servers, influx_server):
# Set Time of initialization
self.now = datetime.now(timezone.utc).astimezone().isoformat()
self.today = str(date.today())
self.influx = InfluxDBClient(config.influxdb_url, config.influxdb_port, config.influxdb_username,
config.influxdb_password, config.sonarr_influxdb_db_name)
self.influx = InfluxDBClient(influx_server.url, influx_server.port, influx_server.username,
influx_server.password, 'plex')
self.influx_payload = []
self.servers = servers
self.servers = sonarr_servers
# Create session to reduce server web thread load, and globally define pageSize for all requests
self.session = requests.Session()
self.session.params = {'pageSize': 1000}

View file

@ -25,7 +25,7 @@ if __name__ == "__main__":
CONFIG = INIParser()
if CONFIG.sonarr_enabled:
SONARR = SonarrAPI(CONFIG.sonarr_servers)
SONARR = SonarrAPI(CONFIG.sonarr_servers, CONFIG.influx_server)
for server in CONFIG.sonarr_servers:
if server.queue:
schedule.every().minute.do(threaded, SONARR.get_queue)