Skip to content

Commit

Permalink
wip: sync ingest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jan 15, 2025
1 parent 64edef7 commit 3096a98
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/blueprints-integration/src/api/showStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import type {
IBlueprintPiece,
IBlueprintPart,
IBlueprintRundownPiece,
IBlueprintRundownPieceDB,
} from '../documents'
import type { IBlueprintShowStyleVariant, IOutputLayer, ISourceLayer } from '../showStyle'
import type { TSR, OnGenerateTimelineObj, TimelineObjectCoreExt } from '../timeline'
Expand Down Expand Up @@ -282,6 +283,11 @@ export interface BlueprintSyncIngestNewData {
actions: IBlueprintActionManifest[]
/** A list of adlibs that have pieceInstances in the partInstance in question */
referencedAdlibs: IBlueprintAdLibPieceDB[]
/**
* The list of pieces which belong to the Rundown, and may be active
* Note: Some of these may have played and been stopped before the current PartInstance
*/
rundownPieces: IBlueprintRundownPieceDB[]
}

// TODO: add something like this later?
Expand Down
28 changes: 27 additions & 1 deletion packages/job-worker/src/blueprints/context/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { AdLibAction } from '@sofie-automation/corelib/dist/dataModel/AdlibActio
import { AdLibPiece } from '@sofie-automation/corelib/dist/dataModel/AdLibPiece'
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
import { DBPartInstance } from '@sofie-automation/corelib/dist/dataModel/PartInstance'
import { deserializePieceTimelineObjectsBlob, PieceGeneric } from '@sofie-automation/corelib/dist/dataModel/Piece'
import {
deserializePieceTimelineObjectsBlob,
Piece,
PieceGeneric,
} from '@sofie-automation/corelib/dist/dataModel/Piece'
import {
PieceInstance,
PieceInstancePiece,
Expand Down Expand Up @@ -38,6 +42,7 @@ import {
IBlueprintPieceInstance,
IBlueprintResolvedPieceInstance,
IBlueprintRundownDB,
IBlueprintRundownPieceDB,
IBlueprintRundownPlaylist,
IBlueprintSegmentDB,
IBlueprintSegmentRundown,
Expand Down Expand Up @@ -251,6 +256,27 @@ export function convertPieceToBlueprints(piece: ReadonlyDeep<PieceInstancePiece>
return obj
}

/**
* Convert a Rundown owned Piece into IBlueprintAdLibPieceDB, for passing into the blueprints
* Note: This does not check whether has the correct ownership
* @param piece the Piece to convert
* @returns a cloned complete and clean IBlueprintRundownPieceDB
*/
export function convertRundownPieceToBlueprints(piece: ReadonlyDeep<Piece>): IBlueprintRundownPieceDB {
const obj: Complete<IBlueprintRundownPieceDB> = {
...convertPieceGenericToBlueprintsInner(piece),
_id: unprotectString(piece._id),
enable: {
...piece.enable,
start: piece.enable.start === 'now' ? 0 : piece.enable.start,
isAbsolute: true,
},
virtual: piece.virtual,
notInVision: piece.notInVision,
}
return obj
}

/**
* Convert a DBPart into IBlueprintPartDB, for passing into the blueprints
* @param part the Part to convert
Expand Down
2 changes: 2 additions & 0 deletions packages/job-worker/src/ingest/syncChangesToPartInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
convertPartInstanceToBlueprints,
convertPartToBlueprints,
convertPieceInstanceToBlueprints,
convertRundownPieceToBlueprints,
} from '../blueprints/context/lib'
import { validateAdlibTestingPartInstanceProperties } from '../playout/adlibTesting'
import { ReadonlyDeep } from 'type-fest'
Expand Down Expand Up @@ -167,6 +168,7 @@ export async function syncChangesToPartInstances(
adLibPieces: newPart && ingestPart ? ingestPart.adLibPieces.map(convertAdLibPieceToBlueprints) : [],
actions: newPart && ingestPart ? ingestPart.adLibActions.map(convertAdLibActionToBlueprints) : [],
referencedAdlibs: referencedAdlibs,
rundownPieces: ingestModel.getGlobalPieces().map(convertRundownPieceToBlueprints),
}

const partInstanceSnapshot = existingPartInstance.snapshotMakeCopy()
Expand Down

0 comments on commit 3096a98

Please sign in to comment.