From 4f41067e1b8e48cb5ec6efb104d7e92852e0cbc9 Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Thu, 8 Feb 2024 09:15:41 +1300 Subject: [PATCH] feature/OP-7692_Folder_Batch_publishing_tool --- openpype/hosts/batchpublisher/controller.py | 25 +++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/openpype/hosts/batchpublisher/controller.py b/openpype/hosts/batchpublisher/controller.py index c717687d898..1827a66b6fe 100644 --- a/openpype/hosts/batchpublisher/controller.py +++ b/openpype/hosts/batchpublisher/controller.py @@ -240,10 +240,12 @@ def get_product_items(self, directory): filepath_parts = filepath.split(".") filepath_parts[-2] = "#" * len(filepath_parts[-2]) # Replace the file path with the version with star in it - filepath = ".".join(filepath_parts) - frames = self._get_frames_for_filepath(filepath) - frame_start = frames[0] - frame_end = frames[-1] + _filepath = ".".join(filepath_parts) + frames = self._get_frames_for_filepath(_filepath) + if frames: + filepath = _filepath + frame_start = frames[0] + frame_end = frames[-1] # Do not add ingest file path, if it's already been added if filepath in product_items: continue @@ -277,10 +279,12 @@ def get_product_items(self, directory): filepath_parts = filepath.split(".") filepath_parts[-2] = "*" # Replace the file path with the version with star in it - filepath = ".".join(filepath_parts) - frames = self._get_frames_for_filepath(filepath) - frame_start = frames[0] - frame_end = frames[-1] + _filepath = ".".join(filepath_parts) + frames = self._get_frames_for_filepath(_filepath) + if frames: + filepath = _filepath + frame_start = frames[0] + frame_end = frames[-1] # Do not add ingest file path, if it's already been added if filepath in product_items: continue @@ -371,6 +375,9 @@ def _get_frames_for_filepath(self, filepath): frames = list() for _filepath in glob.glob(filepath): filepath_parts = _filepath.split(".") - frame = int(filepath_parts[-2]) + try: + frame = int(filepath_parts[-2]) + except Exception: + continue frames.append(frame) return sorted(frames)