Not sure why. I can make the script work outside SAB, but once SAB triggers this script I get the error.
Any pointers in the right direction would be much appreciated.
Code: Select all
#!/usr/bin/env python3
import os
import sys
import subprocess
for i,file in enumerate(os.listdir(os.environ['SAB_COMPLETE_DIR'])):
if file.endswith(".mkv"):
file = os.path.basename(file)
result = subprocess.run(
["mkvmerge", "--identify", "--identification-format", "json", str(file)],
capture_output=True,
shell=False,
encoding="utf-8",
)
if result.returncode != 0:
print(f"Error in mkvmerge while parsing: {file}")
print(result.stdout.strip()) # Show the actual error (it's in stdout).
exit(1)
sys.exit(0)
Code: Select all
Error in mkvmerge while parsing: Some.Show.S06E12.HDTV.x264-CRiMSON.mkv
{
"errors": [
"The file 'Some.Show.S06E12.HDTV.x264-CRiMSON.mkv' could not be opened for reading: open file error.\n"
],
"warnings": []
}