peter divers Posted September 3, 2018 Report Share Posted September 3, 2018 Hello all I have an awful lot of questions here as this is my first ftrack api script with event listeners. So here goes below is what I currently have and is all working fine import ftrack_api as ft def ftrackListener(event): print 'event: ' + str(event) for entity in event['data'].get('entities',[]): if entity.get('entityType') == 'task' and entity['action'] == 'update': entityId = str(entity.get('entityId')) parentId = str(entity.get('parentId')) actionType = str(entity['action']) entityType = str(entity.get('entityType')) print 'entity: ' + str(entity) print 'entityType: ' + entityType print 'entityID: ' + entityId print 'parentID: ' + parentId print 'Action Type: ' + actionType session = ft.Session(server_url='https://*******.ftrackapp.com', api_key='*********#######-0a580a5c1009',api_user='dev') session.event_hub.subscribe('topic=ftrack.update',ftrackListener) session.event_hub.wait(duration=50) question one) entityId returns the entityId yet I can for the life of me figure out how to simply find the name of this task or is the entityId the status ? question two) What I am wanting to do is then change the status of the parent of this task which is a shot, Ive seen a lot of posts around but im getting rather confused as to the new and old Api? question three) Lastly status Id,s what is the usual way people are going about finding the actual value or name of this as my current way would be to make a dictionary out of it in a rather manual process, I know their is quite a lot here and any hints on any of it would be fantastic regards Pete Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted September 3, 2018 Report Share Posted September 3, 2018 Getting the name of a task would be something like: task = session.get('TypedContext', entity_id) print task['name'] Updating a parent shot status can be done as: shot = task['parent'] shot['status'] = new_status Link to comment Share on other sites More sharing options...
peter divers Posted September 3, 2018 Author Report Share Posted September 3, 2018 thankyou Mattias, I am now steam rolling through this thanks to your help Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.