genvid.toolbox.ProjectTool

class genvid.toolbox.ProjectTool(**kwargs)

Bases: genvid.toolbox.consul_template.ConsulTemplateTool

Tool for managing project files.

LOGS = {'root': {'task': 'root', 'job': 'services', 'loglevel': True, 'stdout': False}, 'events': {'task': 'events', 'job': 'services', 'loglevel': True, 'stdout': False}, 'leaf': {'task': 'leaf', 'job': 'services', 'loglevel': True, 'stdout': False}, 'command': {'task': 'command', 'job': 'services', 'loglevel': True, 'stdout': False}, 'ffmpeg': {'task': 'ffmpeg', 'stdout': False}, 'broadcast': {'task': 'broadcast', 'job': 'services', 'loglevel': True, 'stdout': False}, 'gvencode': {'task': 'gvencode', 'job': 'services', 'loglevel': True, 'stdout': False}, 'disco': {'task': 'disco', 'job': 'services', 'loglevel': True, 'stdout': False}, 'nats': {'task': 'nats', 'job': 'services', 'loglevel': False, 'stdout': False}, 'compose': {'task': 'compose', 'job': 'services', 'loglevel': True, 'stdout': False}}

The default list of logs.

get_project_file(dir_or_file)

Return a project file

The argument could be either a directory or a project file. If it is a directory, the following files will be searched in this order inside the directory: genvid.hcl, genvid.json.

load_project(dir_or_file, **kwargs)

Load a project file.

The first parameter is looked up using get_project_file() for the project file.

The environment variable PROJECTDIR will then be set to the folder containing the projectfile.

Afterward, the file will be evaluated as a consul template using consul_template(), using any kwargs passed as argument. Note, if your file doesn’t required anything from consul, the consul server is not required to run. The result is then parsed as either a JSON file if the extension is .json, or an HCL file otherwise.

update_project(project)

This method tries to update a project to the newer version.

The upgrade is done after the template engine are run, and so could lose some information.