Skip to content

Commit

Permalink
feat: adds new type and output metadata on pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusAlbrektsen committed Oct 27, 2023
1 parent bcf7c08 commit 6f8699b
Show file tree
Hide file tree
Showing 34 changed files with 335 additions and 42 deletions.
9 changes: 5 additions & 4 deletions src/tv2-common/actions/CoreActionExecutionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ export class CoreActionExecutionContext implements ITV2ActionExecutionContext {
this.modifiedParts.add('next')
}
}

piece.metaData = {
...piece.metaData,
modifiedByAction: true
if (piece.metaData) {
piece.metaData = {
...piece.metaData,
modifiedByAction: true
}
}

// Regardless of above, let core handle errors
Expand Down
8 changes: 8 additions & 0 deletions src/tv2-common/actions/executeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ import {
TallyTags
} from 'tv2-constants'
import _ = require('underscore')
import { Tv2OutputLayer } from '../../tv2-constants/tv2-output-layer'
import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type'
import { EnableServer } from '../content'
import { GetJinglePartPropertiesFromTableValue } from '../jinglePartProperties'
import { CreateEffektForPartBase, CreateEffektForPartInner, CreateMixTransitionBlueprintPieceForPart } from '../parts'
Expand Down Expand Up @@ -557,6 +559,7 @@ async function executeActionSelectDVE<
const end = parsedCue.end ? calculateTime(parsedCue.end) : undefined

const metaData: DVEPieceMetaData = {
type: Tv2PieceType.SPLIT_SCREEN,
mediaPlayerSessions: dveContainsServer(parsedCue.sources) ? [externalId] : [],
sources: parsedCue.sources,
config: rawTemplate,
Expand Down Expand Up @@ -744,6 +747,7 @@ async function executeActionSelectDVELayout<
}

const newMetaData: DVEPieceMetaData = {
type: Tv2PieceType.SPLIT_SCREEN,
sources,
config: userData.config,
userData: {
Expand Down Expand Up @@ -1018,6 +1022,8 @@ async function executeActionCutToCamera<
sourceLayerId: settings.SourceLayers.Cam,
lifespan: PieceLifespan.WithinPart,
metaData: {
type: Tv2PieceType.CAMERA,
outputLayer: Tv2OutputLayer.PROGRAM,
sisyfosPersistMetaData: {
sisyfosLayers: [],
acceptsPersistedAudio: sourceInfoCam.acceptPersistAudio,
Expand Down Expand Up @@ -1228,6 +1234,8 @@ async function executeActionCutToRemote<
lifespan: PieceLifespan.WithinPart,
toBeQueued: true,
metaData: {
type: Tv2PieceType.REMOTE,
outputLayer: Tv2OutputLayer.PROGRAM,
sisyfosPersistMetaData
},
tags: [GetTagForLive(userData.sourceDefinition)],
Expand Down
6 changes: 6 additions & 0 deletions src/tv2-common/cues/ekstern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
TV2StudioConfigBase
} from 'tv2-common'
import { ControlClasses, SharedOutputLayer, SourceType } from 'tv2-constants'
import { Tv2OutputLayer } from '../../tv2-constants/tv2-output-layer'
import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type'
import { GetSisyfosTimelineObjForRemote } from '../helpers'
import { GetTagForLive } from '../pieces'
import { findSourceInfo } from '../sources'
Expand Down Expand Up @@ -58,6 +60,8 @@ export function EvaluateEksternBase<
toBeQueued: true,
lifespan: PieceLifespan.WithinPart,
metaData: {
type: Tv2PieceType.REMOTE,
outputLayer: Tv2OutputLayer.PROGRAM,
sisyfosPersistMetaData: {
sisyfosLayers: sourceInfoEkstern.sisyfosLayers ?? [],
wantsToPersistAudio: sourceInfoEkstern.wantsToPersistAudio,
Expand Down Expand Up @@ -95,6 +99,8 @@ export function EvaluateEksternBase<
lifespan: PieceLifespan.WithinPart,
toBeQueued: true,
metaData: {
type: Tv2PieceType.REMOTE,
outputLayer: Tv2OutputLayer.PROGRAM,
sisyfosPersistMetaData: {
sisyfosLayers: sourceInfoEkstern.sisyfosLayers ?? [],
wantsToPersistAudio: sourceInfoEkstern.wantsToPersistAudio,
Expand Down
6 changes: 5 additions & 1 deletion src/tv2-common/cues/gfx-schema-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
TV2ShowStyleConfig
} from 'tv2-common'
import { CueType, SharedGraphicLLayer, SharedOutputLayer, SharedSourceLayer } from 'tv2-constants'
import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type'
import { DveLoopGenerator } from '../helpers/graphics/caspar/dve-loop-generator'

const NON_BASELINE_SCHEMA = 'NON_BASELINE_SCHEMA'
Expand Down Expand Up @@ -64,7 +65,10 @@ export class GfxSchemaGenerator {
path: cue.schema,
ignoreMediaObjectStatus: true,
timelineObjects: this.createTimelineObjects(context, cue)
})
}),
metaData: {
type: Tv2PieceType.GRAPHICS
}
})
}

Expand Down
12 changes: 11 additions & 1 deletion src/tv2-common/cues/lyd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
SharedSisyfosLLayer,
SharedSourceLayer
} from 'tv2-constants'
import { Tv2OutputLayer } from '../../tv2-constants/tv2-output-layer'
import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type'
import { TV2ShowStyleConfig } from '../blueprintConfig'

