Skip to content

Commit 8cb3b9d

Browse files
committed
wip
1 parent 239bccb commit 8cb3b9d

File tree

14 files changed

+45
-16
lines changed

14 files changed

+45
-16
lines changed

meteor/__mocks__/helpers/database.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ export async function setupMockShowStyleBlueprint(
468468
rundown,
469469
globalAdLibPieces: [],
470470
globalActions: [],
471+
globalPieces: [],
471472
baseline: { timelineObjects: [] },
472473
}
473474
},

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import type {
3535
IBlueprintSegment,
3636
IBlueprintPiece,
3737
IBlueprintPart,
38+
IBlueprintRundownPiece,
3839
} from '../documents'
3940
import type { IBlueprintShowStyleVariant, IOutputLayer, ISourceLayer } from '../showStyle'
4041
import type { TSR, OnGenerateTimelineObj, TimelineObjectCoreExt } from '../timeline'
@@ -254,6 +255,7 @@ export interface BlueprintResultRundown {
254255
rundown: IBlueprintRundown
255256
globalAdLibPieces: IBlueprintAdLibPiece[]
256257
globalActions: IBlueprintActionManifest[]
258+
globalPieces: IBlueprintRundownPiece[]
257259
baseline: BlueprintResultBaseline
258260
}
259261
export interface BlueprintResultSegment {

packages/blueprints-integration/src/documents/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export * from './pieceInstance'
77
export * from './pieceGeneric'
88
export * from './playlistTiming'
99
export * from './rundown'
10+
export * from './rundownPiece'
1011
export * from './rundownPlaylist'
1112
export * from './segment'

packages/blueprints-integration/src/documents/rundownPiece.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IBlueprintPieceGeneric } from './pieceGeneric'
55
* This
66
*/
77
export interface IBlueprintRundownPiece<TPrivateData = unknown, TPublicData = unknown>
8-
extends IBlueprintPieceGeneric<TPrivateData, TPublicData> {
8+
extends Omit<IBlueprintPieceGeneric<TPrivateData, TPublicData>, 'lifespan'> {
99
/** When the piece should be active on the timeline. */
1010
enable: {
1111
start: number
@@ -15,6 +15,9 @@ export interface IBlueprintRundownPiece<TPrivateData = unknown, TPublicData = un
1515
isAbsolute: true
1616
}
1717

18+
// /** Whether and how the piece is infinite */
19+
// lifespan: PieceLifespan
20+
1821
/** Whether the piece is a real piece, or exists as a marker to stop an infinite piece. If virtual, it does not add any contents to the timeline */
1922
virtual?: boolean
2023

packages/corelib/src/dataModel/Piece.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ export interface Piece
6262
* This is the id of the segment this piece starts playing in.
6363
* It is the only segment the piece could be playing in, unless the piece has a lifespan which spans beyond the segment
6464
*/
65-
startSegmentId: SegmentId
65+
startSegmentId: SegmentId | null
6666
/**
6767
* This is the id of the part this piece starts playing in.
6868
* If the lifespan is WithinPart, it is the only part the piece could be playing in.
6969
*/
70-
startPartId: PartId
70+
startPartId: PartId | null
7171

7272
/** Whether this piece is a special piece */
7373
pieceType: IBlueprintPieceType

packages/job-worker/src/__mocks__/context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ const MockShowStyleBlueprint: () => ShowStyleBlueprintManifest = () => ({
356356
rundown,
357357
globalAdLibPieces: [],
358358
globalActions: [],
359+
globalPieces: [],
359360
baseline: { timelineObjects: [] },
360361
}
361362
},

packages/job-worker/src/blueprints/context/services/PartAndPieceInstanceActionService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ export class PartAndPieceInstanceActionService {
237237
})
238238
if (!pieceDB) throw new Error(`Cannot find Piece ${piece._id}`)
239239

240+
if (!pieceDB.startPartId || !pieceDB.startSegmentId)
241+
throw new Error(`Piece ${piece._id} does not belong to a part`)
242+
240243
const rundown = this._playoutModel.getRundown(pieceDB.startRundownId)
241244
const segment = rundown?.getSegment(pieceDB.startSegmentId)
242245
const part = segment?.getPart(pieceDB.startPartId)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function generateExpectedMediaItemsFull(
8989
...generateExpectedMediaItems<ExpectedMediaItemRundown>(
9090
doc._id,
9191
{
92-
partId: doc.startPartId,
92+
partId: doc.startPartId ?? undefined,
9393
rundownId: doc.startRundownId,
9494
},
9595
studioId,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function updateExpectedPlayoutItemsForPartModel(context: JobContext, part
9393
const expectedPlayoutItems: ExpectedPlayoutItemRundown[] = []
9494
for (const piece of part.pieces) {
9595
expectedPlayoutItems.push(
96-
...extractExpectedPlayoutItems(studioId, part.part.rundownId, piece.startPartId, piece)
96+
...extractExpectedPlayoutItems(studioId, part.part.rundownId, piece.startPartId ?? undefined, piece)
9797
)
9898
}
9999
for (const piece of part.adLibPieces) {

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ export async function regenerateRundownAndBaselineFromIngestData(
293293
logger.info(`... got ${rundownRes.baseline.timelineObjects.length} objects from baseline.`)
294294
logger.info(`... got ${rundownRes.globalAdLibPieces.length} adLib objects from baseline.`)
295295
logger.info(`... got ${(rundownRes.globalActions || []).length} adLib actions from baseline.`)
296+
logger.info(`... got ${(rundownRes.globalPieces || []).length} global pieces from baseline.`)
296297

297298
const timelineObjectsBlob = serializePieceTimelineObjectsBlob(
298299
postProcessRundownBaselineItems(showStyle.base.blueprintId, rundownRes.baseline.timelineObjects)
@@ -310,8 +311,15 @@ export async function regenerateRundownAndBaselineFromIngestData(
310311
dbRundown._id,
311312
rundownRes.globalActions || []
312313
)
314+
const globalPieces = postProcessGlobalPieces(
315+
context,
316+
showStyle.base.blueprintId,
317+
dbRundown._id,
318+
undefined,
319+
rundownRes.globalPieces || []
320+
)
313321

314-
await ingestModel.setRundownBaseline(timelineObjectsBlob, adlibPieces, adlibActions)
322+
await ingestModel.setRundownBaseline(timelineObjectsBlob, adlibPieces, adlibActions, globalPieces)
315323

316324
await updateExpectedPackagesForRundownBaseline(context, ingestModel, rundownRes.baseline)
317325

0 commit comments

Comments
 (0)