From c9185eebb4522a01a565ae0a9df271ca95e86794 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 22 Mar 2020 19:47:18 -0400 Subject: [PATCH] Update update.py --- root/scripts/update.py | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/root/scripts/update.py b/root/scripts/update.py index 46bb3e8..a66c06a 100644 --- a/root/scripts/update.py +++ b/root/scripts/update.py @@ -6,36 +6,10 @@ import logging import configparser import xml.etree.ElementTree as ET -xml = "/config/config.xml" autoProcess = os.path.join(os.environ.get("SMA_PATH", "/usr/local/sma"), "config/autoProcess.ini") - def main(): - if not os.path.isfile(xml): - logging.error("No Sonarr/Radarr config file found") - sys.exit(1) - - if not os.path.isfile(autoProcess): - logging.error("autoProcess.ini does not exist") - sys.exit(1) - - tree = ET.parse(xml) - root = tree.getroot() - port = root.find("Port").text - try: - sslport = root.find("SslPort").text - except: - sslport = port - webroot = root.find("UrlBase").text - webroot = webroot if webroot else "" - ssl = root.find("EnableSsl").text - ssl = ssl.lower() in ["true", "yes", "t", "1", "y"] if ssl else False - apikey = root.find("ApiKey").text - section = os.environ.get("SMA_APP") - if not section: - logging.error("No Sonarr/Radarr specifying ENV variable") - sys.exit(1) - + safeConfigParser = configparser.ConfigParser() safeConfigParser.read(autoProcess) @@ -177,19 +151,6 @@ def main(): if os.environ.get("PLEX_TOKEN"): safeConfigParser.set("Plex", "token", os.environ.get("PLEX_TOKEN")) - # Set values from config.xml - safeConfigParser.set(section, "apikey", apikey) - safeConfigParser.set(section, "ssl", str(ssl)) - safeConfigParser.set(section, "port", sslport if ssl else port) - safeConfigParser.set(section, "webroot", webroot) - - # Set IP from environment variable - ip = os.environ.get("HOST") - if ip: - safeConfigParser.set(section, "host", ip) - else: - safeConfigParser.set(section, "host", "127.0.0.1") - fp = open(autoProcess, "w") safeConfigParser.write(fp) fp.close()