From 2e898552eb3395d922d772f2c611989a7fd9613b Mon Sep 17 00:00:00 2001 From: Tom Lee Date: Fri, 26 Feb 2021 14:25:21 +0000 Subject: [PATCH] feat: Recall last DVE in script --- src/tv2-common/actions/actionTypes.ts | 5 ++ src/tv2-common/actions/executeAction.ts | 46 ++++++++++++++++++- src/tv2-constants/enums.ts | 3 +- src/tv2_afvd_showstyle/getRundown.ts | 17 +++++++ .../migrations/sourcelayer-defaults.ts | 10 ++-- src/tv2_offtube_showstyle/getRundown.ts | 17 +++++++ .../migrations/sourcelayer-defaults.ts | 10 ++-- 7 files changed, 95 insertions(+), 13 deletions(-) diff --git a/src/tv2-common/actions/actionTypes.ts b/src/tv2-common/actions/actionTypes.ts index 095e4cf5d..1ba7b0b8e 100644 --- a/src/tv2-common/actions/actionTypes.ts +++ b/src/tv2-common/actions/actionTypes.ts @@ -120,6 +120,10 @@ export interface ActionRecallLastLive extends ActionBase { type: AdlibActionType.RECALL_LAST_LIVE } +export interface ActionRecallLastDVE extends ActionBase { + type: AdlibActionType.RECALL_LAST_DVE +} + export type TV2AdlibAction = | ActionSelectServerClip | ActionSelectDVE @@ -135,3 +139,4 @@ export type TV2AdlibAction = | ActionClearGraphics | ActionTakeWithTransition | ActionRecallLastLive + | ActionRecallLastDVE diff --git a/src/tv2-common/actions/executeAction.ts b/src/tv2-common/actions/executeAction.ts index 8d75da70d..8ad1bdd68 100644 --- a/src/tv2-common/actions/executeAction.ts +++ b/src/tv2-common/actions/executeAction.ts @@ -77,6 +77,7 @@ import { import { assertUnreachable } from '../util' import { ActionCommentatorSelectJingle, + ActionRecallLastDVE, ActionRecallLastLive, ActionSelectJingle, ActionTakeWithTransition @@ -229,6 +230,9 @@ export function executeAction< case AdlibActionType.RECALL_LAST_LIVE: executeActionRecallLastLive(context, settings, actionId, userData as ActionRecallLastLive) break + case AdlibActionType.RECALL_LAST_DVE: + executeActionRecallLastDVE(context, settings, actionId, userData as ActionRecallLastDVE) + break default: assertUnreachable(actionId) break @@ -1674,8 +1678,14 @@ function executeActionRecallLastLive< actionId: string, _userData: ActionRecallLastLive ) { - const lastLive = context.findLastPieceOnLayer(settings.SourceLayers.Live, { originalOnly: true }) - const lastIdent = context.findLastPieceOnLayer(settings.SourceLayers.Ident, { originalOnly: true }) + const lastLive = context.findLastPieceOnLayer(settings.SourceLayers.Live, { + originalOnly: true, + excludeCurrentPart: true + }) + const lastIdent = context.findLastPieceOnLayer(settings.SourceLayers.Ident, { + originalOnly: true, + excludeCurrentPart: true + }) if (!lastLive) { return @@ -1711,6 +1721,38 @@ function executeActionRecallLastLive< context.queuePart(part, pieces) } +function executeActionRecallLastDVE< + StudioConfig extends TV2StudioConfigBase, + ShowStyleConfig extends TV2BlueprintConfigBase +>( + context: ActionExecutionContext, + settings: ActionExecutionSettings, + actionId: string, + _userData: ActionRecallLastDVE +) { + const lastDVE = context.findLastScriptedPieceOnLayer(settings.SourceLayers.DVE, { excludeCurrentPart: true }) + + if (!lastDVE) { + return + } + + const externalId = generateExternalId(context, actionId, [lastDVE.name]) + + const dveMeta = lastDVE.metaData as DVEPieceMetaData + + executeActionSelectDVE( + context, + settings, + actionId, + literal({ + type: AdlibActionType.SELECT_DVE, + config: dveMeta.userData.config, + segmentExternalId: externalId, + videoId: dveMeta.userData.videoId + }) + ) +} + function executeActionSelectFull< StudioConfig extends TV2StudioConfigBase, ShowStyleConfig extends TV2BlueprintConfigBase diff --git a/src/tv2-constants/enums.ts b/src/tv2-constants/enums.ts index c59714663..75f3a2678 100644 --- a/src/tv2-constants/enums.ts +++ b/src/tv2-constants/enums.ts @@ -92,7 +92,8 @@ export enum AdlibActionType { COMMENTATOR_SELECT_JINGLE = 'commentator_select_jingle', CLEAR_GRAPHICS = 'clear_graphics', TAKE_WITH_TRANSITION = 'take_with_transition', - RECALL_LAST_LIVE = 'recall_last_live' + RECALL_LAST_LIVE = 'recall_last_live', + RECALL_LAST_DVE = 'recall_last_dve' } export enum TallyTags { diff --git a/src/tv2_afvd_showstyle/getRundown.ts b/src/tv2_afvd_showstyle/getRundown.ts index 3eab24275..4608cd8ce 100644 --- a/src/tv2_afvd_showstyle/getRundown.ts +++ b/src/tv2_afvd_showstyle/getRundown.ts @@ -17,6 +17,7 @@ import { ActionClearGraphics, ActionCutSourceToBox, ActionCutToCamera, + ActionRecallLastDVE, ActionRecallLastLive, ActionSelectDVELayout, CreateLYDBaseline, @@ -881,6 +882,22 @@ function getGlobalAdlibActionsAFVD(_context: ShowStyleContext, config: Blueprint ) ) + res.push( + literal({ + actionId: AdlibActionType.RECALL_LAST_DVE, + userData: literal({ + type: AdlibActionType.RECALL_LAST_DVE + }), + userDataManifest: {}, + display: { + _rank: 1, + label: 'Last DVE', + sourceLayerId: SourceLayer.PgmDVE, + outputLayerId: 'pgm' + } + }) + ) + _.each(config.showStyle.DVEStyles, (dveConfig, i) => { // const boxSources = ['', '', '', ''] res.push( diff --git a/src/tv2_afvd_showstyle/migrations/sourcelayer-defaults.ts b/src/tv2_afvd_showstyle/migrations/sourcelayer-defaults.ts index 644968f7e..7b4ea5157 100644 --- a/src/tv2_afvd_showstyle/migrations/sourcelayer-defaults.ts +++ b/src/tv2_afvd_showstyle/migrations/sourcelayer-defaults.ts @@ -252,12 +252,12 @@ const PGM: ISourceLayer[] = [ exclusiveGroup: 'me1', isRemoteInput: false, isGuestInput: false, - activateKeyboardHotkeys: '', + activateKeyboardHotkeys: 'f10', clearKeyboardHotkey: '', - assignHotkeysToGlobalAdlibs: false, - isSticky: true, - stickyOriginalOnly: true, - activateStickyKeyboardHotkey: 'f10', + assignHotkeysToGlobalAdlibs: true, + isSticky: false, + stickyOriginalOnly: false, + activateStickyKeyboardHotkey: '', isQueueable: false, isHidden: false, allowDisable: false, diff --git a/src/tv2_offtube_showstyle/getRundown.ts b/src/tv2_offtube_showstyle/getRundown.ts index 19211516f..bce868843 100644 --- a/src/tv2_offtube_showstyle/getRundown.ts +++ b/src/tv2_offtube_showstyle/getRundown.ts @@ -20,6 +20,7 @@ import { ActionCutSourceToBox, ActionCutToCamera, ActionCutToRemote, + ActionRecallLastDVE, ActionRecallLastLive, ActionSelectDVELayout, CreateLYDBaseline, @@ -398,6 +399,22 @@ function getGlobalAdlibActionsOfftube( ) ) + res.push( + literal({ + actionId: AdlibActionType.RECALL_LAST_DVE, + userData: literal({ + type: AdlibActionType.RECALL_LAST_DVE + }), + userDataManifest: {}, + display: { + _rank: 1, + label: 'Last DVE', + sourceLayerId: OfftubeSourceLayer.PgmDVE, + outputLayerId: 'pgm' + } + }) + ) + _.each(config.showStyle.DVEStyles, (dveConfig, i) => { res.push( literal({ diff --git a/src/tv2_offtube_showstyle/migrations/sourcelayer-defaults.ts b/src/tv2_offtube_showstyle/migrations/sourcelayer-defaults.ts index 8a82f4d9d..cbea9b8f1 100644 --- a/src/tv2_offtube_showstyle/migrations/sourcelayer-defaults.ts +++ b/src/tv2_offtube_showstyle/migrations/sourcelayer-defaults.ts @@ -270,12 +270,12 @@ const PGM: ISourceLayer[] = [ exclusiveGroup: 'me2', isRemoteInput: false, isGuestInput: false, - activateKeyboardHotkeys: '', + activateKeyboardHotkeys: 'f10', clearKeyboardHotkey: '', - assignHotkeysToGlobalAdlibs: false, - isSticky: true, - stickyOriginalOnly: true, - activateStickyKeyboardHotkey: 'f10', + assignHotkeysToGlobalAdlibs: true, + isSticky: false, + stickyOriginalOnly: false, + activateStickyKeyboardHotkey: '', isQueueable: false, isHidden: false, allowDisable: false,