Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
format output arguments with anatomy data
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT authored and jakubjezek001 committed Jan 14, 2022
1 parent ea03444 commit 1150de0
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions openpype/plugins/publish/extract_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def main_process(self, instance):
outputs_per_repres = self._get_outputs_per_representations(
instance, profile_outputs
)
fill_data = copy.deepcopy(instance.data["anatomyData"])
for repre, outputs in outputs_per_repres:
# Check if input should be preconverted before processing
# Store original staging dir (it's value may change)
Expand Down Expand Up @@ -293,7 +294,7 @@ def main_process(self, instance):

try: # temporary until oiiotool is supported cross platform
ffmpeg_args = self._ffmpeg_arguments(
output_def, instance, new_repre, temp_data
output_def, instance, new_repre, temp_data, fill_data
)
except ZeroDivisionError:
if 'exr' in temp_data["origin_repre"]["ext"]:
Expand Down Expand Up @@ -446,7 +447,9 @@ def prepare_temp_data(self, instance, repre, output_def):
"handles_are_set": handles_are_set
}

def _ffmpeg_arguments(self, output_def, instance, new_repre, temp_data):
def _ffmpeg_arguments(
self, output_def, instance, new_repre, temp_data, fill_data
):
"""Prepares ffmpeg arguments for expected extraction.
Prepares input and output arguments based on output definition and
Expand All @@ -472,16 +475,28 @@ def _ffmpeg_arguments(self, output_def, instance, new_repre, temp_data):
ffmpeg_input_args = [
value for value in _ffmpeg_input_args if value.strip()
]
ffmpeg_output_args = [
value for value in _ffmpeg_output_args if value.strip()
]
ffmpeg_video_filters = [
value for value in _ffmpeg_video_filters if value.strip()
]
ffmpeg_audio_filters = [
value for value in _ffmpeg_audio_filters if value.strip()
]

ffmpeg_output_args = []
for value in _ffmpeg_output_args:
value = value.strip()
if not value:
continue
try:
value = value.format(**fill_data)
except Exception:
self.log.warning(
"Failed to format ffmpeg argument: {}".format(value),
exc_info=True
)
pass
ffmpeg_output_args.append(value)

# Prepare input and output filepaths
self.input_output_paths(new_repre, output_def, temp_data)

Expand Down

0 comments on commit 1150de0

Please sign in to comment.