Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: time of day pieces #43

Draft
wants to merge 14 commits into
base: bbc-release52
Choose a base branch
from
1 change: 1 addition & 0 deletions meteor/__mocks__/helpers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export async function setupMockShowStyleBlueprint(
rundown,
globalAdLibPieces: [],
globalActions: [],
globalPieces: [],
baseline: { timelineObjects: [] },
}
},
Expand Down
1 change: 1 addition & 0 deletions meteor/server/api/ingest/packageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export async function onUpdatedPackageInfo(packageId: ExpectedPackageId, _doc: P
case ExpectedPackageDBType.ADLIB_ACTION:
case ExpectedPackageDBType.BASELINE_ADLIB_PIECE:
case ExpectedPackageDBType.BASELINE_ADLIB_ACTION:
case ExpectedPackageDBType.BASELINE_PIECE:
case ExpectedPackageDBType.RUNDOWN_BASELINE_OBJECTS:
onUpdatedPackageInfoForRundownDebounce(pkg)
break
Expand Down
2 changes: 1 addition & 1 deletion meteor/server/migration/1_50_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ export const addSteps = addMigrationSteps('1.50.0', [

const partIdLookup = new Map<PieceId | AdLibActionId | RundownBaselineAdLibActionId, PartId>()
for (const piece of pieces) {
partIdLookup.set(piece._id, piece.startPartId)
if (piece.startPartId) partIdLookup.set(piece._id, piece.startPartId)
}
for (const adlib of adlibPieces) {
if (adlib.partId) partIdLookup.set(adlib._id, adlib.partId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function regenerateForPieceIds(
const res = await regenerateGenericPiece(contentCache, uiStudio, pieceDoc, pieceDoc.sourceLayerId, {
_id: protectString(`piece_${pieceId}`),

partId: pieceDoc.startPartId,
partId: pieceDoc.startPartId ?? undefined,
rundownId: pieceDoc.startRundownId,
pieceId: pieceId,

Expand Down Expand Up @@ -162,7 +162,7 @@ export async function regenerateForPieceInstanceIds(
const res: UIPieceContentStatus = {
_id: protectString(`piece_${pieceId}`),

partId: pieceDoc.piece.startPartId,
partId: pieceDoc.piece.startPartId ?? undefined,
rundownId: pieceDoc.rundownId,
pieceId: pieceId,

Expand Down
8 changes: 8 additions & 0 deletions packages/blueprints-integration/src/api/showStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import type {
IBlueprintSegment,
IBlueprintPiece,
IBlueprintPart,
IBlueprintRundownPiece,
IBlueprintRundownPieceDB,
} from '../documents'
import type { IBlueprintShowStyleVariant, IOutputLayer, ISourceLayer } from '../showStyle'
import type { TSR, OnGenerateTimelineObj, TimelineObjectCoreExt } from '../timeline'
Expand Down Expand Up @@ -254,6 +256,7 @@ export interface BlueprintResultRundown {
rundown: IBlueprintRundown
globalAdLibPieces: IBlueprintAdLibPiece[]
globalActions: IBlueprintActionManifest[]
globalPieces: IBlueprintRundownPiece[]
baseline: BlueprintResultBaseline
}
export interface BlueprintResultSegment {
Expand All @@ -280,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
1 change: 1 addition & 0 deletions packages/blueprints-integration/src/documents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export * from './pieceInstance'
export * from './pieceGeneric'
export * from './playlistTiming'
export * from './rundown'
export * from './rundownPiece'
export * from './rundownPlaylist'
export * from './segment'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { IBlueprintPieceDB } from './piece'
export interface IBlueprintPieceInstance<TPrivateData = unknown, TPublicData = unknown> {
_id: string
/** The part instace this piece belongs to */
partInstanceId: string
partInstanceId: string | null

/** If this piece has been created play-time using an AdLibPiece, this should be set to it's source piece */
adLibSourceId?: string
Expand Down
32 changes: 32 additions & 0 deletions packages/blueprints-integration/src/documents/rundownPiece.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { IBlueprintPieceGeneric } from './pieceGeneric'

/**
* A variant of a Piece, that is owned by the Rundown.
* This
*/
export interface IBlueprintRundownPiece<TPrivateData = unknown, TPublicData = unknown>
extends Omit<IBlueprintPieceGeneric<TPrivateData, TPublicData>, 'lifespan'> {
/** When the piece should be active on the timeline. */
enable: {
start: number
duration?: number

// For now, these pieces are always absolute (using wall time) rather than relative to the rundown
isAbsolute: true
}

// /** Whether and how the piece is infinite */
// lifespan: PieceLifespan

/** 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 */
virtual?: boolean

/** Whether the piece affects the output of the Studio or is describing an invisible state within the Studio */
notInVision?: boolean
}

/** The Rundown piece sent from Core */
export interface IBlueprintRundownPieceDB<TPrivateData = unknown, TPublicData = unknown>
extends IBlueprintRundownPiece<TPrivateData, TPublicData> {
_id: string
}
9 changes: 9 additions & 0 deletions packages/corelib/src/dataModel/ExpectedPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type ExpectedPackageFromRundownBaseline =
| ExpectedPackageDBFromBaselineAdLibAction
| ExpectedPackageDBFromBaselineAdLibPiece
| ExpectedPackageDBFromRundownBaselineObjects
| ExpectedPackageDBFromBaselinePiece

export type ExpectedPackageDBFromBucket = ExpectedPackageDBFromBucketAdLib | ExpectedPackageDBFromBucketAdLibAction

Expand All @@ -47,6 +48,7 @@ export enum ExpectedPackageDBType {
ADLIB_ACTION = 'adlib_action',
BASELINE_ADLIB_PIECE = 'baseline_adlib_piece',
BASELINE_ADLIB_ACTION = 'baseline_adlib_action',
BASELINE_PIECE = 'baseline_piece',
BUCKET_ADLIB = 'bucket_adlib',
BUCKET_ADLIB_ACTION = 'bucket_adlib_action',
RUNDOWN_BASELINE_OBJECTS = 'rundown_baseline_objects',
Expand Down Expand Up @@ -79,6 +81,13 @@ export interface ExpectedPackageDBFromPiece extends ExpectedPackageDBBase {
/** The rundown of the Piece this package belongs to */
rundownId: RundownId
}
export interface ExpectedPackageDBFromBaselinePiece extends ExpectedPackageDBBase {
fromPieceType: ExpectedPackageDBType.BASELINE_PIECE
/** The Piece this package belongs to */
pieceId: PieceId
/** The rundown of the Piece this package belongs to */
rundownId: RundownId
}

export interface ExpectedPackageDBFromBaselineAdLibPiece extends ExpectedPackageDBBase {
fromPieceType: ExpectedPackageDBType.BASELINE_ADLIB_PIECE
Expand Down
13 changes: 11 additions & 2 deletions packages/corelib/src/dataModel/Piece.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export interface PieceGeneric extends Omit<IBlueprintPieceGeneric, 'content'> {
export interface Piece
extends PieceGeneric,
Omit<IBlueprintPieceDB, '_id' | 'content' | 'userEditOperations' | 'userEditProperties'> {
/** Timeline enabler. When the piece should be active on the timeline. */
enable: {
start: number | 'now' // TODO - now will be removed from this eventually, but as it is not an acceptable value 99% of the time, that is not really breaking
duration?: number

// Pieces owned by the Rundown should always be absolute
isAbsolute?: boolean
}

/**
* This is the id of the rundown this piece starts playing in.
* Currently this is the only rundown the piece could be playing in
Expand All @@ -62,12 +71,12 @@ export interface Piece
* This is the id of the segment this piece starts playing in.
* It is the only segment the piece could be playing in, unless the piece has a lifespan which spans beyond the segment
*/
startSegmentId: SegmentId
startSegmentId: SegmentId | null
/**
* This is the id of the part this piece starts playing in.
* If the lifespan is WithinPart, it is the only part the piece could be playing in.
*/
startPartId: PartId
startPartId: PartId | null

/** Whether this piece is a special piece */
pieceType: IBlueprintPieceType
Expand Down
9 changes: 7 additions & 2 deletions packages/corelib/src/dataModel/PieceInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ export interface PieceInstance {
_id: PieceInstanceId
/** The rundown this piece belongs to */
rundownId: RundownId
/** The part instace this piece belongs to */
partInstanceId: PartInstanceId
/**
* The part instance this piece belongs to.
* If null, the instance belongs to the rundown itself.
*/
partInstanceId: PartInstanceId | null

/** Whether this PieceInstance is a temprorary wrapping of a Piece */
readonly isTemporary?: boolean
Expand All @@ -48,6 +51,8 @@ export interface PieceInstance {

piece: PieceInstancePiece

// owner: 'part' | 'rundown'

/** A flag to signal a given Piece has been deactivated manually */
disabled?: boolean

Expand Down
2 changes: 1 addition & 1 deletion packages/corelib/src/dataModel/RundownPlaylist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface ABSessionInfo {
/** Set if the session is being used by an infinite PieceInstance */
infiniteInstanceId?: PieceInstanceInfiniteId
/** Set to the PartInstances this session is used by, if not just used for lookahead */
partInstanceIds?: Array<PartInstanceId>
partInstanceIds?: Array<PartInstanceId | null>
}

export interface ABSessionAssignment {
Expand Down
Loading
Loading