From ba9078b38727a3eb3e8fc8da6f5c1c865f43ae02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Frederik=20Lou=20J=C3=B8rgensen?= Date: Tue, 10 Sep 2024 10:29:40 +0200 Subject: [PATCH] fix: Uses part index in segment to assign action rank. --- src/tv2-common/actions/executeAction.ts | 22 +++++-- src/tv2-common/evaluateCues.ts | 59 +++++-------------- src/tv2-common/getSegment.ts | 57 +++++++++++------- .../helpers/pieces/evaluateCues.ts | 4 +- src/tv2_afvd_showstyle/parts/evs.ts | 2 + src/tv2_afvd_showstyle/parts/grafik.ts | 2 + src/tv2_afvd_showstyle/parts/intro.ts | 2 + src/tv2_afvd_showstyle/parts/kam.ts | 2 + src/tv2_afvd_showstyle/parts/live.ts | 4 +- src/tv2_afvd_showstyle/parts/server.ts | 2 + src/tv2_afvd_showstyle/parts/teknik.ts | 2 + src/tv2_afvd_showstyle/parts/unknown.ts | 9 ++- .../__tests__/graphics.spec.ts | 22 +++---- .../helpers/EvaluateCues.ts | 4 +- src/tv2_offtube_showstyle/parts/OfftubeDVE.ts | 2 + .../parts/OfftubeGrafik.ts | 2 + src/tv2_offtube_showstyle/parts/OfftubeKam.ts | 2 + .../parts/OfftubeServer.ts | 2 + .../parts/OfftubeUnknown.ts | 2 + 19 files changed, 118 insertions(+), 85 deletions(-) diff --git a/src/tv2-common/actions/executeAction.ts b/src/tv2-common/actions/executeAction.ts index 3132cc4d..811a8609 100644 --- a/src/tv2-common/actions/executeAction.ts +++ b/src/tv2-common/actions/executeAction.ts @@ -107,6 +107,8 @@ const STOPPABLE_GRAPHICS_LAYERS = [ SharedSourceLayer.PgmGraphicsTLF ] +const EXECUTE_ACTION_PART_INDEX: number = 0 + export interface ActionExecutionSettings { EvaluateCues: ( context: ShowStyleContext, @@ -117,6 +119,7 @@ export interface ActionExecutionSettings void DVEGeneratorOptions: DVEOptions @@ -471,10 +474,21 @@ async function executeActionSelectServerClip< }) } - settings.EvaluateCues(context, basePart.part.part, grafikPieces, [], [], [], partDefinition.cues, partDefinition, { - excludeAdlibs: true, - selectedCueTypes: [CueType.Graphic] - }) + settings.EvaluateCues( + context, + basePart.part.part, + grafikPieces, + [], + [], + [], + partDefinition.cues, + partDefinition, + EXECUTE_ACTION_PART_INDEX, + { + excludeAdlibs: true, + selectedCueTypes: [CueType.Graphic] + } + ) if (basePart.invalid || !activeServerPiece || !serverDataStore) { context.core.notifyUserWarning(`Could not start server clip`) diff --git a/src/tv2-common/evaluateCues.ts b/src/tv2-common/evaluateCues.ts index 4f13fdd5..220063ec 100644 --- a/src/tv2-common/evaluateCues.ts +++ b/src/tv2-common/evaluateCues.ts @@ -38,6 +38,7 @@ import { } from './inewsConversion' const PART_RANK_FRACTION_FACTOR: number = 1000 +const CUE_RANK_FRACTION_FACTOR: number = PART_RANK_FRACTION_FACTOR * 100 export interface Adlib { rank: number @@ -193,7 +194,8 @@ export async function EvaluateCuesBase( mediaSubscriptions: HackPartMediaObjectSubscription[], cues: CueDefinition[], partDefinition: PartDefinition, - options: EvaluateCuesOptions + options: EvaluateCuesOptions, + partIndex: number ) { let adLibRank = 1 const result = new EvaluateCueResult() @@ -201,7 +203,8 @@ export async function EvaluateCuesBase( for (const cue of cues) { if (cue && !SkipCue(cue, options.selectedCueTypes, options.excludeAdlibs, options.adlibsOnly)) { const shouldAdlib = !!(options.adlib || cue.adlib) - const adlib = shouldAdlib ? { rank: getRankForPartDefinition(adLibRank, partDefinition) } : undefined + const adlibRank: number = getRankForPartDefinition(adLibRank, partDefinition, partIndex) + const adlib = shouldAdlib ? { rank: adlibRank } : undefined switch (cue.type) { case CueType.Graphic: @@ -221,7 +224,7 @@ export async function EvaluateCuesBase( partDefinition.externalId, cue, partDefinition, - getRankForPartDefinition(adLibRank, partDefinition), + adlibRank, adlib ) ) @@ -237,33 +240,17 @@ export async function EvaluateCuesBase( cue, partDefinition, shouldAdlib, - getRankForPartDefinition(adLibRank, partDefinition) + adlibRank ) ) } break case CueType.DVE: if (showStyleOptions.EvaluateCueDVE) { - showStyleOptions.EvaluateCueDVE( - context, - pieces, - actions, - partDefinition, - cue, - shouldAdlib, - getRankForPartDefinition(adLibRank, partDefinition) - ) + showStyleOptions.EvaluateCueDVE(context, pieces, actions, partDefinition, cue, shouldAdlib, adlibRank) // Always make an adlib for DVEs if (!shouldAdlib) { - showStyleOptions.EvaluateCueDVE( - context, - pieces, - actions, - partDefinition, - cue, - true, - getRankForPartDefinition(adLibRank, partDefinition) - ) + showStyleOptions.EvaluateCueDVE(context, pieces, actions, partDefinition, cue, true, adlibRank) } } break @@ -275,7 +262,7 @@ export async function EvaluateCuesBase( mediaSubscriptions, cue, partDefinition, - getRankForPartDefinition(adLibRank, partDefinition) + adlibRank ) } break @@ -288,15 +275,7 @@ export async function EvaluateCuesBase( break case CueType.Jingle: if (showStyleOptions.EvaluateCueJingle) { - showStyleOptions.EvaluateCueJingle( - context, - pieces, - actions, - cue, - partDefinition, - shouldAdlib, - getRankForPartDefinition(adLibRank, partDefinition) - ) + showStyleOptions.EvaluateCueJingle(context, pieces, actions, cue, partDefinition, shouldAdlib, adlibRank) } break case CueType.LYD: @@ -309,20 +288,14 @@ export async function EvaluateCuesBase( cue, partDefinition, shouldAdlib, - getRankForPartDefinition(adLibRank, partDefinition) + adlibRank ) } break case CueType.GraphicDesign: if (showStyleOptions.EvaluateCueGraphicDesign) { result.push( - showStyleOptions.EvaluateCueGraphicDesign( - context, - partDefinition.externalId, - cue, - shouldAdlib, - getRankForPartDefinition(adLibRank, partDefinition) - ) + showStyleOptions.EvaluateCueGraphicDesign(context, partDefinition.externalId, cue, shouldAdlib, adlibRank) ) } break @@ -352,7 +325,7 @@ export async function EvaluateCuesBase( partDefinition.externalId, cue, shouldAdlib, - getRankForPartDefinition(adLibRank, partDefinition) + adlibRank ) ) } @@ -441,8 +414,8 @@ export async function EvaluateCuesBase( }) } -function getRankForPartDefinition(rank: number, partDefinition: PartDefinition): number { - return partDefinition.segmentRank + rank / PART_RANK_FRACTION_FACTOR +function getRankForPartDefinition(cueIndex: number, partDefinition: PartDefinition, partIndex: number): number { + return partDefinition.segmentRank + partIndex / PART_RANK_FRACTION_FACTOR + cueIndex / CUE_RANK_FRACTION_FACTOR } export function SkipCue( diff --git a/src/tv2-common/getSegment.ts b/src/tv2-common/getSegment.ts index 6e599762..e6fcbdb7 100644 --- a/src/tv2-common/getSegment.ts +++ b/src/tv2-common/getSegment.ts @@ -35,52 +35,62 @@ export interface GetSegmentShowstyleOptions, partDefinition: PartDefinition, + partIndex: number, totalWords: number, asAdlibs?: boolean ) => BlueprintResultPart | Promise CreatePartIntro?: ( context: ShowStyleContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartKam?: ( context: ShowStyleContext, partDefinition: PartDefinitionKam, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartServer?: ( context: ShowStyleContext, partDefinition: PartDefinition, + partIndex: number, partProps: ServerPartProps ) => BlueprintResultPart | Promise CreatePartTeknik?: ( context: ShowStyleContext, partDefinition: PartDefinitionTeknik, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartGrafik?: ( context: ShowStyleContext, partDefinition: PartDefinitionGrafik, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartEkstern?: ( context: ShowStyleContext, partDefinition: PartDefinitionEkstern, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartTelefon?: ( context: ShowStyleContext, partDefinition: PartDefinitionTelefon, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartDVE?: ( context: ShowStyleContext, partDefinition: PartDefinitionDVE, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise CreatePartEVS?: ( context: ShowStyleContext, partDefinition: PartDefinitionEVS, + partIndex: number, totalWords: number ) => BlueprintResultPart | Promise } @@ -161,23 +171,26 @@ export async function getSegmentBase const totalTime = TimeFromINewsField(iNewsStory.fields.totalTime) const tapeTime = TimeFromINewsField(iNewsStory.fields.tapeTime) - for (const part of parsedParts) { + for (let partIndex = 0; partIndex < parsedParts.length; partIndex++) { + const partDefinition: PartDefinition = parsedParts[partIndex] // Make orphaned secondary cues into adlibs if ( - GetNextPartCue(part, -1) === -1 && - part.type === PartType.Unknown && - part.cues.filter((cue) => cue.type === CueType.Jingle || cue.type === CueType.AdLib).length === 0 + GetNextPartCue(partDefinition, -1) === -1 && + partDefinition.type === PartType.Unknown && + partDefinition.cues.filter((cue) => cue.type === CueType.Jingle || cue.type === CueType.AdLib).length === 0 ) { - blueprintParts.push(await showStyleOptions.CreatePartUnknown(context, part, totalWords, true)) + blueprintParts.push( + await showStyleOptions.CreatePartUnknown(context, partDefinition, partIndex, totalWords, true) + ) continue } - const unpairedTargets = part.cues.filter( + const unpairedTargets = partDefinition.cues.filter( (c) => c.type === CueType.UNPAIRED_TARGET && IsTargetingFull(c.target) ) as CueDefinitionUnpairedTarget[] if (unpairedTargets.length) { blueprintParts.push( - CreatePartInvalid(part, { + CreatePartInvalid(partDefinition, { reason: `The part has one or more unpaired targets: ${unpairedTargets .map((cue) => cue.iNewsCommand) .join(', ')}` @@ -189,21 +202,21 @@ export async function getSegmentBase continue } - switch (part.type) { + switch (partDefinition.type) { case PartType.INTRO: if (showStyleOptions.CreatePartIntro) { - blueprintParts.push(await showStyleOptions.CreatePartIntro(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartIntro(context, partDefinition, partIndex, totalWords)) } break case PartType.Kam: if (showStyleOptions.CreatePartKam) { - blueprintParts.push(await showStyleOptions.CreatePartKam(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartKam(context, partDefinition, partIndex, totalWords)) } break case PartType.Server: if (showStyleOptions.CreatePartServer) { blueprintParts.push( - await showStyleOptions.CreatePartServer(context, part, { + await showStyleOptions.CreatePartServer(context, partDefinition, partIndex, { voLayer: false, voLevels: false, totalTime, @@ -216,18 +229,18 @@ export async function getSegmentBase break case PartType.Teknik: if (showStyleOptions.CreatePartTeknik) { - blueprintParts.push(await showStyleOptions.CreatePartTeknik(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartTeknik(context, partDefinition, partIndex, totalWords)) } break case PartType.Grafik: if (showStyleOptions.CreatePartGrafik) { - blueprintParts.push(await showStyleOptions.CreatePartGrafik(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartGrafik(context, partDefinition, partIndex, totalWords)) } break case PartType.VO: if (showStyleOptions.CreatePartServer) { blueprintParts.push( - await showStyleOptions.CreatePartServer(context, part, { + await showStyleOptions.CreatePartServer(context, partDefinition, partIndex, { voLayer: true, voLevels: true, totalTime, @@ -240,35 +253,35 @@ export async function getSegmentBase break case PartType.DVE: if (showStyleOptions.CreatePartDVE) { - blueprintParts.push(await showStyleOptions.CreatePartDVE(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartDVE(context, partDefinition, partIndex, totalWords)) } break case PartType.REMOTE: if (showStyleOptions.CreatePartEkstern) { - blueprintParts.push(await showStyleOptions.CreatePartEkstern(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartEkstern(context, partDefinition, partIndex, totalWords)) } break case PartType.Telefon: if (showStyleOptions.CreatePartTelefon) { - blueprintParts.push(await showStyleOptions.CreatePartTelefon(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartTelefon(context, partDefinition, partIndex, totalWords)) } break case PartType.Unknown: - if (part.cues.length) { - blueprintParts.push(await showStyleOptions.CreatePartUnknown(context, part, totalWords)) + if (partDefinition.cues.length) { + blueprintParts.push(await showStyleOptions.CreatePartUnknown(context, partDefinition, partIndex, totalWords)) } break case PartType.EVS: if (showStyleOptions.CreatePartEVS) { - blueprintParts.push(await showStyleOptions.CreatePartEVS(context, part, totalWords)) + blueprintParts.push(await showStyleOptions.CreatePartEVS(context, partDefinition, partIndex, totalWords)) } break default: - assertUnreachable(part) + assertUnreachable(partDefinition) break } - if (part.cues.filter((cue) => cue.type === CueType.Jingle).length) { + if (partDefinition.cues.filter((cue) => cue.type === CueType.Jingle).length) { if (blueprintParts[blueprintParts.length - 1]) { const t = blueprintParts[blueprintParts.length - 1].part.expectedDuration if (t) { diff --git a/src/tv2_afvd_showstyle/helpers/pieces/evaluateCues.ts b/src/tv2_afvd_showstyle/helpers/pieces/evaluateCues.ts index 52e5ae2d..e7807dad 100644 --- a/src/tv2_afvd_showstyle/helpers/pieces/evaluateCues.ts +++ b/src/tv2_afvd_showstyle/helpers/pieces/evaluateCues.ts @@ -37,6 +37,7 @@ export async function EvaluateCues( mediaSubscriptions: HackPartMediaObjectSubscription[], cues: CueDefinition[], partDefinition: PartDefinition, + partIndex: number, options: EvaluateCuesOptions ) { await EvaluateCuesBase( @@ -65,6 +66,7 @@ export async function EvaluateCues( mediaSubscriptions, cues, partDefinition, - options + options, + partIndex ) } diff --git a/src/tv2_afvd_showstyle/parts/evs.ts b/src/tv2_afvd_showstyle/parts/evs.ts index 82f333c8..b1ed1281 100644 --- a/src/tv2_afvd_showstyle/parts/evs.ts +++ b/src/tv2_afvd_showstyle/parts/evs.ts @@ -34,6 +34,7 @@ import { CreateEffektForpart } from './effekt' export async function CreatePartEVS( context: SegmentContext, partDefinition: PartDefinitionEVS, + partIndex: number, totalWords: number ): Promise { const partTime = PartTime(context.config, partDefinition, totalWords, false) @@ -88,6 +89,7 @@ export async function CreatePartEVS( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) AddScript(partDefinition, pieces, partTime, SourceLayer.PgmScript) diff --git a/src/tv2_afvd_showstyle/parts/grafik.ts b/src/tv2_afvd_showstyle/parts/grafik.ts index 7155052b..6f8c6694 100644 --- a/src/tv2_afvd_showstyle/parts/grafik.ts +++ b/src/tv2_afvd_showstyle/parts/grafik.ts @@ -22,6 +22,7 @@ import { SourceLayer } from '../layers' export async function CreatePartGrafik( context: ShowStyleContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number ): Promise { const partTime = PartTime(context.config, partDefinition, totalWords, false) @@ -51,6 +52,7 @@ export async function CreatePartGrafik( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, { isGrafikPart: true } diff --git a/src/tv2_afvd_showstyle/parts/intro.ts b/src/tv2_afvd_showstyle/parts/intro.ts index 3db7bd13..25516dd7 100644 --- a/src/tv2_afvd_showstyle/parts/intro.ts +++ b/src/tv2_afvd_showstyle/parts/intro.ts @@ -23,6 +23,7 @@ import { SourceLayer } from '../layers' export async function CreatePartIntro( context: ShowStyleContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number ): Promise { const partTime = PartTime(context.config, partDefinition, totalWords, false) @@ -80,6 +81,7 @@ export async function CreatePartIntro( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) AddScript(partDefinition, pieces, partTime, SourceLayer.PgmScript) diff --git a/src/tv2_afvd_showstyle/parts/kam.ts b/src/tv2_afvd_showstyle/parts/kam.ts index 6962fe04..4aa3157d 100644 --- a/src/tv2_afvd_showstyle/parts/kam.ts +++ b/src/tv2_afvd_showstyle/parts/kam.ts @@ -34,6 +34,7 @@ import { CreateEffektForpart } from './effekt' export async function CreatePartKam( context: SegmentContext, partDefinition: PartDefinitionKam, + partIndex: number, totalWords: number ): Promise { const partKamBase = CreatePartKamBase(context, partDefinition, totalWords) @@ -131,6 +132,7 @@ export async function CreatePartKam( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) AddScript(partDefinition, pieces, partTime, SourceLayer.PgmScript) diff --git a/src/tv2_afvd_showstyle/parts/live.ts b/src/tv2_afvd_showstyle/parts/live.ts index 19914fb9..47322000 100644 --- a/src/tv2_afvd_showstyle/parts/live.ts +++ b/src/tv2_afvd_showstyle/parts/live.ts @@ -7,7 +7,7 @@ import { } from 'blueprints-integration' import { AddScript, CueDefinition, Part, PartDefinition, PartTime, SegmentContext } from 'tv2-common' import { CueType } from 'tv2-constants' -import { GalleryBlueprintConfig } from '../../tv2_afvd_showstyle/helpers/config' +import { GalleryBlueprintConfig } from '../helpers/config' import { EvaluateCues } from '../helpers/pieces/evaluateCues' import { SourceLayer } from '../layers' import { CreateEffektForpart } from './effekt' @@ -15,6 +15,7 @@ import { CreateEffektForpart } from './effekt' export async function CreatePartLive( context: SegmentContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number ): Promise { const partTime = PartTime(context.config, partDefinition, totalWords, false) @@ -41,6 +42,7 @@ export async function CreatePartLive( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) AddScript(partDefinition, pieces, partTime, SourceLayer.PgmScript) diff --git a/src/tv2_afvd_showstyle/parts/server.ts b/src/tv2_afvd_showstyle/parts/server.ts index 914d69a9..56b368c1 100644 --- a/src/tv2_afvd_showstyle/parts/server.ts +++ b/src/tv2_afvd_showstyle/parts/server.ts @@ -9,6 +9,7 @@ import { CreateEffektForpart } from './effekt' export async function CreatePartServer( context: SegmentContext, partDefinition: PartDefinition, + partIndex: number, partProps: ServerPartProps ): Promise { const basePartProps = await CreatePartServerBase(context, partDefinition, partProps, { @@ -50,6 +51,7 @@ export async function CreatePartServer( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) diff --git a/src/tv2_afvd_showstyle/parts/teknik.ts b/src/tv2_afvd_showstyle/parts/teknik.ts index ad5d8039..23501f82 100644 --- a/src/tv2_afvd_showstyle/parts/teknik.ts +++ b/src/tv2_afvd_showstyle/parts/teknik.ts @@ -13,6 +13,7 @@ import { SourceLayer } from '../layers' export async function CreatePartTeknik( context: SegmentContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number ): Promise { const partTime = PartTime(context.config, partDefinition, totalWords, false) @@ -36,6 +37,7 @@ export async function CreatePartTeknik( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) AddScript(partDefinition, pieces, partTime, SourceLayer.PgmScript) diff --git a/src/tv2_afvd_showstyle/parts/unknown.ts b/src/tv2_afvd_showstyle/parts/unknown.ts index c66cf2ae..e1a96c24 100644 --- a/src/tv2_afvd_showstyle/parts/unknown.ts +++ b/src/tv2_afvd_showstyle/parts/unknown.ts @@ -23,6 +23,7 @@ import { CreateEffektForpart } from './effekt' export async function CreatePartUnknown( context: ShowStyleContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number, asAdlibs?: boolean ) { @@ -41,8 +42,11 @@ export async function CreatePartUnknown( const actions: IBlueprintActionManifest[] = [] const mediaSubscriptions: HackPartMediaObjectSubscription[] = [] - part = { ...part, ...CreateEffektForpart(context, partDefinition, pieces) } - part = { ...part, ...GetJinglePartProperties(context, partDefinition) } + part = { + ...part, + ...CreateEffektForpart(context, partDefinition, pieces), + ...GetJinglePartProperties(context, partDefinition) + } if ( partDefinition.cues.some((cue) => cue.type === CueType.Graphic && GraphicIsPilot(cue) && cue.target === 'FULL') && @@ -60,6 +64,7 @@ export async function CreatePartUnknown( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, { adlib: asAdlibs } diff --git a/src/tv2_afvd_studio/__tests__/graphics.spec.ts b/src/tv2_afvd_studio/__tests__/graphics.spec.ts index 9899dc76..52faa547 100644 --- a/src/tv2_afvd_studio/__tests__/graphics.spec.ts +++ b/src/tv2_afvd_studio/__tests__/graphics.spec.ts @@ -47,7 +47,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartGrafik(context, partDefintion, 0) + const result = await CreatePartGrafik(context, partDefintion, 0, 0) expect((context.core as SegmentUserContextMock).getNotes().map((msg) => msg.message)).toEqual([ `No graphic found after GRAFIK cue` @@ -84,7 +84,7 @@ describe('Graphics', () => { segmentRank: 0 }) - CreatePartGrafik(context, partDefinition, 0) + CreatePartGrafik(context, partDefinition, 0, 0) expect((context.core as SegmentUserContextMock).getNotes().map((msg) => msg.message)).toEqual([ `Graphic found without target engine` @@ -121,7 +121,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartGrafik(context, partDefinition, 0) + const result = await CreatePartGrafik(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(2) const piece = result.pieces[0] expect(piece.sourceLayerId).toBe(SourceLayer.PgmPilot) @@ -185,7 +185,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartGrafik(context, partDefinition, 0) + const result = await CreatePartGrafik(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(1) const piece = result.pieces[0] expect(piece.sourceLayerId).toBe(SourceLayer.PgmPilotOverlay) @@ -242,7 +242,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartGrafik(context, partDefinition, 0) + const result = await CreatePartGrafik(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(1) const piece = result.pieces[0] expect(piece.sourceLayerId).toBe(SourceLayer.WallGraphics) @@ -296,7 +296,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartGrafik(context, partDefinition, 0) + const result = await CreatePartGrafik(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(2) const piece = result.pieces[0] expect(piece.sourceLayerId).toBe(SourceLayer.PgmGraphicsTLF) @@ -366,7 +366,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartGrafik(context, partDefinition, 0) + const result = await CreatePartGrafik(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(3) const auxPiece = result.pieces.find((p) => p.outputLayerId === SharedOutputLayer.AUX)! expect(auxPiece.enable).toEqual({ start: 0 }) @@ -405,7 +405,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartUnknown(context, partDefinition, 0) + const result = await CreatePartUnknown(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(1) const piece = result.pieces[0] expect(piece).toBeTruthy() @@ -440,7 +440,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartUnknown(context, partDefinition, 0) + const result = await CreatePartUnknown(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(1) const piece = result.pieces[0] expect(piece.lifespan).toBe('rundown-change-segment-lookback') @@ -471,7 +471,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartUnknown(context, partDefinition, 0) + const result = await CreatePartUnknown(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(1) const piece = result.pieces[0] expect(piece).toBeTruthy() @@ -522,7 +522,7 @@ describe('Graphics', () => { segmentRank: 0 }) - const result = await CreatePartUnknown(context, partDefinition, 0) + const result = await CreatePartUnknown(context, partDefinition, 0, 0) expect(result.pieces).toHaveLength(1) const piece = result.pieces[0] expect(piece).toBeTruthy() diff --git a/src/tv2_offtube_showstyle/helpers/EvaluateCues.ts b/src/tv2_offtube_showstyle/helpers/EvaluateCues.ts index 38b8e788..e41e7975 100644 --- a/src/tv2_offtube_showstyle/helpers/EvaluateCues.ts +++ b/src/tv2_offtube_showstyle/helpers/EvaluateCues.ts @@ -33,6 +33,7 @@ export async function OfftubeEvaluateCues( mediaSubscriptions: HackPartMediaObjectSubscription[], cues: CueDefinition[], partDefinition: PartDefinition, + partIndex: number, options: EvaluateCuesOptions ) { await EvaluateCuesBase( @@ -57,6 +58,7 @@ export async function OfftubeEvaluateCues( mediaSubscriptions, cues, partDefinition, - options + options, + partIndex ) } diff --git a/src/tv2_offtube_showstyle/parts/OfftubeDVE.ts b/src/tv2_offtube_showstyle/parts/OfftubeDVE.ts index 366f68f0..9b40dd1b 100644 --- a/src/tv2_offtube_showstyle/parts/OfftubeDVE.ts +++ b/src/tv2_offtube_showstyle/parts/OfftubeDVE.ts @@ -14,6 +14,7 @@ import { OfftubeSourceLayer } from '../layers' export async function OfftubeCreatePartDVE( context: SegmentContext, partDefinition: PartDefinitionDVE, + partIndex: number, totalWords: number ): Promise { const partTime = PartTime(context.config, partDefinition, totalWords, false) @@ -38,6 +39,7 @@ export async function OfftubeCreatePartDVE( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, { adlib: true } diff --git a/src/tv2_offtube_showstyle/parts/OfftubeGrafik.ts b/src/tv2_offtube_showstyle/parts/OfftubeGrafik.ts index 2bf66ea3..7b61efae 100644 --- a/src/tv2_offtube_showstyle/parts/OfftubeGrafik.ts +++ b/src/tv2_offtube_showstyle/parts/OfftubeGrafik.ts @@ -13,6 +13,7 @@ import { OfftubeSourceLayer } from '../layers' export async function OfftubeCreatePartGrafik( context: SegmentContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number, asAdlibs?: boolean ) { @@ -42,6 +43,7 @@ export async function OfftubeCreatePartGrafik( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, { adlib: asAdlibs } diff --git a/src/tv2_offtube_showstyle/parts/OfftubeKam.ts b/src/tv2_offtube_showstyle/parts/OfftubeKam.ts index 0fd21d2e..6d2dc6d6 100644 --- a/src/tv2_offtube_showstyle/parts/OfftubeKam.ts +++ b/src/tv2_offtube_showstyle/parts/OfftubeKam.ts @@ -33,6 +33,7 @@ import { CreateEffektForpart } from './OfftubeEffekt' export async function OfftubeCreatePartKam( context: SegmentContext, partDefinition: PartDefinitionKam, + partIndex: number, totalWords: number ): Promise { const partKamBase = CreatePartKamBase(context, partDefinition, totalWords) @@ -128,6 +129,7 @@ export async function OfftubeCreatePartKam( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) diff --git a/src/tv2_offtube_showstyle/parts/OfftubeServer.ts b/src/tv2_offtube_showstyle/parts/OfftubeServer.ts index 99d792e7..fc2375e7 100644 --- a/src/tv2_offtube_showstyle/parts/OfftubeServer.ts +++ b/src/tv2_offtube_showstyle/parts/OfftubeServer.ts @@ -16,6 +16,7 @@ import { CreateEffektForpart } from './OfftubeEffekt' export async function OfftubeCreatePartServer( context: SegmentContext, partDefinition: PartDefinition, + partIndex: number, partProps: ServerPartProps ): Promise { const basePartProps = await CreatePartServerBase(context, partDefinition, partProps, { @@ -78,6 +79,7 @@ export async function OfftubeCreatePartServer( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, {} ) diff --git a/src/tv2_offtube_showstyle/parts/OfftubeUnknown.ts b/src/tv2_offtube_showstyle/parts/OfftubeUnknown.ts index 1c17e62f..fa1ed119 100644 --- a/src/tv2_offtube_showstyle/parts/OfftubeUnknown.ts +++ b/src/tv2_offtube_showstyle/parts/OfftubeUnknown.ts @@ -22,6 +22,7 @@ import { OfftubeSourceLayer } from '../layers' export async function CreatePartUnknown( context: SegmentContext, partDefinition: PartDefinition, + partIndex: number, totalWords: number, asAdlibs?: boolean ) { @@ -58,6 +59,7 @@ export async function CreatePartUnknown( mediaSubscriptions, partDefinition.cues, partDefinition, + partIndex, { adlib: asAdlibs }