minor docstring and code tweaks for ExtractReviewMov

This commit is contained in:
Kayla Man 2023-10-04 17:12:28 +08:00
parent 4a2417d2ca
commit c5bf50a454
2 changed files with 8 additions and 10 deletions

View file

@ -3425,17 +3425,15 @@ def create_viewer_profile_string(viewer, display=None, path_like=False):
return "{} ({})".format(viewer, display)
def get_head_filename_without_hashes(original_path, name):
"""Function to get the renamed head filename without frame hashes
To avoid the system being confused on finding the filename with
frame hashes if the head of the filename has the hashed symbol
def prepend_name_before_hashed_frame(original_path, name):
"""Function to prepend an extra name before the hashed frame numbers
Examples:
>>> get_head_filename_without_hashes("render.####.exr", "baking")
>>> prepend_name_before_hashed_frame("render.####.exr", "baking")
render.baking.####.exr
>>> get_head_filename_without_hashes("render.%04d.exr", "tag")
>>> prepend_name_before_hashed_frame("render.%04d.exr", "tag")
render.tag.%d.exr
>>> get_head_filename_without_hashes("exr.####.exr", "foo")
>>> prepend_name_before_hashed_frame("exr.####.exr", "foo")
exr.foo.%04d.exr
Args:

View file

@ -39,7 +39,7 @@ from .lib import (
get_view_process_node,
get_viewer_config_from_string,
deprecated,
get_head_filename_without_hashes,
prepend_name_before_hashed_frame,
get_filenames_without_hash
)
from .pipeline import (
@ -820,12 +820,12 @@ class ExporterReviewMov(ExporterReview):
if ".{}".format(self.ext) not in VIDEO_EXTENSIONS:
# filename would be with frame hashes if
# the file extension is not in video format
filename = get_head_filename_without_hashes(
filename = prepend_name_before_hashed_frame(
self.path_in, self.name)
self.file = filename
# make sure the filename are in
# correct image output format
if ".{}".format(self.ext) not in self.file:
if not self.file.endswith(".{}".format(ext)):
filename_no_ext, _ = os.path.splitext(filename)
self.file = "{}.{}".format(filename_no_ext, self.ext)