mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Publish comment to kitsu
This commit is contained in:
parent
de153a0450
commit
6cf38e1a35
3 changed files with 53 additions and 13 deletions
|
|
@ -408,7 +408,7 @@ def sync_openpype():
|
|||
all_entities = [
|
||||
e
|
||||
for e in all_assets + all_episodes + all_seqs + all_shots
|
||||
if not e["data"].get("is_substitute")
|
||||
if e["data"] and not e["data"].get("is_substitute")
|
||||
]
|
||||
|
||||
# Sync project. Create if doesn't exist
|
||||
|
|
|
|||
|
|
@ -1,9 +1,49 @@
|
|||
import os
|
||||
|
||||
import gazu
|
||||
|
||||
import pyblish.api
|
||||
|
||||
import debugpy
|
||||
|
||||
|
||||
class CollectExampleAddon(pyblish.api.ContextPlugin):
|
||||
order = pyblish.api.CollectorOrder + 0.4
|
||||
label = "Collect Kitsu"
|
||||
|
||||
def process(self, context):
|
||||
debugpy.breakpoint()
|
||||
self.log.info("I'm in Kitsu's plugin!")
|
||||
|
||||
|
||||
class IntegrateRig(pyblish.api.InstancePlugin):
|
||||
"""Copy files to an appropriate location where others may reach it"""
|
||||
|
||||
order = pyblish.api.IntegratorOrder
|
||||
families = ["model"]
|
||||
|
||||
def process(self, instance):
|
||||
print(instance.data["version"])
|
||||
|
||||
# Connect to server
|
||||
gazu.client.set_host(os.environ["KITSU_SERVER"])
|
||||
|
||||
# Authenticate
|
||||
gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"])
|
||||
|
||||
asset_data = instance.data["assetEntity"]["data"]
|
||||
|
||||
# TODO Set local settings for login and password
|
||||
|
||||
# Get task
|
||||
task_type = gazu.task.get_task_type_by_name(instance.data["task"])
|
||||
entity_task = gazu.task.get_task_by_entity(asset_data["zou"], task_type)
|
||||
|
||||
# Comment entity
|
||||
gazu.task.add_comment(
|
||||
entity_task,
|
||||
entity_task["task_status_id"],
|
||||
comment=f"Version {instance.data['version']} has been published!",
|
||||
)
|
||||
|
||||
self.log.info("Copied successfully!")
|
||||
|
|
|
|||
|
|
@ -134,11 +134,18 @@ def sync_project(project: dict, dbcon: AvalonMongoDB) -> UpdateOne:
|
|||
print(f"Creating project '{project_name}'")
|
||||
project_doc = create_project(project_name, project_name, dbcon=dbcon)
|
||||
|
||||
print(f"Synchronizing {project_name}...")
|
||||
|
||||
# Project data and tasks
|
||||
if not project["data"]: # Sentinel
|
||||
project["data"] = {}
|
||||
project_data = project["data"] or {}
|
||||
|
||||
# Update data
|
||||
project_data.update(
|
||||
{
|
||||
"code": project["code"],
|
||||
"fps": project["fps"],
|
||||
"resolutionWidth": project["resolution"].split("x")[0],
|
||||
"resolutionHeight": project["resolution"].split("x")[1],
|
||||
}
|
||||
)
|
||||
|
||||
return UpdateOne(
|
||||
{"_id": project_doc["_id"]},
|
||||
|
|
@ -148,14 +155,7 @@ def sync_project(project: dict, dbcon: AvalonMongoDB) -> UpdateOne:
|
|||
t["name"]: {"short_name": t.get("short_name", t["name"])}
|
||||
for t in gazu.task.all_task_types_for_project(project)
|
||||
},
|
||||
"data": project["data"].update(
|
||||
{
|
||||
"code": project["code"],
|
||||
"fps": project["fps"],
|
||||
"resolutionWidth": project["resolution"].split("x")[0],
|
||||
"resolutionHeight": project["resolution"].split("x")[1],
|
||||
}
|
||||
),
|
||||
"data": project_data,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue