mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
use 'path_to_subprocess_arg' in subprocess paths definitions
This commit is contained in:
parent
3d9970aa4f
commit
628e9df784
4 changed files with 38 additions and 19 deletions
|
|
@ -6,6 +6,7 @@ from openpype.lib import (
|
|||
|
||||
run_subprocess,
|
||||
split_command_to_list,
|
||||
path_to_subprocess_arg,
|
||||
|
||||
should_decompress,
|
||||
get_decompress_dir,
|
||||
|
|
@ -95,13 +96,15 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
|
|||
ffmpeg_args = self.ffmpeg_args or {}
|
||||
|
||||
jpeg_items = []
|
||||
jpeg_items.append("\"{}\"".format(ffmpeg_path))
|
||||
jpeg_items.append(path_to_subprocess_arg(ffmpeg_path))
|
||||
# override file if already exists
|
||||
jpeg_items.append("-y")
|
||||
# use same input args like with mov
|
||||
jpeg_items.extend(ffmpeg_args.get("input") or [])
|
||||
# input file
|
||||
jpeg_items.append("-i \"{}\"".format(full_input_path))
|
||||
jpeg_items.append("-i {}".format(
|
||||
path_to_subprocess_arg(full_input_path)
|
||||
))
|
||||
# output arguments from presets
|
||||
jpeg_items.extend(ffmpeg_args.get("output") or [])
|
||||
|
||||
|
|
@ -110,7 +113,7 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
|
|||
jpeg_items.append("-vframes 1")
|
||||
|
||||
# output file
|
||||
jpeg_items.append("\"{}\"".format(full_output_path))
|
||||
jpeg_items.append(path_to_subprocess_arg(full_output_path))
|
||||
|
||||
subprocess_command = " ".join(jpeg_items)
|
||||
subprocess_args = split_command_to_list(subprocess_command)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import pyblish
|
|||
import openpype.api
|
||||
from openpype.lib import (
|
||||
get_ffmpeg_tool_path,
|
||||
split_command_to_list
|
||||
split_command_to_list,
|
||||
path_to_subprocess_arg
|
||||
)
|
||||
import tempfile
|
||||
import opentimelineio as otio
|
||||
|
|
@ -57,9 +58,9 @@ class ExtractOtioAudioTracks(pyblish.api.ContextPlugin):
|
|||
audio_inputs.insert(0, empty)
|
||||
|
||||
# create cmd
|
||||
cmd = '"{}"'.format(self.ffmpeg_path) + " "
|
||||
cmd = path_to_subprocess_arg(self.ffmpeg_path) + " "
|
||||
cmd += self.create_cmd(audio_inputs)
|
||||
cmd += "\"{}\"".format(audio_temp_fpath)
|
||||
cmd += path_to_subprocess_arg(audio_temp_fpath)
|
||||
|
||||
# Split command to list for subprocess
|
||||
cmd_list = split_command_to_list(cmd)
|
||||
|
|
@ -265,10 +266,14 @@ class ExtractOtioAudioTracks(pyblish.api.ContextPlugin):
|
|||
for index, input in enumerate(inputs):
|
||||
input_format = input.copy()
|
||||
input_format.update({"i": index})
|
||||
input_format["mediaPath"] = path_to_subprocess_arg(
|
||||
input_format["mediaPath"]
|
||||
)
|
||||
|
||||
_inputs += (
|
||||
"-ss {startSec} "
|
||||
"-t {durationSec} "
|
||||
"-i \"{mediaPath}\" "
|
||||
"-i {mediaPath} "
|
||||
).format(**input_format)
|
||||
|
||||
_filters += "[{i}]adelay={delayMilSec}:all=1[r{i}]; ".format(
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from openpype.lib import (
|
|||
ffprobe_streams,
|
||||
|
||||
split_command_to_list,
|
||||
path_to_subprocess_arg,
|
||||
|
||||
should_decompress,
|
||||
get_decompress_dir,
|
||||
|
|
@ -486,7 +487,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
|
||||
# Add video/image input path
|
||||
ffmpeg_input_args.append(
|
||||
"-i \"{}\"".format(temp_data["full_input_path"])
|
||||
"-i {}".format(
|
||||
path_to_subprocess_arg(temp_data["full_input_path"])
|
||||
)
|
||||
)
|
||||
|
||||
# Add audio arguments if there are any. Skipped when output are images.
|
||||
|
|
@ -544,7 +547,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
|
||||
# NOTE This must be latest added item to output arguments.
|
||||
ffmpeg_output_args.append(
|
||||
"\"{}\"".format(temp_data["full_output_path"])
|
||||
path_to_subprocess_arg(temp_data["full_output_path"])
|
||||
)
|
||||
|
||||
return self.ffmpeg_full_args(
|
||||
|
|
@ -613,7 +616,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
audio_filters.append(arg)
|
||||
|
||||
all_args = []
|
||||
all_args.append("\"{}\"".format(self.ffmpeg_path))
|
||||
all_args.append(path_to_subprocess_arg(self.ffmpeg_path))
|
||||
all_args.extend(input_args)
|
||||
if video_filters:
|
||||
all_args.append("-filter:v")
|
||||
|
|
@ -860,7 +863,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
audio_in_args.append("-to {:0.10f}".format(audio_duration))
|
||||
|
||||
# Add audio input path
|
||||
audio_in_args.append("-i \"{}\"".format(audio["filename"]))
|
||||
audio_in_args.append("-i {}".format(
|
||||
path_to_subprocess_arg(audio["filename"])
|
||||
))
|
||||
|
||||
# NOTE: These were changed from input to output arguments.
|
||||
# NOTE: value in "-ac" was hardcoded to 2, changed to audio inputs len.
|
||||
|
|
|
|||
|
|
@ -117,11 +117,13 @@ class ExtractReviewSlate(openpype.api.Extractor):
|
|||
input_args.extend(repre["_profile"].get('input', []))
|
||||
else:
|
||||
input_args.extend(repre["outputDef"].get('input', []))
|
||||
input_args.append("-loop 1 -i {}".format(slate_path))
|
||||
input_args.append("-loop 1 -i {}".format(
|
||||
openpype.lib.path_to_subprocess_arg(slate_path)
|
||||
))
|
||||
input_args.extend([
|
||||
"-r {}".format(fps),
|
||||
"-t 0.04"]
|
||||
)
|
||||
"-t 0.04"
|
||||
])
|
||||
|
||||
if use_legacy_code:
|
||||
codec_args = repre["_profile"].get('codec', [])
|
||||
|
|
@ -188,20 +190,24 @@ class ExtractReviewSlate(openpype.api.Extractor):
|
|||
output_args.append("-y")
|
||||
|
||||
slate_v_path = slate_path.replace(".png", ext)
|
||||
output_args.append(slate_v_path)
|
||||
output_args.append(
|
||||
openpype.lib.path_to_subprocess_arg(slate_v_path)
|
||||
)
|
||||
_remove_at_end.append(slate_v_path)
|
||||
|
||||
slate_args = [
|
||||
"\"{}\"".format(ffmpeg_path),
|
||||
openpype.lib.path_to_subprocess_arg(ffmpeg_path),
|
||||
" ".join(input_args),
|
||||
" ".join(output_args)
|
||||
]
|
||||
slate_subprcs_cmd = " ".join(slate_args)
|
||||
slate_subprocess_args = openpype.lib.split_command_to_list(
|
||||
slate_subprcs_cmd
|
||||
" ".join(slate_args)
|
||||
)
|
||||
|
||||
# run slate generation subprocess
|
||||
self.log.debug("Slate Executing: {}".format(slate_subprcs_cmd))
|
||||
self.log.debug(
|
||||
"Slate Executing: {}".format(" ".join(slate_subprocess_args))
|
||||
)
|
||||
openpype.api.run_subprocess(
|
||||
slate_subprocess_args, shell=True, logger=self.log
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue