Run arbitrary command after file's been put in place
This commit is contained in:
parent
318e29da85
commit
1de24ee2d1
@ -1,5 +1,7 @@
|
|||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
@ -449,3 +451,16 @@ if __name__ == '__main__':
|
|||||||
nfo,
|
nfo,
|
||||||
file_moved_to_target_dir,
|
file_moved_to_target_dir,
|
||||||
output_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)
|
Loading…
x
Reference in New Issue
Block a user