Build deterministic, path-first ErsatzTV channels without fighting fragile manual playlist edits.
clickOR separates channel programming into two safe phases:
solve: turn channel intent (JSON) into a concrete looping lineup (YAML)apply: update ErsatzTV sqlite state deterministically from that lineup
The result is repeatable channel operations, safer dry-runs, and easier iteration on programming ideas.
- Deterministic: same config + seed means predictable outputs
- Operationally safe:
solvenever touches the DB - Debuggable:
applycan emit SQL before execution - Path-first: media identity is based on concrete library paths
- Long-form content channels (shows, films, music videos)
- Bumper/interstitial-driven channels
- Mixed channels with short-form + long-form blocks
- Flat playlists where very short clips can optionally auto-loop
- Flat playlists where looped short clips collapse duplicate guide rows
- Companion cards spliced next to specific items ("And now:" title cards, per-film slates, block-opening idents) — see Companions below
Bumpers are anonymous — shuffled from pools between blocks. Companions are addressed: a card that belongs to one item and travels with it. The solver never sees them; they are spliced into the final order afterward. The solver owns the programs; injection is a choice.
Add an optional top-level companions list to a solve or flat config:
"companions": [
{
"match": {"pools": ["coronet"]},
"scope": "every_match",
"position": "before",
"card": {"template": "/media/other_videos/Cards/Coronet/{stem}.mp4",
"type": "other_video", "include_in_guide": true}
},
{
"match": {"types": ["episode"], "path_glob": "*/MST3K/*"},
"card": {"template": "/media/other_videos/Cards/MST3K/{stem}.mp4"}
},
{
"match": {"pools": ["feature"]},
"scope": "block_start",
"card": {"template": "/media/other_videos/Cards/Idents/movies.mp4"}
}
]match— all given conditions must hold:pools(solve mode only; content pool names and bumper pool names both count, so{"pools": ["coronet"]}puts a slate before every Coronet in a break),types,path_glob(fnmatch).scope—every_match(default) orblock_start(first matched item of each content block; solve mode only).position—before(default) orafterthe item.card.template— format string with{stem}(basename, no extension),{name},{dir}.card.mapgives exact item-path -> card-path overrides and wins over the template. A matched item with no resolvable card is an error, not a silent drop.export-from-dbcopies a spec'scompanionslist into the solve config verbatim, so the spec stays the single source for a channel.- Cards count as furniture in
verify: excluded from block-capacity sums and the long-form one-item rule, and a dedicated adjacency check fails the lineup if any matched item is missing its card (or grew an extra one).
cd /path/to/clickor
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .
clickor --helpOptional environment file:
cp .env.example .envTypical flow:
# 1) Export a concrete config from ErsatzTV
clickor export-from-db --spec examples/export-spec-television.json --out /tmp/television.config.json
# 2) Solve config -> lineup YAML
clickor solve --config /tmp/television.config.json --out /tmp/television.yaml --seed auto --report /tmp/television.report.json
# 3) Preview apply SQL (dry run)
clickor apply --yaml /tmp/television.yaml --dry-run --output /tmp/television.sql
# 4) Apply to ErsatzTV
clickor apply --yaml /tmp/television.yaml --apply --mode replacedocs/STEP_BY_STEP.mddocs/FLAT_PLAYLIST_RUNBOOK.mddocs/CONFIG.mddocs/EXPORT_FROM_DB.mddocs/PROBING.mddocs/TROUBLESHOOTING.md
clickOR is the product name. clickor is used for the Python package and CLI command.