Skip to content

Commit

Permalink
Refactor metadata update process in CreateEditorialPackage
Browse files Browse the repository at this point in the history
Simplify metadata update process by refactoring code for better readability and maintainability.
  • Loading branch information
jakubjezek001 committed Jul 29, 2024
1 parent 9d3a824 commit 9f0040e
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions client/ayon_resolve/plugins/create/create_editorial_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,13 @@ class CreateEditorialPackage(LegacyCreator):
def process(self):
"""Process the creation of the editorial package."""
current_timeline = lib.get_current_timeline()
timeline_name = current_timeline.GetName()

# get timeline media pool item for metadata update
timeline_media_pool_item = None
for item in lib.iter_all_media_pool_clips():
item_name = item.GetName()
if item_name != timeline_name:
continue
timeline_media_pool_item = item
break

# Update the metadata
if timeline_media_pool_item:
publish_data = {"publish": self.data}
timeline_media_pool_item.SetMetadata(
lib.pype_tag_name, json.dumps(publish_data)
)
else:
NameError("Timeline not found in media pool.")

timeline_media_pool_item = lib.get_timeline_media_pool_item(
current_timeline
)

publish_data = {"publish": self.data}

timeline_media_pool_item.SetMetadata(
lib.pype_tag_name, json.dumps(publish_data)
)

0 comments on commit 9f0040e

Please sign in to comment.