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. 422
      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/).
- 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 `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 - With value of `false`, will disable automatic pre-roll in the playout
- Add YAML playout validation (using JSON Schema) - 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 - `content` is fully validated
- `sequence` is not validated yet - `sequence` is fully validated
- `reset` is not validated yet - `reset` is fully validated
- `playout` is not validated yet - `playout` is fully validated
### Fixed ### Fixed
- Fix app startup with MySql/MariaDB - Fix app startup with MySql/MariaDB

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

@ -10,137 +10,349 @@
"type": "array", "type": "array",
"items": { "items": {
"oneOf": [ "oneOf": [
{ "$ref": "#/$defs/showContent" }, { "$ref": "#/$defs/content/showContent" },
{ "$ref": "#/$defs/searchContent" }, { "$ref": "#/$defs/content/searchContent" },
{ "$ref": "#/$defs/collectionContent" }, { "$ref": "#/$defs/content/collectionContent" },
{ "$ref": "#/$defs/multiCollectionContent" }, { "$ref": "#/$defs/content/multiCollectionContent" },
{ "$ref": "#/$defs/smartCollectionContent" }, { "$ref": "#/$defs/content/smartCollectionContent" },
{ "$ref": "#/$defs/playlistContent" }, { "$ref": "#/$defs/content/playlistContent" },
{ "$ref": "#/$defs/marathonContent" } { "$ref": "#/$defs/content/marathonContent" }
] ]
}, },
"minItems": 1 "minItems": 1
}, },
"sequence": { "sequence": {
"description": "Sequence definitions", "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": { "reset": {
"description": "Reset instructions", "description": "Reset instructions",
"type": "array" "type": "array",
"items": {
"oneOf": [
{ "$ref": "#/$defs/control/skipItemsInstruction" },
{ "$ref": "#/$defs/control/skipToItemInstruction" },
{ "$ref": "#/$defs/control/waitUntilInstruction" }
]
}
}, },
"playout": { "playout": {
"description": "Playout instructions", "description": "Playout instructions",
"type": "array", "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 "minItems": 1
} }
}, },
"required": [ "content", "playout" ], "required": [ "content", "playout" ],
"additionalProperties": false, "additionalProperties": false,
"$defs": { "$defs": {
"showContent": { "enums": {
"type": "object", "filler_kind": { "enum": [ "none", "preroll", "postroll", "midroll" ] }
"properties": { },
"show": { "type": "null" }, "content": {
"key": { "type": "string" }, "showContent": {
"guids": { "type": "object",
"type": "array", "properties": {
"minItems": 1, "show": { "type": "null" },
"items": { "key": { "type": "string" },
"type": "object", "guids": {
"properties": { "type": "array",
"source": { "type": "string" }, "minItems": 1,
"value": { "type": "string" } "items": {
}, "type": "object",
"required": [ "source", "value" ], "properties": {
"additionalProperties": false "source": { "type": "string" },
} "value": { "type": "string" }
},
"required": [ "source", "value" ],
"additionalProperties": false
}
},
"order": { "enum": [ "chronological", "shuffle" ] }
}, },
"order": { "enum": [ "chronological", "shuffle" ] } "required": [ "show", "key", "guids", "order" ],
"additionalProperties": false
}, },
"required": [ "show", "key", "guids", "order" ], "searchContent": {
"additionalProperties": false "type": "object",
}, "properties": {
"searchContent": { "search": { "type": "null" },
"type": "object", "key": { "type": "string" },
"properties": { "query": { "type": "string" },
"search": { "type": "null" }, "order": { "enum": [ "chronological", "shuffle" ] }
"key": { "type": "string" }, },
"query": { "type": "string" }, "required": [ "search", "key", "query", "order" ],
"order": { "enum": [ "chronological", "shuffle" ] } "additionalProperties": false
}, },
"required": [ "search", "key", "query", "order" ], "collectionContent": {
"additionalProperties": false "type": "object",
}, "properties": {
"collectionContent": { "collection": { "type": "string" },
"type": "object", "key": { "type": "string" },
"properties": { "order": { "enum": [ "chronological", "shuffle" ] }
"collection": { "type": "string" }, },
"key": { "type": "string" }, "required": [ "collection", "key", "order" ],
"order": { "enum": [ "chronological", "shuffle" ] } "additionalProperties": false
}, },
"required": [ "collection", "key", "order" ], "multiCollectionContent": {
"additionalProperties": false "type": "object",
}, "properties": {
"multiCollectionContent": { "multi_collection": { "type": "string" },
"type": "object", "key": { "type": "string" },
"properties": { "order": { "enum": [ "chronological", "shuffle" ] }
"multi_collection": { "type": "string" }, },
"key": { "type": "string" }, "required": [ "multi_collection", "key", "order" ],
"order": { "enum": [ "chronological", "shuffle" ] } "additionalProperties": false
}, },
"required": [ "multi_collection", "key", "order" ], "smartCollectionContent": {
"additionalProperties": false "type": "object",
}, "properties": {
"smartCollectionContent": { "smart_collection": { "type": "string" },
"type": "object", "key": { "type": "string" },
"properties": { "order": { "enum": [ "chronological", "shuffle" ] }
"smart_collection": { "type": "string" }, },
"key": { "type": "string" }, "required": [ "smart_collection", "key", "order" ],
"order": { "enum": [ "chronological", "shuffle" ] } "additionalProperties": false
}, },
"required": [ "smart_collection", "key", "order" ], "playlistContent": {
"additionalProperties": false "type": "object",
"properties": {
"playlist": { "type": "string" },
"playlist_group": { "type": "string" },
"key": { "type": "string" }
},
"required": [ "playlist", "playlist_group", "key" ],
"additionalProperties": false
},
"marathonContent": {
"type": "object",
"properties": {
"marathon": { "type": "null" },
"key": { "type": "string" },
"guids": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"source": { "type": "string" },
"value": { "type": "string" }
},
"required": [ "source", "value" ],
"additionalProperties": false
}
},
"searches": {
"type": "array",
"items": { "type": "string" }
},
"group_by": { "enum": [ "show", "season", "artist", "album" ] },
"item_order": { "enum": [ "chronological", "shuffle" ] },
"play_all_items": { "type": "boolean" },
"shuffle_groups": { "type": "boolean" }
},
"required": [ "marathon", "key" ],
"additionalProperties": false
}
}, },
"playlistContent": { "scheduling": {
"type": "object", "allInstruction": {
"properties": { "type": "object",
"playlist": { "type": "string" }, "properties": {
"playlist_group": { "type": "string" }, "all": { "type": "null" },
"key": { "type": "string" } "content": { "type": "string" },
}, "custom_title": { "type": "string" },
"required": [ "playlist", "playlist_group", "key" ], "filler_kind": { "$ref": "#/$defs/enums/filler_kind" }
"additionalProperties": false },
"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
}
}, },
"marathonContent": { "control": {
"type": "object", "epgGroupInstruction": {
"properties": { "type": "object",
"marathon": { "type": "null" }, "properties": {
"key": { "type": "string" }, "epg_group": { "type": "boolean" },
"guids": { "advance": { "type": "boolean" }
"type": "array", },
"minItems": 1, "required": [ "epg_group" ],
"items": { "additionalProperties": false
"type": "object", },
"properties": { "preRollInstruction": {
"source": { "type": "string" }, "type": "object",
"value": { "type": "string" } "properties": {
}, "pre_roll": { "type": "boolean" },
"required": [ "source", "value" ], "sequence": { "type": "string" }
"additionalProperties": false },
} "required": [ "pre_roll" ],
"additionalProperties": false
},
"repeatInstruction": {
"type": "object",
"properties": {
"repeat": { "type": "boolean" }
}, },
"searches": { "required": [ "repeat" ],
"type": "array", "additionalProperties": false
"items": { "type": "string" } },
"shuffleSequenceInstruction": {
"type": "object",
"properties": {
"shuffle_sequence": { "type": "string" }
}, },
"group_by": { "enum": [ "show", "season", "artist", "album" ] }, "required": [ "shuffle_sequence" ],
"item_order": { "enum": [ "chronological", "shuffle" ] }, "additionalProperties": false
"play_all_items": { "type": "boolean" },
"shuffle_groups": { "type": "boolean" }
}, },
"required": [ "marathon", "key" ], "skipItemsInstruction": {
"additionalProperties": false "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