Mid-roll break logic in schedule engine #6

Closed
opened 2026-07-12 05:47:57 +00:00 by GKaszewski · 0 comments
Owner

Parent

#2

What to build

Wire the MidRollRule (already modeled on ProgrammingBlock) into the schedule engine. When a program item is longer than the configured break interval, split it into segments with interstitial slots at break points.

Break point selection: if the MediaItem has chapters and prefer_chapters is true, use chapter boundaries as break points. Otherwise, use the fallback_interval_mins to break at fixed intervals. Fill break slots with interstitials from the library matching the rule's pool_filter, up to break_duration_secs total.

The split program segments should appear as separate ScheduledSlots with adjusted start/end times. Each break slot contains interstitial content. The Playout Service will later inject SCTE-35 markers at these boundaries.

Acceptance criteria

  • A 2-hour movie in a block with MidRollRule (interval 30min, break 2min) produces multiple program segments + break slots
  • When the movie has chapters and prefer_chapters is true, breaks align to chapter boundaries
  • When the movie has no chapters, breaks fall at fixed intervals
  • Break slots are filled with interstitials from the library matching pool_filter
  • Short items (under the break interval) are not split
  • Test: movie with chapters breaks at chapter points
  • Test: movie without chapters breaks at fixed intervals
  • Test: item shorter than interval is not split

Blocked by

  • #4 (Interstitial insertion — shared interstitial sourcing logic)
  • #5 (Chapter extraction — chapters must be available on MediaItem)
## Parent #2 ## What to build Wire the MidRollRule (already modeled on ProgrammingBlock) into the schedule engine. When a program item is longer than the configured break interval, split it into segments with interstitial slots at break points. Break point selection: if the MediaItem has chapters and `prefer_chapters` is true, use chapter boundaries as break points. Otherwise, use the `fallback_interval_mins` to break at fixed intervals. Fill break slots with interstitials from the library matching the rule's `pool_filter`, up to `break_duration_secs` total. The split program segments should appear as separate ScheduledSlots with adjusted start/end times. Each break slot contains interstitial content. The Playout Service will later inject SCTE-35 markers at these boundaries. ## Acceptance criteria - [ ] A 2-hour movie in a block with MidRollRule (interval 30min, break 2min) produces multiple program segments + break slots - [ ] When the movie has chapters and prefer_chapters is true, breaks align to chapter boundaries - [ ] When the movie has no chapters, breaks fall at fixed intervals - [ ] Break slots are filled with interstitials from the library matching pool_filter - [ ] Short items (under the break interval) are not split - [ ] Test: movie with chapters breaks at chapter points - [ ] Test: movie without chapters breaks at fixed intervals - [ ] Test: item shorter than interval is not split ## Blocked by - #4 (Interstitial insertion — shared interstitial sourcing logic) - #5 (Chapter extraction — chapters must be available on MediaItem)
GKaszewski added the ready-for-agent label 2026-07-12 05:47:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GKaszewski/k-tv#6