Skip to content

Commit 72e40f6

Browse files
authored
feat: expose playoutPersistentState to blueprint syncIngestUpdateToPartInstance SOFIE-455 (Sofie-Automation#1722)
1 parent 17ccacf commit 72e40f6

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/blueprints-integration/src/api/showStyle.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ export interface ShowStyleBlueprintManifest<
117117
context: ISyncIngestUpdateToPartInstanceContext,
118118
existingPartInstance: BlueprintSyncIngestPartInstance,
119119
newData: BlueprintSyncIngestNewData,
120-
playoutStatus: 'previous' | 'current' | 'next'
120+
playoutStatus: 'previous' | 'current' | 'next',
121+
playoutPersistentState: BlueprintPlayoutPersistentStore<TimelinePersistentState>
121122
) => void
122123

123124
/**

packages/job-worker/src/ingest/syncChangesToPartInstance.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { setNextPart } from '../playout/setNext.js'
3636
import { PartId, RundownId, SegmentId } from '@sofie-automation/corelib/dist/dataModel/Ids'
3737
import type { WrappedShowStyleBlueprint } from '../blueprints/cache.js'
3838
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
39+
import { PersistentPlayoutStateStore } from '../blueprints/context/services/PersistantStateStore.js'
3940

4041
type PlayStatus = 'previous' | 'current' | 'next'
4142
export interface PartInstanceToSync {
@@ -152,18 +153,26 @@ export class SyncChangesToPartInstancesWorker {
152153
if (!this.#blueprint.blueprint.syncIngestUpdateToPartInstance)
153154
throw new Error('Blueprint does not have syncIngestUpdateToPartInstance')
154155

156+
const blueprintPersistentState = new PersistentPlayoutStateStore(
157+
this.#playoutModel.playlist.privatePlayoutPersistentState,
158+
this.#playoutModel.playlist.publicPlayoutPersistentState
159+
)
160+
155161
// The blueprint handles what in the updated part is going to be synced into the partInstance:
156162
this.#blueprint.blueprint.syncIngestUpdateToPartInstance(
157163
syncContext,
158164
existingResultPartInstance,
159165
newResultData,
160-
instanceToSync.playStatus
166+
instanceToSync.playStatus,
167+
blueprintPersistentState
161168
)
162169

163170
// Persist t-timer changes
164171
for (const timer of syncContext.changedTTimers) {
165172
this.#playoutModel.updateTTimer(timer)
166173
}
174+
175+
blueprintPersistentState.saveToModel(this.#playoutModel)
167176
} catch (err) {
168177
logger.error(`Error in showStyleBlueprint.syncIngestUpdateToPartInstance: ${stringifyError(err)}`)
169178

0 commit comments

Comments
 (0)