export function EvaluateLYD(
Expand Down Expand Up @@ -71,6 +73,10 @@ export function EvaluateLYD(
? Math.max(1000, fadeIn ? getTimeFromFrames(fadeIn) : 0)
: getTimingEnable(parsedCue).enable.duration ?? undefined,
content: LydContent(context.config, file, lydType, fadeIn, fadeOut),
metaData: {
type: Tv2PieceType.AUDIO,
outputLayer: Tv2OutputLayer.AUDIO
},
tags: [AdlibTags.ADLIB_FLOW_PRODUCER]
})
} else {
Expand All @@ -90,7 +96,11 @@ export function EvaluateLYD(
outputLayerId: SharedOutputLayer.MUSIK,
sourceLayerId: SharedSourceLayer.PgmAudioBed,
lifespan,
content: LydContent(context.config, file, lydType, fadeIn, fadeOut)
content: LydContent(context.config, file, lydType, fadeIn, fadeOut),
metaData: {
type: Tv2PieceType.AUDIO,
outputLayer: Tv2OutputLayer.AUDIO
}
})
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/tv2-common/cues/mixMinus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { IBlueprintPiece, PieceLifespan, TSR } from 'blueprints-integration'
import { CueDefinitionMixMinus, findSourceInfo, PartDefinition, ShowStyleContext, TemporalPriority } from 'tv2-common'
import { ControlClasses, SharedOutputLayer, SharedSourceLayer, SwitcherAuxLLayer } from 'tv2-constants'
import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type'

export function EvaluateCueMixMinus(
context: ShowStyleContext,
Expand Down Expand Up @@ -33,6 +34,9 @@ export function EvaluateCueMixMinus(
outputLayerId: SharedOutputLayer.AUX,
content: {
timelineObjects: [getMixMinusTimelineObject(context, switcherInput, MixMinusPriority.MINUSKAM_CUE)]
},
metaData: {
type: Tv2PieceType.AUDIO
}
})
}
Expand Down
7 changes: 5 additions & 2 deletions src/tv2-common/helpers/__tests__/serverResume.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'blueprints-integration'
import { DVEPieceMetaData, literal, PieceMetaData, RemoteType, SourceDefinitionRemote } from 'tv2-common'
import { SharedSourceLayer, SourceType } from 'tv2-constants'
import { Tv2PieceType } from '../../../tv2-constants/tv2-piece-type'
import { getServerPositionForPartInstance } from '../serverResume'

