File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
blueprints-integration/src/context
job-worker/src/blueprints/context/services Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,15 @@ export interface IPlaylistTTimer {
8888 */
8989 setEstimateAnchorPart ( partId : string ) : void
9090
91+ /**
92+ * Set the anchor part for automatic estimate calculation, looked up by its externalId.
93+ * This is a convenience method when you know the externalId of the part (e.g. set during ingest)
94+ * but not its internal PartId. If no part with the given externalId is found, this is a no-op.
95+ * Clears any manual estimate set via setEstimateTime/setEstimateDuration.
96+ * @param externalId The externalId of the part to use as timing anchor
97+ */
98+ setEstimateAnchorPartByExternalId ( externalId : string ) : void
99+
91100 /**
92101 * Manually set the estimate as an absolute timestamp
93102 * Use this when you have custom logic for calculating when you expect to reach a timing point.
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type { RundownTTimer, RundownTTimerIndex } from '@sofie-automation/coreli
66import type { TimerState } from '@sofie-automation/corelib/dist/dataModel/RundownPlaylist'
77import type { PartId } from '@sofie-automation/corelib/dist/dataModel/Ids'
88import { assertNever , literal } from '@sofie-automation/corelib/dist/lib'
9- import { protectString } from '@sofie-automation/corelib/dist/protectedString'
9+ import { protectString , unprotectString } from '@sofie-automation/corelib/dist/protectedString'
1010import type { PlayoutModel } from '../../../playout/model/PlayoutModel.js'
1111import { ReadonlyDeep } from 'type-fest'
1212import {
@@ -213,6 +213,13 @@ export class PlaylistTTimerImpl implements IPlaylistTTimer {
213213 recalculateTTimerEstimates ( this . #jobContext, this . #playoutModel)
214214 }
215215
216+ setEstimateAnchorPartByExternalId ( externalId : string ) : void {
217+ const part = this . #playoutModel. getAllOrderedParts ( ) . find ( ( p ) => p . externalId === externalId )
218+ if ( ! part ) return
219+
220+ this . setEstimateAnchorPart ( unprotectString ( part . _id ) )
221+ }
222+
216223 setEstimateTime ( time : number , paused : boolean = false ) : void {
217224 const estimateState : TimerState = paused
218225 ? literal < TimerState > ( { paused : true , duration : time - getCurrentTime ( ) } )
You can’t perform that action at this time.
0 commit comments