Pad/snap channel schedules to clock boundaries (:00/:15/:30) using filler #77

Closed
opened 2026-07-02 00:43:10 +02:00 by timothy · 2 comments
Owner

Concept borrowed from Tunarr (its "Pad Times" / "Pad Style" + Flex Time). Makes a channel's guide look like real broadcast TV.

Goal

Snap each program so the next one starts on a clean clock increment (e.g. :00/:15/:30), filling the leftover time with filler ("flex"). So a 22-minute episode in a 30-minute slot is padded to the next :00/:30, and the EPG shows tidy half-hour/quarter-hour blocks instead of ragged times.

Scope

  • A per-channel / per-schedule / per-template option: pad to clock boundary, with a configurable increment (15 / 30 / 60 min).
  • Choose the boundary granularity and what fills the gap (existing Filler presets — pre/mid/post-roll/tail — or offline/black).
  • Pad style: pad per-slot vs pad per-episode (Tunarr's distinction) — decide which we support.
  • The generated EPG must reflect the padded boundaries (clean start times) — ties into the guide-accuracy theme from #68.

Notes

  • Reverses an earlier "not adopting" call — the user wants clean clock-aligned guides after all.
  • Reuses the existing Filler machinery for the fill; the new part is the boundary-snapping logic in the playout builder + surfacing it as a setting.
  • Distinct from ad-break interstitials (quarter-point injection, which we're still skipping) — this is about schedule tidiness, not commercials.

Related: #59.


Resolution (2026-07-17): core already exists → scoped to verify + document

Investigation found the boundary-snapping is already implemented (upstream machinery carried into the fork), so this issue is closed as verified + documented, with the one real residual (a convenience toggle, which is UI work) deferred:

  • Classic: FillerPreset with FillerMode.Pad + PadToNearestMinute snaps content up to the next N-min clock mark, filling with filler. Live SPA editor at /app/filler-presets.
  • Sequential (YAML): pad_to_next / pad_until instructions.
  • Block: inherently clock-anchored via TemplateItem.StartTime — no per-item pad needed.
  • EPG reflects the padded boundary automatically (ChannelGuideProjector coalesces trailing filler into the programme window).
  • Deferred → #392 (blocked on #388): one-click per-channel/schedule clock-align toggle + the 60-min increment option. Pad-per-slot vs per-episode decision rides along there.

Done-when

  • adversarial review passed (cold review MERGEABLE @ 17746c44, PR #393)
  • behaviour locked by deterministic tests (builder golden Classic_clock_padded + guide projection ChannelGuideProjectorClockPadTests)
  • docs updated (decisions.md / domain-model.md / testing.md)
  • UI-gated residual filed as a tracked follow-up (#392, blocked on #388)

Note: live-E2E deliberately substituted with the two deterministic tests — this session changes no production code, so the live-E2E's write-path/500 justification does not apply.

Concept borrowed from **Tunarr** (its "Pad Times" / "Pad Style" + Flex Time). Makes a channel's guide look like real broadcast TV. ## Goal Snap each program so the next one starts on a clean clock increment (e.g. :00/:15/:30), filling the leftover time with filler ("flex"). So a 22-minute episode in a 30-minute slot is padded to the next :00/:30, and the EPG shows tidy half-hour/quarter-hour blocks instead of ragged times. ## Scope - A per-channel / per-schedule / per-template option: **pad to clock boundary**, with a configurable increment (15 / 30 / 60 min). - Choose the boundary granularity and what fills the gap (existing Filler presets — pre/mid/post-roll/tail — or offline/black). - **Pad style:** pad per-slot vs pad per-episode (Tunarr's distinction) — decide which we support. - The generated **EPG must reflect the padded boundaries** (clean start times) — ties into the guide-accuracy theme from #68. ## Notes - Reverses an earlier "not adopting" call — the user wants clean clock-aligned guides after all. - Reuses the existing Filler machinery for the fill; the new part is the boundary-snapping logic in the playout builder + surfacing it as a setting. - Distinct from ad-break interstitials (quarter-point injection, which we're still skipping) — this is about schedule *tidiness*, not commercials. Related: #59. --- ## Resolution (2026-07-17): core already exists → scoped to verify + document Investigation found the boundary-snapping is **already implemented** (upstream machinery carried into the fork), so this issue is closed as *verified + documented*, with the one real residual (a convenience toggle, which is UI work) deferred: - **Classic**: `FillerPreset` with `FillerMode.Pad` + `PadToNearestMinute` snaps content up to the next N-min clock mark, filling with filler. Live SPA editor at `/app/filler-presets`. - **Sequential (YAML)**: `pad_to_next` / `pad_until` instructions. - **Block**: inherently clock-anchored via `TemplateItem.StartTime` — no per-item pad needed. - **EPG** reflects the padded boundary automatically (`ChannelGuideProjector` coalesces trailing filler into the programme window). - **Deferred → #392** (blocked on #388): one-click per-channel/schedule clock-align toggle + the 60-min increment option. Pad-per-slot vs per-episode decision rides along there. ## Done-when - [x] adversarial review passed (cold review MERGEABLE @ 17746c44, PR #393) - [x] behaviour locked by deterministic tests (builder golden `Classic_clock_padded` + guide projection `ChannelGuideProjectorClockPadTests`) - [x] docs updated (decisions.md / domain-model.md / testing.md) - [x] UI-gated residual filed as a tracked follow-up (#392, blocked on #388) *Note: live-E2E deliberately substituted with the two deterministic tests — this session changes **no production code**, so the live-E2E's write-path/500 justification does not apply.*
timothy added the enhancementcontentpriority: medium labels 2026-07-02 00:43:10 +02:00
timothy added this to the Scheduling: refactor + distribution milestone 2026-07-17 00:25:06 +02:00
timothy added the in-progress label 2026-07-17 00:48:52 +02:00
Author
Owner

🔨 Claiming — top eligible pick from the queue (Tier 2, milestone "Scheduling: refactor + distribution", priority:medium; #380 in-progress and #70 blocked-by #380 both excluded).

Scope for this session: the non-UI core only — schema/persistence for the pad-to-boundary option, the boundary-snapping logic in the playout builder (reusing existing Filler machinery), API surface, and EPG output reflecting the padded boundaries, with tests. The SPA setting UI is deferred and will be filed as a follow-up blocked on the #388 design-system sync epic (all UI work is currently gated on #388). Starting with a docs-first design pass.

🔨 Claiming — top eligible pick from the queue (Tier 2, milestone "Scheduling: refactor + distribution", priority:medium; #380 in-progress and #70 blocked-by #380 both excluded). **Scope for this session:** the **non-UI core** only — schema/persistence for the pad-to-boundary option, the boundary-snapping logic in the playout builder (reusing existing Filler machinery), API surface, and EPG output reflecting the padded boundaries, with tests. **The SPA setting UI is deferred** and will be filed as a follow-up **blocked on the #388 design-system sync epic** (all UI work is currently gated on #388). Starting with a docs-first design pass.
timothy removed the in-progress label 2026-07-17 03:27:43 +02:00
Author
Owner

✅ Closed via PR #393 (merged to main, 33d6c607).

What was done: #77's core turned out to be already implemented (upstream ErsatzTV machinery carried into the fork), so the session was scoped to verifying + documenting the existing behaviour rather than building it anew.

  • Root cause of the mismatch: the issue's premise ("reverses an earlier not-adopting call") predates the fork import — the FillerMode.Pad + PadToNearestMinute machinery (and Sequential's pad_to_next/pad_until) came in with upstream, so the feature was live but unrecorded in our docs and not covered by a fork test. This is a "docs/coverage gap," not a code gap.

Files changed (no production code):

  • ErsatzTV.Core.Tests/Scheduling/Goldens/PlayoutBuildGoldenTests.cs — new Classic_clock_padded golden+assertion (real PlayoutBuilder, PostRoll FillerMode.Pad(15) → content lands on :15); Verify split into reusable CompareGolden.
  • ErsatzTV.Core.Tests/Channels/ChannelGuideProjectorClockPadTests.cs — new; proves the guide projection stops programmes on the padded boundary (XMLTV half).
  • ErsatzTV.Core.Tests/Scheduling/Goldens/Goldens/classic-clock-padded.txt — golden.
  • Docs: decisions.md (2026-07-17 entry), domain-model.md (clock-boundary row), testing.md (map + count).

Verification: full ErsatzTV.Core.Tests green under TZ=UTC (542 passed); cold independent review = MERGEABLE (confirmed both tests non-vacuous); CI all-green on the merged head.

Deferred / follow-ups filed:

  • #392 — one-click per-channel/schedule clock-align toggle + 60-min increment option (the only real residual; mostly UI). Blocked-by #388.
  • Pad-per-slot vs pad-per-episode (Tunarr distinction) decision rides along with #392.

Docs updated: decisions.md, domain-model.md, testing.md (all in-PR).

✅ **Closed via PR #393** (merged to main, `33d6c607`). **What was done:** #77's core turned out to be **already implemented** (upstream ErsatzTV machinery carried into the fork), so the session was scoped to *verifying + documenting* the existing behaviour rather than building it anew. - **Root cause of the mismatch:** the issue's premise ("reverses an earlier not-adopting call") predates the fork import — the `FillerMode.Pad` + `PadToNearestMinute` machinery (and Sequential's `pad_to_next`/`pad_until`) came in with upstream, so the feature was live but unrecorded in our docs and not covered by a fork test. This is a "docs/coverage gap," not a code gap. **Files changed (no production code):** - `ErsatzTV.Core.Tests/Scheduling/Goldens/PlayoutBuildGoldenTests.cs` — new `Classic_clock_padded` golden+assertion (real `PlayoutBuilder`, PostRoll `FillerMode.Pad(15)` → content lands on :15); `Verify` split into reusable `CompareGolden`. - `ErsatzTV.Core.Tests/Channels/ChannelGuideProjectorClockPadTests.cs` — new; proves the guide projection stops programmes on the padded boundary (XMLTV half). - `ErsatzTV.Core.Tests/Scheduling/Goldens/Goldens/classic-clock-padded.txt` — golden. - Docs: `decisions.md` (2026-07-17 entry), `domain-model.md` (clock-boundary row), `testing.md` (map + count). **Verification:** full `ErsatzTV.Core.Tests` green under `TZ=UTC` (542 passed); cold independent review = MERGEABLE (confirmed both tests non-vacuous); CI all-green on the merged head. **Deferred / follow-ups filed:** - **#392** — one-click per-channel/schedule clock-align toggle + 60-min increment option (the only real residual; mostly UI). Blocked-by #388. - Pad-per-slot vs pad-per-episode (Tunarr distinction) decision rides along with #392. **Docs updated:** decisions.md, domain-model.md, testing.md (all in-PR).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#77