const EKSTERN_SOURCE: SourceDefinitionRemote = {
Expand Down Expand Up @@ -122,7 +123,8 @@ describe('Server Resume', () => {
boxSourceConfiguration: [],
timelineObjects: []
}),
metaData: literal<Partial<DVEPieceMetaData>>({
metaData: literal<Partial<DVEPieceMetaData> & PieceMetaData>({
type: Tv2PieceType.SPLIT_SCREEN,
sources: {
INP1: { sourceType: SourceType.SERVER },
INP2: EKSTERN_SOURCE
Expand Down Expand Up @@ -168,7 +170,8 @@ describe('Server Resume', () => {
boxSourceConfiguration: [],
timelineObjects: []
}),
metaData: literal<Partial<DVEPieceMetaData>>({
metaData: literal<Partial<DVEPieceMetaData> & PieceMetaData>({
type: Tv2PieceType.SPLIT_SCREEN,
sources: {
INP1: { sourceType: SourceType.SERVER },
INP2: EKSTERN_SOURCE
Expand Down
7 changes: 7 additions & 0 deletions src/tv2-common/helpers/dsk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'blueprints-integration'
import { getDskLLayerName, literal, ShowStyleContext, SourceLayerAtemDSK, VideoSwitcher } from 'tv2-common'
import { AdlibTags, DskRole, SharedOutputLayer } from 'tv2-constants'
import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type'
import { ATEMModel } from '../../types/atem'
import { TV2BlueprintConfigBase, TV2ShowStyleConfig, TV2StudioConfigBase } from '../blueprintConfig'
import { TableConfigItemDSK } from '../types'
Expand Down Expand Up @@ -125,6 +126,9 @@ export function CreateDSKBaselineAdlibs(
}
})
]
},
metaData: {
type: Tv2PieceType.COMMAND
}
})
} else {
Expand All @@ -149,6 +153,9 @@ export function CreateDSKBaselineAdlibs(
}
})
]
},
metaData: {
type: Tv2PieceType.COMMAND
}
})
}
Expand Down
11 changes: 9 additions & 2 deletions src/tv2-common/helpers/graphics/design/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
TV2ShowStyleConfig
} from 'tv2-common'
import { SharedGraphicLLayer, SharedOutputLayer, SharedSourceLayer } from 'tv2-constants'
import { Tv2PieceType } from '../../../../tv2-constants/tv2-piece-type'

const NON_BASELINE_DESIGN = 'NON_BASELINE_DESIGN'

Expand Down Expand Up @@ -53,7 +54,10 @@ function createDesignAdlibPiece(
sourceLayerId: SharedSourceLayer.PgmDesign,
// @ts-ignore
lifespan: cue.isFromField ? 'rundown-change-segment-lookback' : PieceLifespan.OutOnRundownChange,
content: createDesignPieceContent(context, cue)
content: createDesignPieceContent(context, cue),
metaData: {
type: Tv2PieceType.GRAPHICS
}
}
}

Expand All @@ -73,7 +77,10 @@ function createDesignPiece(
sourceLayerId: SharedSourceLayer.PgmDesign,
// @ts-ignore
lifespan: cue.isFromField ? 'rundown-change-segment-lookback' : PieceLifespan.OutOnRundownChange,
content: createDesignPieceContent(context, cue)
content: createDesignPieceContent(context, cue),
metaData: {
type: Tv2PieceType.GRAPHICS
}
}
}

Expand Down
21 changes: 16 additions & 5 deletions src/tv2-common/helpers/graphics/internal/InternalGraphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
} from 'tv2-common'
import { AdlibTags, SharedOutputLayer, SharedSourceLayer } from 'tv2-constants'
import * as _ from 'underscore'

import { Tv2OutputLayer } from '../../../../tv2-constants/tv2-output-layer'
import { Tv2PieceType } from '../../../../tv2-constants/tv2-piece-type'
import { Graphic } from '../Graphic'

export abstract class InternalGraphic extends Graphic {
Expand Down Expand Up @@ -59,7 +60,11 @@ export abstract class InternalGraphic extends Graphic {
lifespan: PieceLifespan.WithinPart,
expectedDuration: 5000,
tags: [AdlibTags.ADLIB_KOMMENTATOR],
content: _.clone(this.content)
content: _.clone(this.content),
metaData: {
type: Tv2PieceType.OVERLAY_GRAPHICS,
outputLayer: Tv2OutputLayer.OVERLAY
}
}
}

