Skip to content

Commit

Permalink
feat: Recall last DVE in script
Browse files Browse the repository at this point in the history
  • Loading branch information
eol-account committed Mar 15, 2021
1 parent fb02ccb commit 2e89855
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 13 deletions.
5 changes: 5 additions & 0 deletions src/tv2-common/actions/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -135,3 +139,4 @@ export type TV2AdlibAction =
| ActionClearGraphics
| ActionTakeWithTransition
| ActionRecallLastLive
| ActionRecallLastDVE
46 changes: 44 additions & 2 deletions src/tv2-common/actions/executeAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import {
import { assertUnreachable } from '../util'
import {
ActionCommentatorSelectJingle,
ActionRecallLastDVE,
ActionRecallLastLive,
ActionSelectJingle,
ActionTakeWithTransition
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1711,6 +1721,38 @@ function executeActionRecallLastLive<
context.queuePart(part, pieces)
}

function executeActionRecallLastDVE<
StudioConfig extends TV2StudioConfigBase,
ShowStyleConfig extends TV2BlueprintConfigBase<StudioConfig>
>(
context: ActionExecutionContext,
settings: ActionExecutionSettings<StudioConfig, ShowStyleConfig>,
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<ActionSelectDVE>({
type: AdlibActionType.SELECT_DVE,
config: dveMeta.userData.config,
segmentExternalId: externalId,
videoId: dveMeta.userData.videoId
})
)
}

function executeActionSelectFull<
StudioConfig extends TV2StudioConfigBase,
ShowStyleConfig extends TV2BlueprintConfigBase<StudioConfig>
Expand Down
3 changes: 2 additions & 1 deletion src/tv2-constants/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
17 changes: 17 additions & 0 deletions src/tv2_afvd_showstyle/getRundown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ActionClearGraphics,
ActionCutSourceToBox,
ActionCutToCamera,
ActionRecallLastDVE,
ActionRecallLastLive,
ActionSelectDVELayout,
CreateLYDBaseline,
Expand Down Expand Up @@ -881,6 +882,22 @@ function getGlobalAdlibActionsAFVD(_context: ShowStyleContext, config: Blueprint
)
)

res.push(
literal<IBlueprintActionManifest>({
actionId: AdlibActionType.RECALL_LAST_DVE,
userData: literal<ActionRecallLastDVE>({
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(
Expand Down
10 changes: 5 additions & 5 deletions src/tv2_afvd_showstyle/migrations/sourcelayer-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions src/tv2_offtube_showstyle/getRundown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ActionCutSourceToBox,
ActionCutToCamera,
ActionCutToRemote,
ActionRecallLastDVE,
ActionRecallLastLive,
ActionSelectDVELayout,
CreateLYDBaseline,
Expand Down Expand Up @@ -398,6 +399,22 @@ function getGlobalAdlibActionsOfftube(
)
)

res.push(
literal<IBlueprintActionManifest>({
actionId: AdlibActionType.RECALL_LAST_DVE,
userData: literal<ActionRecallLastDVE>({
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<IBlueprintActionManifest>({
Expand Down
10 changes: 5 additions & 5 deletions src/tv2_offtube_showstyle/migrations/sourcelayer-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2e89855

Please sign in to comment.