From e9bb98d775ae29076505add56b8e0edcd27fd13c Mon Sep 17 00:00:00 2001 From: Rasmus Lindved Date: Wed, 13 Mar 2024 13:40:22 +0100 Subject: [PATCH] SOF-1789 Notify Core about error when CasparCgDesignValues has a whitespace in the name --- src/tv2-common/cues/gfx-schema-generator.ts | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/tv2-common/cues/gfx-schema-generator.ts b/src/tv2-common/cues/gfx-schema-generator.ts index 75357a63..debec064 100644 --- a/src/tv2-common/cues/gfx-schema-generator.ts +++ b/src/tv2-common/cues/gfx-schema-generator.ts @@ -12,6 +12,11 @@ import { CueType, SharedGraphicLLayer, SharedOutputLayer, SharedSourceLayer } fr import { Tv2PieceType } from '../../tv2-constants/tv2-piece-type' import { DveLoopGenerator } from '../helpers/graphics/caspar/dve-loop-generator' +interface CasparCgDesignValues { + name: string + properties: unknown +} + const NON_BASELINE_SCHEMA: string = 'NON_BASELINE_SCHEMA' const VALID_EMPTY_SCHEMA_VALUE: string = 'N/A' @@ -19,6 +24,8 @@ export class GfxSchemaGenerator { constructor(private dveLoopGenerator: DveLoopGenerator) {} public createBaselineTimelineObjectsFromGfxDefaults(context: ShowStyleContext): TSR.TSRTimelineObjBase[] { + this.assertAllCasparCgDesignValues(context) + const schemaId: string = context.config.showStyle.GfxDefaults[0].DefaultSchema.value if (VALID_EMPTY_SCHEMA_VALUE === schemaId) { return [] @@ -32,7 +39,6 @@ export class GfxSchemaGenerator { ) return [] } - const cue: CueDefinitionGfxSchema = { type: CueType.GraphicSchema, schema: schema.VizTemplate, @@ -42,6 +48,22 @@ export class GfxSchemaGenerator { return this.createBaselineTimelineObjects(context, cue, 10) } + private assertAllCasparCgDesignValues(context: ShowStyleContext): void { + context.config.showStyle.GfxSchemaTemplates.forEach((schema) => { + if (!schema.CasparCgDesignValues) { + return + } + const casparCgDesignValues: CasparCgDesignValues[] = JSON.parse(schema.CasparCgDesignValues) + casparCgDesignValues.forEach((designValues) => { + if (designValues.name && designValues.name.includes(' ')) { + context.core.notifyUserError( + `Schema for ${schema.VizTemplate} has invalid CasparCgDesignValues. The Design ${designValues.name} has whitespace in it's name!` + ) + } + }) + }) + } + public createBlueprintPieceFromGfxSchemaCue( context: ShowStyleContext, pieces: IBlueprintPiece[],