From c0591af552d4c20e4f8f41e6eea9e19026da3709 Mon Sep 17 00:00:00 2001 From: jrsndlr Date: Sun, 29 Sep 2024 16:15:28 +0200 Subject: [PATCH 1/2] fallback to folder name if folder path is not complete --- .../plugins/create/create_csv_ingest.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/ayon_traypublisher/plugins/create/create_csv_ingest.py b/client/ayon_traypublisher/plugins/create/create_csv_ingest.py index b00ef1d..e8b1c28 100644 --- a/client/ayon_traypublisher/plugins/create/create_csv_ingest.py +++ b/client/ayon_traypublisher/plugins/create/create_csv_ingest.py @@ -451,13 +451,22 @@ def _get_data_from_csv( product_item.folder_path for product_item in product_items_by_name.values() } - folder_ids_by_path: Dict[str, str] = { + folder_ids: Dict[str, str] = { folder_entity["path"]: folder_entity["id"] for folder_entity in ayon_api.get_folders( project_name, folder_paths=folder_paths, fields={"id", "path"} ) } - missing_paths: Set[str] = folder_paths - set(folder_ids_by_path.keys()) + missing_paths: Set[str] = folder_paths - set(folder_ids.keys()) + if missing_paths: + folder_ids_by_name: Dict[str, str] = { + folder_entity["path"]: folder_entity["id"] + for folder_entity in ayon_api.get_folders( + project_name, folder_names=missing_paths, fields={"id", "path"} + ) + } + folder_ids.update(folder_ids_by_name) + missing_paths: Set[str] = folder_paths - set(folder_ids.keys()) if missing_paths: ending = "" if len(missing_paths) == 1 else "s" joined_paths = "\n".join(sorted(missing_paths)) From bf7dfc039e55b5f2448a482c3b5e8c26827a18cd Mon Sep 17 00:00:00 2001 From: jrsndlr Date: Sun, 29 Sep 2024 18:52:20 +0200 Subject: [PATCH 2/2] fix indent --- .../plugins/create/create_csv_ingest.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/ayon_traypublisher/plugins/create/create_csv_ingest.py b/client/ayon_traypublisher/plugins/create/create_csv_ingest.py index e8b1c28..e055444 100644 --- a/client/ayon_traypublisher/plugins/create/create_csv_ingest.py +++ b/client/ayon_traypublisher/plugins/create/create_csv_ingest.py @@ -460,10 +460,11 @@ def _get_data_from_csv( missing_paths: Set[str] = folder_paths - set(folder_ids.keys()) if missing_paths: folder_ids_by_name: Dict[str, str] = { - folder_entity["path"]: folder_entity["id"] - for folder_entity in ayon_api.get_folders( - project_name, folder_names=missing_paths, fields={"id", "path"} - ) + folder_entity["path"]: folder_entity["id"] + for folder_entity in ayon_api.get_folders( + project_name, + folder_names=missing_paths, fields={"id", "path"} + ) } folder_ids.update(folder_ids_by_name) missing_paths: Set[str] = folder_paths - set(folder_ids.keys())