Skip to content

Add placeholder variable support in timeline JSON for dynamic rendering#45

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-placeholder-variable-support
Draft

Add placeholder variable support in timeline JSON for dynamic rendering#45
Copilot wants to merge 2 commits into
mainfrom
copilot/add-placeholder-variable-support

Conversation

Copilot AI commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

Many workflows generate timeline JSON programmatically and need to inject runtime values (paths, titles, timestamps) without manual edits. This adds ${VAR_NAME} placeholder resolution to render_video, enabling reusable JSON templates.

Changes

  • pavo/pavo.py — new resolve_placeholders(data, variables) helper recursively substitutes ${VAR_NAME} tokens in any string value of a JSON-compatible structure; raises ValueError naming any unresolved placeholder. render_video gains an optional variables=None kwarg; substitution runs after json.load() and before schema validation.
  • tests/test_render_video.py — unit tests for resolve_placeholders (single/multiple substitutions, nested dicts/lists, non-string pass-through, missing-variable error) and integration tests for render_video with variables=.
  • README.md — new "Placeholder variables (dynamic pipelines)" section with template JSON and usage example.

Usage

# template.json contains "${ASSET_DIR}/intro.mp4", "${ASSET_DIR}/music.mp3", etc.
from pavo import render_video

render_video(
    "template.json",
    "output/final.mp4",
    variables={"ASSET_DIR": "/projects/my_video/assets"},
)

Missing keys raise immediately:

ValueError: Placeholder '${ASSET_DIR}' has no matching key in the provided variables

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Add placeholder variable support in timeline JSON for dynamic rendering Add placeholder variable support in timeline JSON for dynamic rendering Mar 28, 2026
Copilot AI requested a review from sonnhfit March 28, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add placeholder variable support in timeline JSON for dynamic rendering

2 participants