pre-commit hooks for repositories that keep
TiLiA annotations (.tla files).
Copy this into the .pre-commit-config.yaml at the root of your repository
(create the file if it doesn't exist yet):
repos:
- repo: https://github.com/TimeLineAnnotator/pre-commit-hooks
rev: v0.1.0
hooks:
- id: tla-export-jsonThen, once per clone:
pip install pre-commit
pre-commit installThe first commit afterwards takes a while: pre-commit installs TiLiA, including PySide6, into an environment of its own.
Writes a JSON export next to every .tla file in the commit (piece.tla →
piece.json), in the same format as TiLiA's File > Export > JSON.
- If a JSON file was created or changed, the hook fails and the commit stops.
Stage the JSON files (
git add) and commit again. - If a JSON file is already up to date, it is left untouched.
- If TiLiA would need to ask you something to open a file (for instance, what to do with a timeline kind it doesn't know), the export of that file fails instead. Open the file in TiLiA, resolve it there and save.
- Media files are never opened, so they don't need to be in the repository,
and YouTube links don't need a network connection.
media_pathin the JSON is whatever the.tlafile records.
Under the hood, the hook runs TiLiA's command-line interface, so you can do the same for a single file by hand:
tilia -i cli -c 'open "piece.tla" --no-media; export "piece.json" --overwrite'To export files by hand, outside of a commit:
pre-commit run tla-export-json --all-files