From 8f04c3351b51508245ad50780e511ac20aff2b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20David?= Date: Wed, 5 Oct 2022 12:12:53 +0200 Subject: [PATCH 1/3] Fix: 2 fixes, nb_frames and Shot type error --- .../modules/kitsu/utils/update_op_with_zou.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/openpype/modules/kitsu/utils/update_op_with_zou.py b/openpype/modules/kitsu/utils/update_op_with_zou.py index 10e80b3c89c..4cdc53497b2 100644 --- a/openpype/modules/kitsu/utils/update_op_with_zou.py +++ b/openpype/modules/kitsu/utils/update_op_with_zou.py @@ -115,7 +115,8 @@ def update_op_assets( item_data["frameStart"] = frame_in # Frames duration, fallback on 0 try: - frames_duration = int(item_data.pop("nb_frames", 0)) + # NOTE nb_frames is stored directly in item because of zou's legacy design + frames_duration = int(item.get("nb_frames", 0)) except (TypeError, ValueError): frames_duration = 0 # Frame out, fallback on frame_in + duration or project's value or 1001 @@ -170,7 +171,7 @@ def update_op_assets( # Substitute item type for general classification (assets or shots) if item_type in ["Asset", "AssetType"]: entity_root_asset_name = "Assets" - elif item_type in ["Episode", "Sequence"]: + elif item_type in ["Episode", "Sequence", "Shot"]: entity_root_asset_name = "Shots" # Root parent folder if exist @@ -276,11 +277,13 @@ def write_project_to_op(project: dict, dbcon: AvalonMongoDB) -> UpdateOne: match_res = re.match(r"(\d+)x(\d+)", project["resolution"]) if match_res: - project_data['resolutionWidth'] = int(match_res.group(1)) - project_data['resolutionHeight'] = int(match_res.group(2)) + project_data["resolutionWidth"] = int(match_res.group(1)) + project_data["resolutionHeight"] = int(match_res.group(2)) else: - log.warning(f"\'{project['resolution']}\' does not match the expected" - " format for the resolution, for example: 1920x1080") + log.warning( + f"'{project['resolution']}' does not match the expected" + " format for the resolution, for example: 1920x1080" + ) return UpdateOne( {"_id": project_doc["_id"]}, From 0337403182459fc7babc7386242d61fc3ac261f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20David?= Date: Wed, 5 Oct 2022 12:17:19 +0200 Subject: [PATCH 2/3] line length --- openpype/modules/kitsu/utils/update_op_with_zou.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/modules/kitsu/utils/update_op_with_zou.py b/openpype/modules/kitsu/utils/update_op_with_zou.py index 4cdc53497b2..a0cacc11cb2 100644 --- a/openpype/modules/kitsu/utils/update_op_with_zou.py +++ b/openpype/modules/kitsu/utils/update_op_with_zou.py @@ -115,7 +115,8 @@ def update_op_assets( item_data["frameStart"] = frame_in # Frames duration, fallback on 0 try: - # NOTE nb_frames is stored directly in item because of zou's legacy design + # NOTE nb_frames is stored directly in item because + # of zou's legacy design frames_duration = int(item.get("nb_frames", 0)) except (TypeError, ValueError): frames_duration = 0 From 4aec32af91334021d3f943f6886343b5d3490ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20David?= Date: Wed, 5 Oct 2022 12:30:20 +0200 Subject: [PATCH 3/3] line length --- openpype/modules/kitsu/utils/update_op_with_zou.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/modules/kitsu/utils/update_op_with_zou.py b/openpype/modules/kitsu/utils/update_op_with_zou.py index a0cacc11cb2..2d14b38bc4f 100644 --- a/openpype/modules/kitsu/utils/update_op_with_zou.py +++ b/openpype/modules/kitsu/utils/update_op_with_zou.py @@ -115,8 +115,8 @@ def update_op_assets( item_data["frameStart"] = frame_in # Frames duration, fallback on 0 try: - # NOTE nb_frames is stored directly in item because - # of zou's legacy design + # NOTE nb_frames is stored directly in item + # because of zou's legacy design frames_duration = int(item.get("nb_frames", 0)) except (TypeError, ValueError): frames_duration = 0