Код: Выделить всё
import os
import subprocess
# Specify the export path and file format
export_path = "C:\\Users\\lords\\Videos\\MCOC Videos\\"
#file_prefix = project.GetName()
file_prefix = "Untitled Project 2"
file_format = "jpg"
filepath = os.path.join(export_path, file_prefix + "." + file_format)
cmd = [
"tageditor-cli",
f'set cover="{filepath}"',
f'-f "{os.path.join(export_path, file_prefix)}.mp4"'
]
#cmd = f"tageditor-cli set cover=\"{filepath}\" -f \"{os.path.join(export_path, file_prefix)}.mp4\""
try:
result = subprocess.run(
cmd,
capture_output=True,
timeout=10,
check=True
)
print(result.stdout)
except subprocess.TimeoutExpired:
print("The command timed out.")
except subprocess.CalledProcessError as e:
print(f"Command failed with exit code {e.returncode} {e.stderr}")
Код: Выделить всё
['tageditor-cli', "set cover'=C:\\Users\\lords\\Videos\\MCOC Videos\\Untitled Project 2.jpg'", '-f %C:\\Users\\lords\\Videos\\MCOC Videos\\Untitled Project 2.mp4%']
Код: Выделить всё
Command failed with exit code 1 b'Error: Unable to parse arguments: The argument "file" mustn\'t be specified more than 1 time.\r\nSee --help for available commands.\r\n'
Редактировать: просмотрев аналогичный пост, я попробовал это:
Код: Выделить всё
cmd = [
"tageditor-cli",
'set',
'cover=',
str('"' + shlex.quote(filepath) + '"'),
'-f',
str(shlex.quote(export_path + file_prefix + ".mp4"))
Мобильная версия