Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order to find the hook files the file name must match exactly. Please see list below.
The example scripts can be found here:
https://github.com/das-element/resources/tree/main/scripts/hooks/examples

Script

Description

pre_render.py

Gets executed before each transcoding task

post_render.py

Gets executed after each transcoding task

pre_ingest_load.py

Gets executed before the file paths get loaded into the ingest view

pre_export.py

Gets execture before the library elements get exported

The software follows this order looking for Python Hook files.

...

https://github.com/das-element/resources/blob/main/scripts/hooks/examples/shotgrid/pre_export.py

Troubleshooting

Logger inside python file

Since version 2.1.2 you can directly access the logger inside the hook files.

Code Block
def main(*args, logger=none):
    items = args[0]

    # use the Das Element logger
    # will log to  ~/.das-element/logs/
    
    logger.warning('This is a warning!')
    
    return items

if __name__ == '__main__':
    main(sys.argv[1:])

Print inside python file

To output data to the console when customizing the hook files use a print statement inside the main function. The input args will be a list of data.

...

Code Block
import logging

def main(*args, logger=none):
    items = args[0]

    logger.warning('This is a warning!') # <- use the Das Element logger (~/.das-element/logs/)

    logging.warning('This is a warning!') # <- use the default logging module

    for item in items:
      print(item) # <- this print() will be output to the console
    return items

if __name__ == '__main__':
    main(sys.argv[1:])

...