Browse Source

fully validate yaml playouts (#2229)

pull/2230/head
Jason Dove 2 weeks ago committed by GitHub
parent
commit
f0ca358c2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      CHANGELOG.md
  2. 230
      ErsatzTV/Resources/yaml-playout.schema.json

7
CHANGELOG.md

@ -16,10 +16,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -16,10 +16,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- With value of `true` and `sequence` property, will enable automatic pre-roll for all content in the playout to the sequence with the provided key
- With value of `false`, will disable automatic pre-roll in the playout
- Add YAML playout validation (using JSON Schema)
- Invalid YAML playout definitions will fail to build and will log validation failures as warnings
- `content` is fully validated
- `sequence` is not validated yet
- `reset` is not validated yet
- `playout` is not validated yet
- `sequence` is fully validated
- `reset` is fully validated
- `playout` is fully validated
### Fixed
- Fix app startup with MySql/MariaDB

230
ErsatzTV/Resources/yaml-playout.schema.json

@ -10,34 +10,93 @@ @@ -10,34 +10,93 @@
"type": "array",
"items": {
"oneOf": [
{ "$ref": "#/$defs/showContent" },
{ "$ref": "#/$defs/searchContent" },
{ "$ref": "#/$defs/collectionContent" },
{ "$ref": "#/$defs/multiCollectionContent" },
{ "$ref": "#/$defs/smartCollectionContent" },
{ "$ref": "#/$defs/playlistContent" },
{ "$ref": "#/$defs/marathonContent" }
{ "$ref": "#/$defs/content/showContent" },
{ "$ref": "#/$defs/content/searchContent" },
{ "$ref": "#/$defs/content/collectionContent" },
{ "$ref": "#/$defs/content/multiCollectionContent" },
{ "$ref": "#/$defs/content/smartCollectionContent" },
{ "$ref": "#/$defs/content/playlistContent" },
{ "$ref": "#/$defs/content/marathonContent" }
]
},
"minItems": 1
},
"sequence": {
"description": "Sequence definitions",
"type": "array"
"type": "array",
"items": {
"type": "object",
"properties": {
"key": { "type": "string" },
"items": {
"type": "array",
"items": {
"oneOf": [
{ "$ref": "#/$defs/scheduling/allInstruction" },
{ "$ref": "#/$defs/scheduling/countInstruction" },
{ "$ref": "#/$defs/scheduling/durationInstruction" },
{ "$ref": "#/$defs/scheduling/padToNextInstruction" },
{ "$ref": "#/$defs/scheduling/padUntilInstruction" },
{ "$ref": "#/$defs/scheduling/sequenceInstruction" },
{ "$ref": "#/$defs/control/epgGroupInstruction" },
{ "$ref": "#/$defs/control/preRollInstruction"},
{ "$ref": "#/$defs/control/repeatInstruction" },
{ "$ref": "#/$defs/control/shuffleSequenceInstruction" },
{ "$ref": "#/$defs/control/skipItemsInstruction" },
{ "$ref": "#/$defs/control/skipToItemInstruction" },
{ "$ref": "#/$defs/control/waitUntilInstruction" },
{ "$ref": "#/$defs/control/watermarkInstruction" }
]
},
"minItems": 1
}
},
"required": [ "key" ],
"additionalProperties": false
}
},
"reset": {
"description": "Reset instructions",
"type": "array"
"type": "array",
"items": {
"oneOf": [
{ "$ref": "#/$defs/control/skipItemsInstruction" },
{ "$ref": "#/$defs/control/skipToItemInstruction" },
{ "$ref": "#/$defs/control/waitUntilInstruction" }
]
}
},
"playout": {
"description": "Playout instructions",
"type": "array",
"items": {
"oneOf": [
{ "$ref": "#/$defs/scheduling/allInstruction" },
{ "$ref": "#/$defs/scheduling/countInstruction" },
{ "$ref": "#/$defs/scheduling/durationInstruction" },
{ "$ref": "#/$defs/scheduling/padToNextInstruction" },
{ "$ref": "#/$defs/scheduling/padUntilInstruction" },
{ "$ref": "#/$defs/scheduling/sequenceInstruction" },
{ "$ref": "#/$defs/control/epgGroupInstruction" },
{ "$ref": "#/$defs/control/preRollInstruction"},
{ "$ref": "#/$defs/control/repeatInstruction" },
{ "$ref": "#/$defs/control/shuffleSequenceInstruction" },
{ "$ref": "#/$defs/control/skipItemsInstruction" },
{ "$ref": "#/$defs/control/skipToItemInstruction" },
{ "$ref": "#/$defs/control/waitUntilInstruction" },
{ "$ref": "#/$defs/control/watermarkInstruction" }
]
},
"minItems": 1
}
},
"required": [ "content", "playout" ],
"additionalProperties": false,
"$defs": {
"enums": {
"filler_kind": { "enum": [ "none", "preroll", "postroll", "midroll" ] }
},
"content": {
"showContent": {
"type": "object",
"properties": {
@ -142,5 +201,158 @@ @@ -142,5 +201,158 @@
"required": [ "marathon", "key" ],
"additionalProperties": false
}
},
"scheduling": {
"allInstruction": {
"type": "object",
"properties": {
"all": { "type": "null" },
"content": { "type": "string" },
"custom_title": { "type": "string" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }
},
"required": [ "all", "content" ],
"additionalProperties": false
},
"countInstruction": {
"type": "object",
"properties": {
"count": { "type": "integer" },
"content": { "type": "string" },
"custom_title": { "type": "string" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }
},
"required": [ "count", "content" ],
"additionalProperties": false
},
"durationInstruction": {
"type": "object",
"properties": {
"duration": { "type": "string" },
"content": { "type": "string" },
"trim": { "type": "boolean" },
"fallback": { "type": "string" },
"discard_attempts": { "type": "integer" },
"offline_tail": { "type": "boolean" },
"stop_before_end": { "type": "boolean" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }
},
"required": [ "duration", "content" ],
"additionalProperties": false
},
"padToNextInstruction": {
"type": "object",
"properties": {
"pad_to_next": { "type": "integer" },
"content": { "type": "string" },
"trim": { "type": "boolean" },
"fallback": { "type": "string" },
"discard_attempts": { "type": "integer" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }
},
"required": [ "pad_to_next", "content" ],
"additionalProperties": false
},
"padUntilInstruction": {
"type": "object",
"properties": {
"pad_until": { "type": "string" },
"content": { "type": "string" },
"tomorrow": { "type": "string" },
"offline_tail": { "type": "boolean" },
"trim": { "type": "boolean" },
"fallback": { "type": "string" },
"discard_attempts": { "type": "integer" },
"stop_before_end": { "type": "boolean" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }
},
"required": [ "pad_until", "content" ],
"additionalProperties": false
},
"sequenceInstruction": {
"type": "object",
"properties": {
"sequence": { "type": "string" },
"repeat": { "type": "integer" }
},
"required": [ "sequence" ],
"additionalProperties": false
}
},
"control": {
"epgGroupInstruction": {
"type": "object",
"properties": {
"epg_group": { "type": "boolean" },
"advance": { "type": "boolean" }
},
"required": [ "epg_group" ],
"additionalProperties": false
},
"preRollInstruction": {
"type": "object",
"properties": {
"pre_roll": { "type": "boolean" },
"sequence": { "type": "string" }
},
"required": [ "pre_roll" ],
"additionalProperties": false
},
"repeatInstruction": {
"type": "object",
"properties": {
"repeat": { "type": "boolean" }
},
"required": [ "repeat" ],
"additionalProperties": false
},
"shuffleSequenceInstruction": {
"type": "object",
"properties": {
"shuffle_sequence": { "type": "string" }
},
"required": [ "shuffle_sequence" ],
"additionalProperties": false
},
"skipItemsInstruction": {
"type": "object",
"properties": {
"skip_items": { "type": "integer" },
"content": { "type": "string" }
},
"required": [ "skip_items", "content" ],
"additionalProperties": false
},
"skipToItemInstruction": {
"type": "object",
"properties": {
"skip_to_item": { "type": "null" },
"content": { "type": "string" },
"season": { "type": "integer" },
"episode": { "type": "integer" }
},
"required": [ "skip_to_item", "content", "season", "episode" ],
"additionalProperties": false
},
"waitUntilInstruction": {
"type": "object",
"properties": {
"wait_until": { "type": "string" },
"tomorrow": { "type": "boolean" },
"rewind_on_reset": { "type": "boolean" }
},
"required": [ "wait_until" ],
"additionalProperties": false
},
"watermarkInstruction": {
"type": "object",
"properties": {
"watermark": { "type": "boolean" },
"name": { "type": "string" }
},
"required": [ "watermark" ],
"additionalProperties": false
}
}
}
}

Loading…
Cancel
Save