Skip to content

Commit

Permalink
Add documenation
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyprien Caillot committed Oct 12, 2023
1 parent c7e92e3 commit b932548
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class IntegrateVersionToTask(api.ContextPlugin):
optional = False

def get_all_task_types(self, project):
"""Get all task types from the project schema.
:param project: The Ftrack project Entity.
:type project: ftrack Project Object
:return: A dictionary containing all task types.
:rtype: dict<ftrackTaskType>
"""
tasks = {}
proj_template = project['project_schema']
temp_task_types = proj_template['_task_type_schema']['types']
Expand All @@ -22,7 +30,12 @@ def get_all_task_types(self, project):
return tasks

def process(self, context):
# Get Usefull Data
"""Process the Pyblish context.
:param context: The Pyblish context.
:type context: pyblish.api.Context
"""
# Get Data we need
task_type = context.data.get('task').lower()
ftrack_session = context.data.get('ftrackSession')
ftrack_project = context.data.get('ftrackProject')
Expand All @@ -32,6 +45,7 @@ def process(self, context):
self.log.info('Ftrack session is not created.')
return

# Build Plugin dict list to analyze
to_analyze_lst = []
for result_dict in context.data.get('results'):
if 'Collect OTIO Review' in result_dict['plugin'].label:
Expand All @@ -42,7 +56,8 @@ def process(self, context):
ftrack_asset_versions = to_analyze['instance'].data['ftrackIntegratedAssetVersions']

# Check if confo task already exists in ftrack
is_task_exist = ftrack_session.query('Task where name is "{0}" and parent.id is {1}'.format(task_type, ftrack_shot_version['id'])).first()
is_task_exist = ftrack_session.query(
'Task where name is "{0}" and parent.id is {1}'.format(task_type, ftrack_shot_version['id'])).first()
if not is_task_exist:
new_task = ftrack_session.create(
'Task',
Expand All @@ -61,4 +76,4 @@ def process(self, context):
for asset_version in ftrack_asset_versions:
asset_version['task'] = new_task

ftrack_session.commit()
ftrack_session.commit()

0 comments on commit b932548

Please sign in to comment.