Skip to content

Commit 1044d93

Browse files
committed
feat: time of day pieces SOFIE-197 (#43)
1 parent ad450c3 commit 1044d93

File tree

64 files changed

+1153
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1153
-468
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
},

meteor/server/api/ingest/packageInfo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export async function onUpdatedPackageInfo(packageId: ExpectedPackageId, _doc: P
3535
case ExpectedPackageDBType.ADLIB_ACTION:
3636
case ExpectedPackageDBType.BASELINE_ADLIB_PIECE:
3737
case ExpectedPackageDBType.BASELINE_ADLIB_ACTION:
38+
case ExpectedPackageDBType.BASELINE_PIECE:
3839
case ExpectedPackageDBType.RUNDOWN_BASELINE_OBJECTS:
3940
onUpdatedPackageInfoForRundownDebounce(pkg)
4041
break

meteor/server/api/rest/v1/typeConversion.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ export function studioSettingsFrom(apiStudioSettings: APIStudioSettings): Comple
388388
allowPieceDirectPlay: apiStudioSettings.allowPieceDirectPlay ?? true, // Backwards compatible
389389
enableBuckets: apiStudioSettings.enableBuckets ?? true, // Backwards compatible
390390
enableEvaluationForm: apiStudioSettings.enableEvaluationForm ?? true, // Backwards compatible
391+
rundownGlobalPiecesPrepareTime: apiStudioSettings.rundownGlobalPiecesPrepareTime,
391392
}
392393
}
393394

@@ -413,6 +414,7 @@ export function APIStudioSettingsFrom(settings: IStudioSettings): Complete<APISt
413414
allowPieceDirectPlay: settings.allowPieceDirectPlay,
414415
enableBuckets: settings.enableBuckets,
415416
enableEvaluationForm: settings.enableEvaluationForm,
417+
rundownGlobalPiecesPrepareTime: settings.rundownGlobalPiecesPrepareTime,
416418
}
417419
}
418420

meteor/server/lib/rest/v1/studios.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,5 @@ export interface APIStudioSettings {
222222
allowPieceDirectPlay?: boolean
223223
enableBuckets?: boolean
224224
enableEvaluationForm?: boolean
225+
rundownGlobalPiecesPrepareTime?: number
225226
}

