{"action":"created","issue":{"url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/issues/330","repository_url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO","labels_url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/issues/330/labels{/name}","comments_url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/issues/330/comments","events_url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/issues/330/events","html_url":"https://github.com/PixarAnimationStudios/OpenTimelineIO/pull/330","id":361976190,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2ODE0MDA3","number":330,"title":"New plugin type: HookScripts","user":{"login":"ssteinbach","id":61017,"node_id":"MDQ6VXNlcjYxMDE3","avatar_url":"https://avatars3.githubusercontent.com/u/61017?v=4","gravatar_id":"","url":"https://api.github.com/users/ssteinbach","html_url":"https://github.com/ssteinbach","followers_url":"https://api.github.com/users/ssteinbach/followers","following_url":"https://api.github.com/users/ssteinbach/following{/other_user}","gists_url":"https://api.github.com/users/ssteinbach/gists{/gist_id}","starred_url":"https://api.github.com/users/ssteinbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssteinbach/subscriptions","organizations_url":"https://api.github.com/users/ssteinbach/orgs","repos_url":"https://api.github.com/users/ssteinbach/repos","events_url":"https://api.github.com/users/ssteinbach/events{/privacy}","received_events_url":"https://api.github.com/users/ssteinbach/received_events","type":"User","site_admin":false},"labels":[{"id":522855272,"node_id":"MDU6TGFiZWw1MjI4NTUyNzI=","url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/labels/needs%20discussion","name":"needs discussion","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/milestones/10","html_url":"https://github.com/PixarAnimationStudios/OpenTimelineIO/milestone/10","labels_url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/milestones/10/labels","id":3137228,"node_id":"MDk6TWlsZXN0b25lMzEzNzIyOA==","number":10,"title":"Public Beta 9","description":"","creator":{"login":"jminor","id":169599,"node_id":"MDQ6VXNlcjE2OTU5OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/169599?v=4","gravatar_id":"","url":"https://api.github.com/users/jminor","html_url":"https://github.com/jminor","followers_url":"https://api.github.com/users/jminor/followers","following_url":"https://api.github.com/users/jminor/following{/other_user}","gists_url":"https://api.github.com/users/jminor/gists{/gist_id}","starred_url":"https://api.github.com/users/jminor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jminor/subscriptions","organizations_url":"https://api.github.com/users/jminor/orgs","repos_url":"https://api.github.com/users/jminor/repos","events_url":"https://api.github.com/users/jminor/events{/privacy}","received_events_url":"https://api.github.com/users/jminor/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":14,"state":"open","created_at":"2018-02-22T19:42:27Z","updated_at":"2018-10-01T23:43:53Z","due_on":"2018-10-10T07:00:00Z","closed_at":null},"comments":9,"created_at":"2018-09-20T00:37:49Z","updated_at":"2018-10-02T07:55:53Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/pulls/330","html_url":"https://github.com/PixarAnimationStudios/OpenTimelineIO/pull/330","diff_url":"https://github.com/PixarAnimationStudios/OpenTimelineIO/pull/330.diff","patch_url":"https://github.com/PixarAnimationStudios/OpenTimelineIO/pull/330.patch"},"body":"HookScripts are plugins that run at defined points ('Hooks').\r\n\r\nThey expose a hook_function with signature:\r\n    `hook_function :: otio.schema.Timeline, Dict -> otio.schema.Timeline`\r\n\r\nBoth hook scripts and the hooks they attach to are defined in the plugin manifest.\r\n\r\nYou can attach multiple hook scripts to a hook.  They will be executed in list order, first to last.\r\n\r\nThey are defined by the manifests HookScripts and hooks areas.  For example:\r\n```json\r\n{\r\n    \"OTIO_SCHEMA\" : \"PluginManifest.1\",\r\n    \"hook_scripts\" : [\r\n        {\r\n            \"OTIO_SCHEMA\" : \"HookScript.1\",\r\n            \"name\" : \"example hook\",\r\n            \"execution_scope\" : \"in process\",\r\n            \"filepath\" : \"example.py\"\r\n        }\r\n    ],\r\n    \"hooks\" : {\r\n        \"pre_adapter_write\" : [\"example hook\"],\r\n        \"post_adapter_read\" : []\r\n    }\r\n}\r\n```\r\n\r\nThe 'hook_scripts' area loads the python modules with the 'hook_function's to call in them.  The 'hooks' area defines the hooks (and any associated scripts).  You can further query and modify these from python.\r\n\r\nIn other words:\r\n\r\n```python\r\nimport opentimelineio as otio\r\nhook_list = otio.hooks.scripts_attached_to(\"some_hook\") # -> ['a','b','c']\r\n\r\n# to run the hook scripts:\r\notio.hooks.run(\"some_hook\", some_timeline, optional_argument_dict)\r\n\r\n# this will pass (some_timeline, optional_argument_dict) to 'a', which will\r\n# a new timeline that will get passed into 'b' with optional_argument_dict,\r\n# etc.\r\n\r\n# To Edit the order, change the order in the list:\r\nhook_list[0], hook_list[2] = hook_list[2], hook_list[0]\r\nprint hook_list # ['c','b','a']\r\n\r\n# Now c will run, then b, then a.\r\n\r\n# To delete a function the list:\r\ndel hook_list[1]\r\n```\r\n\r\nThis also sets up three default hooks you can attach scripts to:\r\n- post_adapter_read\r\n- post_media_linker\r\n- pre_adapter_write"},"comment":{"url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/issues/comments/426182925","html_url":"https://github.com/PixarAnimationStudios/OpenTimelineIO/pull/330#issuecomment-426182925","issue_url":"https://api.github.com/repos/PixarAnimationStudios/OpenTimelineIO/issues/330","id":426182925,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjE4MjkyNQ==","user":{"login":"alatdneg","id":19472999,"node_id":"MDQ6VXNlcjE5NDcyOTk5","avatar_url":"https://avatars2.githubusercontent.com/u/19472999?v=4","gravatar_id":"","url":"https://api.github.com/users/alatdneg","html_url":"https://github.com/alatdneg","followers_url":"https://api.github.com/users/alatdneg/followers","following_url":"https://api.github.com/users/alatdneg/following{/other_user}","gists_url":"https://api.github.com/users/alatdneg/gists{/gist_id}","starred_url":"https://api.github.com/users/alatdneg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alatdneg/subscriptions","organizations_url":"https://api.github.com/users/alatdneg/orgs","repos_url":"https://api.github.com/users/alatdneg/repos","events_url":"https://api.github.com/users/alatdneg/events{/privacy}","received_events_url":"https://api.github.com/users/alatdneg/received_events","type":"User","site_admin":false},"created_at":"2018-10-02T07:55:53Z","updated_at":"2018-10-02T07:55:53Z","author_association":"NONE","body":"Looks good, one question how do you deal with ordering when there are multiple plugin manifest files?"}}
{"actor":{"display_login":"alatdneg"}}