Event hub listener
At a basic level, and this is the way Connect and integrations communicate with the rest of ftrack platform, integrating with the ftrack event hub is a powerful way to listen to events and react to them.
Event plugin path
At launch, the Python API will search the FTRACK_EVENT_PLUGIN_PATH
for plugins having a register
function. This function
is where you can use the provided session
object to listen to events and react to them.
This is the way Connect picks up plugins - by appending all hook
folders found to the FTRACK_EVENT_PLUGIN_PATH
.
You can also provide action listeners that brings up custom interfaces within Studio, aided by the ftrack Action Handler
Creating your own listener
The easiest way is to create a Connect plugin that listens to events and reacts to them. A good example is the locations recipe.
For servers and other headless environments were it is not possible to run Connect, follow these guidelines:
- Create a Python(3+) virtual environment and install the ftrack Python API:
pip install ftrack-python-api
- Create a new Python file and import the ftrack Python API, then create a session object and add your logic to listen to events.
- Set the required environment variables:
FTRACK_SERVER
- the URL to the ftrack serverFTRACK_API_KEY
- the API keyFTRACK_API_USER
- the API user
- Run the Python file from your environment.
Utilise supervisord
on a Linux server to easily boostrap your event listener on server start.
Resources
For detailed information on how the ftrack Python API works, please refer to earlier parts in this Developer hub, the recipes in this section or head over to the ftrack Python API Github repository.