Skip to content

feat: Improve blueprint timing information#80

Open
rjmunro wants to merge 4 commits intofeat/top-bar-t-timersfrom
rjmunro/t-timers-extra
Open

feat: Improve blueprint timing information#80
rjmunro wants to merge 4 commits intofeat/top-bar-t-timersfrom
rjmunro/t-timers-extra

Conversation

@rjmunro
Copy link
Copy Markdown
Collaborator

@rjmunro rjmunro commented Mar 26, 2026

About the Contributor

This pull request is posted on behalf of the BBC.

Type of Contribution

This is a Feature

Current Behavior

It's hard to access timing information from blueprints that can be useful, for example, in setting T-Timers.

New Behavior

Blueprint context now includes a timing property with information about the current rundown playlist timing.
Extra methods have been added to T-Timers to get information and update timings.

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

This affects T-Timers and blueprint intergration.

Time Frame

  • This Bug Fix is critical for us, please review and merge it as soon as possible.

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@rjmunro rjmunro force-pushed the rjmunro/t-timers-extra branch 4 times, most recently from afb4e9c to 82659e0 Compare March 26, 2026 22:38
rjmunro added 4 commits March 27, 2026 11:34
Expose mode and state properties separately in IPlaylistTTimer,
matching the RundownTTimer database model structure.

This removes the computed IPlaylistTTimerState abstraction layer
and allows blueprints to access timer.mode and timer.state directly,
consistent with how the WebUI already works.

Changes:
- Add mode: RundownTTimerMode | null to IPlaylistTTimer
- Add state: TimerState | null to IPlaylistTTimer
- Remove IPlaylistTTimerState union and related interfaces
- Simplify PlaylistTTimerImpl getters to return DB properties directly
- Remove unnecessary tests
…own timing

Add comprehensive T-Timer manipulation methods to IPlaylistTTimer interface:
- setDuration(duration) - Reset timer to a specific duration
- setDuration(options) - Independently update original and/or current duration
  - original: Duration timer resets to on restart()
  - current: Current countdown value
  - Preserves elapsed time when only original is provided

Add T-Timer query methods:
- getCurrentDuration() - Get current timer value in milliseconds
- getZeroTime() - Get absolute timestamp of timer's zero point
- getProjectedDuration() - Get projected countdown value (for over/under calculation)
- getProjectedZeroTime() - Get projected zero time timestamp

Add shared utility functions in corelib:
- timerStateToDuration() - Calculate current duration from TimerState (already existed)
- timerStateToZeroTime() - Calculate zero time from TimerState (new)
- Both shared between backend and frontend for consistent calculations

Expose timing information to blueprints:
- Add timing field to IBlueprintSegmentRundown interface
- Exposes RundownPlaylistTiming via context.rundown.timing
- Removes need for accessing private _rundown property

Implementation:
- PlaylistTTimerImpl implements all new methods using shared utilities
- Update convertRundownToBlueprintSegmentRundown() to include timing
- All methods properly handle paused/running states and edge cases

Related to BBC-SOFIE-454
Add startedPlayback property to IRundownContext interface and implement
as getters in RundownActivationContext and SyncIngestUpdateToPartInstanceContext.
This provides blueprints access to playlist.startedPlayback timing data.

Part of BBC-SOFIE-454
@rjmunro rjmunro force-pushed the rjmunro/t-timers-extra branch from 82659e0 to 93069ea Compare March 27, 2026 11:56
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.

2 participants