meteor/server/migration/1_50_0.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ export const addSteps = addMigrationSteps('1.50.0', [
917917

918918
const partIdLookup = new Map<PieceId | AdLibActionId | RundownBaselineAdLibActionId, PartId>()
919919
for (const piece of pieces) {
920-
partIdLookup.set(piece._id, piece.startPartId)
920+
if (piece.startPartId) partIdLookup.set(piece._id, piece.startPartId)
921921
}
922922
for (const adlib of adlibPieces) {
923923
if (adlib.partId) partIdLookup.set(adlib._id, adlib.partId)

meteor/server/publications/pieceContentStatusUI/rundown/regenerateItems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export async function regenerateForPieceIds(
107107
{
108108
_id: protectString(`piece_${pieceId}`),
109109

110-
partId: pieceDoc.startPartId,
110+
partId: pieceDoc.startPartId ?? undefined,
111111
rundownId: pieceDoc.startRundownId,
112112
pieceId: pieceId,
113113

@@ -180,7 +180,7 @@ export async function regenerateForPieceInstanceIds(
180180
const res: UIPieceContentStatus = {
181181
_id: protectString(`piece_${pieceId}`),
182182

183-
partId: pieceDoc.piece.startPartId,
183+
partId: pieceDoc.piece.startPartId ?? undefined,
184184
rundownId: pieceDoc.rundownId,
185185
pieceId: pieceId,
186186

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import type {
3535
IBlueprintSegment,
3636
IBlueprintPiece,
3737
IBlueprintPart,
38+
IBlueprintRundownPiece,
39+
IBlueprintRundownPieceDB,
3840
} from '../documents'
3941
import type { IBlueprintShowStyleVariant, IOutputLayer, ISourceLayer } from '../showStyle'
4042
import type { TSR, OnGenerateTimelineObj, TimelineObjectCoreExt } from '../timeline'
@@ -260,6 +262,7 @@ export interface BlueprintResultRundown {
260262
rundown: IBlueprintRundown
261263
globalAdLibPieces: IBlueprintAdLibPiece[]
262264
globalActions: IBlueprintActionManifest[]
265+
globalPieces: IBlueprintRundownPiece[]
263266
baseline: BlueprintResultBaseline
264267
}
265268
export interface BlueprintResultSegment {
@@ -286,6 +289,11 @@ export interface BlueprintSyncIngestNewData {
286289
actions: IBlueprintActionManifest[]
287290
/** A list of adlibs that have pieceInstances in the partInstance in question */
288291
referencedAdlibs: IBlueprintAdLibPieceDB[]
292+
/**
293+
* The list of pieces which belong to the Rundown, and may be active
294+
* Note: Some of these may have played and been stopped before the current PartInstance
295+
*/
296+
rundownPieces: IBlueprintRundownPieceDB[]
289297
}
290298

291299
// TODO: add something like this later?

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'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { IBlueprintPieceGeneric } from './pieceGeneric'
2+
3+
/**
4+
* A variant of a Piece, that is owned by the Rundown.
5+
* This
6+
*/
7+
export interface IBlueprintRundownPiece<TPrivateData = unknown, TPublicData = unknown>
8+
extends Omit<IBlueprintPieceGeneric<TPrivateData, TPublicData>, 'lifespan'> {
9+
/** When the piece should be active on the timeline. */
10+
enable: {
11+
start: number
12+
duration?: number
13+
14+
// For now, these pieces are always absolute (using wall time) rather than relative to the rundown
15+
isAbsolute: true
16+
}
17+
18+
/** 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 */
19+
virtual?: boolean
20+
21+
/** Whether the piece affects the output of the Studio or is describing an invisible state within the Studio */
22+
notInVision?: boolean
23+
}
24+
25+
/** The Rundown piece sent from Core */
26+
export interface IBlueprintRundownPieceDB<TPrivateData = unknown, TPublicData = unknown>
27+
extends IBlueprintRundownPiece<TPrivateData, TPublicData> {
28+
_id: string
29+
}

packages/corelib/src/dataModel/ExpectedPackages.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export type ExpectedPackageFromRundownBaseline =
3232
| ExpectedPackageDBFromBaselineAdLibAction
3333
| ExpectedPackageDBFromBaselineAdLibPiece
3434
| ExpectedPackageDBFromRundownBaselineObjects
35+
| ExpectedPackageDBFromBaselinePiece
3536

3637
export type ExpectedPackageDBFromBucket = ExpectedPackageDBFromBucketAdLib | ExpectedPackageDBFromBucketAdLibAction
3738

@@ -47,6 +48,7 @@ export enum ExpectedPackageDBType {
4748
ADLIB_ACTION = 'adlib_action',
4849
BASELINE_ADLIB_PIECE = 'baseline_adlib_piece',
4950
BASELINE_ADLIB_ACTION = 'baseline_adlib_action',
51+
BASELINE_PIECE = 'baseline_piece',
5052
BUCKET_ADLIB = 'bucket_adlib',
5153
BUCKET_ADLIB_ACTION = 'bucket_adlib_action',
5254
RUNDOWN_BASELINE_OBJECTS = 'rundown_baseline_objects',
@@ -79,6 +81,13 @@ export interface ExpectedPackageDBFromPiece extends ExpectedPackageDBBase {
7981
/** The rundown of the Piece this package belongs to */
8082
rundownId: RundownId
8183
}
84+
export interface ExpectedPackageDBFromBaselinePiece extends ExpectedPackageDBBase {
85+
fromPieceType: ExpectedPackageDBType.BASELINE_PIECE
86+
/** The Piece this package belongs to */
87+
pieceId: PieceId
88+
/** The rundown of the Piece this package belongs to */
89+
rundownId: RundownId
90+
}
8291

8392
export interface ExpectedPackageDBFromBaselineAdLibPiece extends ExpectedPackageDBBase {
8493
fromPieceType: ExpectedPackageDBType.BASELINE_ADLIB_PIECE

0 commit comments

Comments
 (0)