diff --git a/Varken/sonarr.py b/Varken/sonarr.py index 22eaeb8..0ba4dcf 100644 --- a/Varken/sonarr.py +++ b/Varken/sonarr.py @@ -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} diff --git a/Varken/varken.py b/Varken/varken.py index 4569f95..1b9dac4 100644 --- a/Varken/varken.py +++ b/Varken/varken.py @@ -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)