Browse Source

allow string values for count instruction in sequential schedules (#2741)

* allow string values for count instruction in sequential schedules

* fix potential div by zero
pull/2733/merge
Jason Dove 2 days ago committed by GitHub
parent
commit
9fea25a77d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 2
      ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutCountHandler.cs
  3. 2
      ErsatzTV/Resources/sequential-schedule-import.schema.json
  4. 2
      ErsatzTV/Resources/sequential-schedule.schema.json

1
CHANGELOG.md

@ -62,6 +62,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix high CPU when errors are displayed; errors will now work ahead before throttling to realtime, similar to primary content - Fix high CPU when errors are displayed; errors will now work ahead before throttling to realtime, similar to primary content
- Fix startup error caused by duplicate smart collection names (and no longer allow duplicate smart collection names) - Fix startup error caused by duplicate smart collection names (and no longer allow duplicate smart collection names)
- Fix erroneous downgrade health check failure with some installations that use MariaDB - Fix erroneous downgrade health check failure with some installations that use MariaDB
- Sequential schedules: fix `count` instruction validation to accept integer (constant) or string (expression)
### Changed ### Changed
- No longer round framerate to nearest integer when normalizing framerate - No longer round framerate to nearest integer when normalizing framerate

2
ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutCountHandler.cs

@ -43,7 +43,7 @@ public class YamlPlayoutCountHandler(EnumeratorCache enumeratorCache) : YamlPlay
e.Result = name switch e.Result = name switch
{ {
"count" => enumeratorCount, "count" => enumeratorCount,
"random" => random.Next() % enumeratorCount, "random" => enumeratorCount > 0 ? random.Next() % enumeratorCount : 0,
_ => e.Result _ => e.Result
}; };
}; };

2
ErsatzTV/Resources/sequential-schedule-import.schema.json

@ -191,7 +191,7 @@
"countInstruction": { "countInstruction": {
"type": "object", "type": "object",
"properties": { "properties": {
"count": { "type": "integer" }, "count": { "type": ["integer", "string"] },
"content": { "type": "string" }, "content": { "type": "string" },
"custom_title": { "type": "string" }, "custom_title": { "type": "string" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }, "filler_kind": { "$ref": "#/$defs/enums/filler_kind" },

2
ErsatzTV/Resources/sequential-schedule.schema.json

@ -242,7 +242,7 @@
"countInstruction": { "countInstruction": {
"type": "object", "type": "object",
"properties": { "properties": {
"count": { "type": "integer" }, "count": { "type": ["integer", "string"] },
"content": { "type": "string" }, "content": { "type": "string" },
"custom_title": { "type": "string" }, "custom_title": { "type": "string" },
"filler_kind": { "$ref": "#/$defs/enums/filler_kind" }, "filler_kind": { "$ref": "#/$defs/enums/filler_kind" },

Loading…
Cancel
Save