From 3eb91d535259efe2c518a2e77bc36af8f3ca8553 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Thu, 29 Nov 2018 12:42:10 -0600 Subject: [PATCH] changed to seconds instead of minutes --- Varken/iniparser.py | 14 +++++++++----- Varken/varken.example.ini | 12 +++++++----- Varken/varken.py | 7 ++++--- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Varken/iniparser.py b/Varken/iniparser.py index 0ea8098..9b24d4c 100644 --- a/Varken/iniparser.py +++ b/Varken/iniparser.py @@ -3,6 +3,7 @@ import configparser from Varken.helpers import Server, TautulliServer, SonarrServer, InfluxServer + class INIParser(object): def __init__(self): self.config = configparser.ConfigParser() @@ -61,21 +62,24 @@ class INIParser(object): queue = self.config.getboolean(sonarr_section, 'queue') missing_days = self.config.getint(sonarr_section, 'missing_days') future_days = self.config.getint(sonarr_section, 'future_days') - missing_days_run_minutes = self.config.getint(sonarr_section, 'missing_days_run_minutes') - future_days_run_minutes = self.config.getint(sonarr_section, 'future_days_run_minutes') - queue_run_minutes = self.config.getint(sonarr_section, 'queue_run_minutes') + missing_days_run_seconds = self.config.getint(sonarr_section, 'missing_days_run_seconds') + future_days_run_seconds = self.config.getint(sonarr_section, 'future_days_run_seconds') + queue_run_seconds = self.config.getint(sonarr_section, 'queue_run_seconds') self.sonarr_servers.append(SonarrServer(server_id, scheme + url, apikey, verify_ssl, missing_days, - missing_days_run_minutes, future_days, - future_days_run_minutes, queue, queue_run_minutes)) + missing_days_run_seconds, future_days, + future_days_run_seconds, queue, queue_run_seconds)) # Parse Radarr options try: if not self.config.getboolean('global', 'radarr_server_ids'): sys.exit('radarr_server_ids must be either false, or a comma-separated list of server ids') + elif self.config.getint('global', 'radarr_server_ids'): + self.radarr_enabled = True except ValueError: self.radarr_enabled = True sids = self.config.get('global', 'radarr_server_ids').strip(' ').split(',') + for server_id in sids: radarr_section = 'radarr-' + server_id url = self.config.get(radarr_section, 'url') diff --git a/Varken/varken.example.ini b/Varken/varken.example.ini index e3022ed..10b7c70 100644 --- a/Varken/varken.example.ini +++ b/Varken/varken.example.ini @@ -2,7 +2,7 @@ # - Sonarr + Radarr scripts support multiple servers. You can remove the second # server by putting a # in front of the lines and section name, and removing # that number from your server_ids list -# - tautulli_failback_ip, This is used when there is no IP listed in tautulli. +# - fallback_ip, This is used when there is no IP listed in tautulli. # This can happen when you are streaming locally. This is usually your public IP. [global] @@ -24,11 +24,11 @@ apikey = xxxxxxxxxxxxxxxx ssl = false verify_ssl = true missing_days = 7 -missing_days_run_minutes = 30 +missing_days_run_seconds = 300 future_days = 1 -future_days_run_minutes = 30 +future_days_run_seconds = 300 queue = true -queue_run_minutes = 1 +queue_run_seconds = 300 [sonarr-2] url = sonarr2.domain.tld @@ -36,8 +36,11 @@ apikey = yyyyyyyyyyyyyyyy ssl = false verify_ssl = true missing_days = 7 +missing_days_run_seconds = 300 future_days = 1 +future_days_run_seconds = 300 queue = true +queue_run_seconds = 300 [radarr-1] url = radarr1.domain.tld @@ -63,7 +66,6 @@ fallback_ip = 0.0.0.0 apikey = xxxxxxxxxxxxxxxx ssl = false verify_ssl = true -influx_db = plex [asa] url = firewall.domain.tld diff --git a/Varken/varken.py b/Varken/varken.py index 2212e48..c6e9349 100644 --- a/Varken/varken.py +++ b/Varken/varken.py @@ -10,6 +10,7 @@ def threaded(job, days=None): thread = threading.Thread(target=job, args=([days])) thread.start() + if __name__ == "__main__": CONFIG = INIParser() @@ -18,12 +19,12 @@ if __name__ == "__main__": for server in CONFIG.sonarr_servers: if server.queue: - schedule.every(server.queue_run_minutes).minutes.do(threaded, SONARR.get_queue) + schedule.every(server.queue_run_seconds).seconds.do(threaded, SONARR.get_queue) if server.missing_days > 0: - schedule.every(server.missing_days_run_minutes).minutes.do(threaded, SONARR.get_missing, + schedule.every(server.missing_days_run_seconds).seconds.do(threaded, SONARR.get_missing, server.missing_days) if server.future_days > 0: - schedule.every(server.future_days_run_minutes).minutes.do(threaded, SONARR.get_future, + schedule.every(server.future_days_run_seconds).seconds.do(threaded, SONARR.get_future, server.future_days) while True: