diff --git a/kodi-nfo-feeder.py b/kodi-nfo-feeder.py index 572ba53..64450dd 100644 --- a/kodi-nfo-feeder.py +++ b/kodi-nfo-feeder.py @@ -1,5 +1,7 @@ +import json import os import logging +import subprocess import sys import time import re @@ -449,3 +451,16 @@ if __name__ == '__main__': nfo, file_moved_to_target_dir, output_dir) + + run_cmd = config.get(section_name, "run_cmd") if config.has_option(section_name, "run_cmd") else False + if run_cmd: + log.debug(f"Executing post-move command: {run_cmd} ...") + run_cmd_result = subprocess.getstatusoutput(run_cmd) + run_cmd_exit_code = run_cmd_result[0] + run_cmd_output = run_cmd_result[1] + if run_cmd_exit_code != 0: + log.warning(f"Post-move command failed with exit code {run_cmd_exit_code}:\n" + f"{run_cmd_output}") + + if config.has_option(section_name, "kodi_jsonrpc_address"): + kodi_library_update(section_name, config) \ No newline at end of file