Blender Kitsu: Fix Gazu Module out of sync #119

Merged
Nick Alberelli merged 11 commits from :fix/restore-gazu-out-of-sync into main 2023-07-13 19:39:30 +02:00
2 changed files with 20 additions and 27 deletions
Showing only changes of commit 50f77d2204 - Show all commits

View File

@ -7,30 +7,8 @@ from .helpers import normalize_model_parameter
default = raw.default_client
@cache
def get_all_edits(relations=False, client=default):
"""
Retrieve all edit entries.
"""
params = {}
if relations:
params = {"relations": "true"}
path = "edits/all"
edits = raw.fetch_all(path, params, client=client)
return sort_by_name(edits)
# TODO Contribute these to gazu module or remove, this file is temporary
@cache
def get_edit(edit_id, relations=False, client=default):
"""
Retrieve all edit entries.
"""
edit_entry = normalize_model_parameter(edit_id)
params = {}
if relations:
params = {"relations": "true"}
path = f"edits/{edit_entry['id']}"
edit_entry = raw.fetch_all(path, params, client=client)
return edit_entry
@cache
def get_all_edits_with_tasks(relations=False, client=default):
@ -44,6 +22,7 @@ def get_all_edits_with_tasks(relations=False, client=default):
edits_with_tasks = raw.fetch_all(path, params, client=client)
return sort_by_name(edits_with_tasks)
@cache
def get_all_previews_for_edit(edit, client=default):
"""
@ -54,6 +33,20 @@ def get_all_previews_for_edit(edit, client=default):
list: Shots which are children of given episode.
"""
edit = normalize_model_parameter(edit)
edit_previews = (raw.fetch_all(f"edits/{edit['id']}/preview-files", client=client))
edit_previews = raw.fetch_all(f"edits/{edit['id']}/preview-files", client=client)
for key in [key for key in enumerate(edit_previews.keys())]:
return edit_previews[key[1]]
return edit_previews[key[1]]
@cache
def all_tasks_for_edit(edit, relations=False, client=default):
"""
Retrieve all tasks directly linked to given edit.
"""
edit = normalize_model_parameter(edit)
params = {}
if relations:
params = {"relations": "true"}
path = "edits/%s/tasks" % edit["id"]
tasks = raw.fetch_all(path, params, client=client)
return sort_by_name(tasks)

View File

@ -2423,7 +2423,7 @@ class KITSU_OT_vse_publish_edit_revision(bpy.types.Operator):
def get_edit_task_items(
self: Any, context: bpy.types.Context
) -> List[Tuple[str, str, str]]:
tasks = gazu.task.all_tasks_for_edit(self.edit_entry)
tasks = connectors.all_tasks_for_edit(self.edit_entry)
return [
(
item.get("id"),
@ -2538,7 +2538,7 @@ class KITSU_OT_vse_publish_edit_revision(bpy.types.Operator):
edit_entity_update = set_entity_data(
edit_entry, 'frame_start', self.frame_start
)
updated_edit_entity = gazu.entity.update_entity(
updated_edit_entity = gazu.edit.update_edit(
edit_entity_update
) # TODO add a generic function to update entites