...
In order to find the hook files the file name must match exactly. Please see list below.
Script | Description |
---|---|
| Gets executed before each transcoding task |
| Gets executed after each transcoding task |
The software follows this order looking for Python Hook files.
...
Code Block | ||
---|---|---|
| ||
# Example Python script for post render hook (post_render.py): import sys import re def main(*args): # args[0] is the output from the process calling the 'exec' and 'params' job_output = args[0] job_id = '' if job_output: match = re.search(r'JobID=([a-zA-Z0-9]*)', job_output) if match: job_id = match.group(1) print('Job ID: {}'.format(job_id)) # returns data that can later be access as "custom" # in this example: <custom.dependency> return {'dependency': job_id} if __name__ == '__main__': main(sys.argv[1:]) |
Pre Ingest Load
This hook can be used to parse the file paths to set tags and the category from the file path before the items are loaded into the ingest list. These tags and the category will automatically populate the ingest list items.
The input is a List of Dictionaries and the same has to be returned from the function.
Code Block | ||
---|---|---|
| ||
# Example Python script for pre ingest load hook (pre_ingest_load.py):
import sys
import re
TAGS = ['assets', 'environments', 'hdri', 'photogrammetry', 'texture']
def main(*args):
# args will be a List of Dicts:
# [{'path': '/path/to/some/file.mov', 'category': '', 'tags': []}]
items = args[0]
result = []
for item in items:
path_items = path.split('/')
for path_item in path_items:
# search for keywords in file path
if path_item in TAGS:
item.get('tags', []).append(path_item)
# example regular expression to search for a pattern in the file path
regex_asset = r'(prp|env|veh_\w*)'
match = re.search(regex_asset, path_item)
if match:
item.get('tags', []).append(path_item)
if item.get('tags'):
# set last tag as the category
item['category'] = item['tags'][-1]
result.append(item)
return result
if __name__ == '__main__':
main(sys.argv[1:]) |