Expand All @@ -78,7 +83,11 @@ export abstract class InternalGraphic extends Graphic {
expectedDuration: this.getPieceEnable().duration
}),
lifespan: this.getPieceLifespan(),
content: _.clone(this.content)
content: _.clone(this.content),
metaData: {
type: Tv2PieceType.GRAPHICS,
outputLayer: Tv2OutputLayer.OVERLAY
}
}
}

Expand All @@ -94,11 +103,13 @@ export abstract class InternalGraphic extends Graphic {
outputLayerId: this.outputLayerId,
sourceLayerId: this.sourceLayerId,
lifespan: this.getPieceLifespan(),
content: _.clone(this.content),
metaData: {
type: Tv2PieceType.GRAPHICS,
outputLayer: Tv2OutputLayer.OVERLAY,
partType: this.partDefinition?.type,
pieceExternalId: this.partDefinition?.externalId
},
content: _.clone(this.content)
}
}
}

Expand Down
36 changes: 35 additions & 1 deletion src/tv2-common/helpers/graphics/pilot/PilotGraphicGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
SharedSourceLayer,
TallyTags
} from 'tv2-constants'
import { Tv2OutputLayer } from '../../../../tv2-constants/tv2-output-layer'
import { Tv2PieceType } from '../../../../tv2-constants/tv2-piece-type'
import { Graphic } from '../index'

export interface PilotGraphicProps {
Expand Down Expand Up @@ -125,7 +127,11 @@ export abstract class PilotGraphicGenerator extends Graphic {
content: this.getContent(),
tags: IsTargetingFull(this.engine)
? [GetTagForFull(this.segmentExternalId, this.cue.graphic.vcpid), TallyTags.FULL_IS_LIVE]
: []
: [],
metaData: {
type: this.getTv2PieceType(),
outputLayer: this.getTv2OutputLayer()
}
}
}

Expand Down Expand Up @@ -158,6 +164,7 @@ export abstract class PilotGraphicGenerator extends Graphic {
sourceLayerId: SharedSourceLayer.SelectedAdlibGraphicsFull,
lifespan: PieceLifespan.OutOnSegmentEnd,
metaData: {
type: Tv2PieceType.GRAPHICS,
userData: {
type: AdlibActionType.SELECT_FULL_GRAFIK,
name: this.cue.graphic.name,
Expand All @@ -184,6 +191,33 @@ export abstract class PilotGraphicGenerator extends Graphic {
: this.config.studio.VizPilotGraphics.PrerollDuration
}

protected getTv2PieceType(): Tv2PieceType {
switch (this.engine) {
case 'OVL':
return Tv2PieceType.OVERLAY_GRAPHICS
case 'WALL':
case 'FULL':
case 'TLF':
return Tv2PieceType.GRAPHICS
default:
return Tv2PieceType.GRAPHICS
}
}

protected getTv2OutputLayer(): Tv2OutputLayer | undefined {
switch (this.engine) {
case 'WALL':
return undefined
case 'OVL':
return Tv2OutputLayer.OVERLAY
case 'FULL':
case 'TLF':
return Tv2OutputLayer.PROGRAM
default:
return undefined
}
}

protected getSourceLayer(): SharedSourceLayer {
switch (this.engine) {
case 'WALL':
Expand Down
4 changes: 4 additions & 0 deletions src/tv2-common/onTimelineGenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
} from 'tv2-common'
import { AbstractLLayer, PartType, SharedSisyfosLLayer, TallyTags } from 'tv2-constants'
import * as _ from 'underscore'
import { Tv2OutputLayer } from '../tv2-constants/tv2-output-layer'
import { Tv2PieceType } from '../tv2-constants/tv2-piece-type'
import { TV2BlueprintConfigBase, TV2StudioConfigBase } from './blueprintConfig'

export interface PartEndStateExt {
Expand Down Expand Up @@ -58,6 +60,8 @@ export type TimelineBlueprintExt = TSR.TSRTimelineObjBase & {
}

export interface PieceMetaData {
type: Tv2PieceType
outputLayer?: Tv2OutputLayer
sisyfosPersistMetaData?: SisyfosPersistenceMetaData
mediaPlayerSessions?: string[]
modifiedByAction?: boolean
Expand Down
Loading

0 comments on commit 6f8699b

Please sign in to comment.