Skip to content

Commit

Permalink
SOF-1789 Notify Core about error when CasparCgDesignValues has a whit…
Browse files Browse the repository at this point in the history
…espace in the name
  • Loading branch information
LindvedKrvang committed Mar 13, 2024
1 parent 0b7c07d commit e9bb98d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/tv2-common/cues/gfx-schema-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ 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'

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 []
Expand All @@ -32,7 +39,6 @@ export class GfxSchemaGenerator {
)
return []
}

const cue: CueDefinitionGfxSchema = {
type: CueType.GraphicSchema,
schema: schema.VizTemplate,
Expand All @@ -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[],
Expand Down

0 comments on commit e9bb98d

Please sign in to comment.