This commit is contained in:
deathbybandaid 2023-01-06 13:55:27 -05:00
parent 9e6ae6179a
commit 25d1e24b46

View File

@ -4,24 +4,25 @@ import os
import sys
import requests
SCRIPT_PATH = os.path.realpath(__file__)
SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
script_settings = {
"tdarr": {
"url": "http://tdarr-server1.ipa.dbb:8265/api/v2/scan-files",
"dbID": "fGxwT-ws7"
},
"logging": {
"logfile": True,
"log_file": True,
"log_file_path": os.path.join(SCRIPT_DIR, "log.log"),
"output_level": 1
}
}
def loggit(logtext):
if script_settings["logging"]["logfile"]:
SCRIPT_PATH = os.path.realpath(__file__)
SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
log_file = os.path.join(SCRIPT_DIR, "testlog.log")
with open(log_file, 'a') as logwrite:
if script_settings["logging"]["log_file"]:
with open(script_settings["logging"]["log_file_path"], 'a') as logwrite:
logwrite.write(logtext)
if script_settings["logging"]["output_level"]:
sys.stderr.write(logtext)