test
This commit is contained in:
parent
bd4320caf2
commit
4507b0aa67
@ -20,11 +20,11 @@ script_settings = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def loggit(logtext):
|
def loggit(logtext, force_err=False):
|
||||||
if script_settings["logging"]["log_file"]:
|
if script_settings["logging"]["log_file"]:
|
||||||
with open(script_settings["logging"]["log_file_path"], 'a') as logwrite:
|
with open(script_settings["logging"]["log_file_path"], 'a') as logwrite:
|
||||||
logwrite.write(logtext)
|
logwrite.write(logtext)
|
||||||
if script_settings["logging"]["output_level"]:
|
if script_settings["logging"]["output_level"] or force_err:
|
||||||
sys.stderr.write(logtext)
|
sys.stderr.write(logtext)
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(logtext)
|
sys.stdout.write(logtext)
|
||||||
@ -47,10 +47,12 @@ def main():
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
elif arr_event_type not in ["Download", "Rename"]:
|
elif arr_event_type not in ["Download", "Rename"]:
|
||||||
raise Exception("%s is not a supported tdarr_inform Event." % arr_event_type)
|
loggit("%s is not a supported tdarr_inform Event." % arr_event_type, True)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
if arr_file_path_key not in os.environ:
|
if arr_file_path_key not in os.environ:
|
||||||
raise Exception("%s Environment variable was missing." % arr_file_path_key)
|
loggit("%s Environment variable was missing." % arr_file_path_key, True)
|
||||||
|
sys.exit(1)
|
||||||
arr_file_path = os.environ[arr_file_path_key]
|
arr_file_path = os.environ[arr_file_path_key]
|
||||||
|
|
||||||
loggit("Preparing payload to POST to tdarr API\n" % sys.argv)
|
loggit("Preparing payload to POST to tdarr API\n" % sys.argv)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user