Browse Source

fix scripted schedule building across offsets (#2569)

pull/2570/head
Jason Dove 2 months ago committed by GitHub
parent
commit
e851a295a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 35
      ErsatzTV.Core.Tests/Scheduling/Engine/SchedulingEngineTests.cs
  3. 2
      ErsatzTV.Core/Scheduling/Engine/SchedulingEngine.cs

1
CHANGELOG.md

@ -56,6 +56,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -56,6 +56,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix playout builder getting stuck (forever) on block item with an empty collection
- Fix HLS Direct playback when using custom stream selector or preferred audio language/title
- Fix selecting embedded subtitles (text and picture) with HLS Direct
- Fix building scripted schedules across a UTC offset change
### Changed
- Do not use graphics engine for single, permanent watermark

35
ErsatzTV.Core.Tests/Scheduling/Engine/SchedulingEngineTests.cs

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.Core.Scheduling.Engine;
using Microsoft.Extensions.Logging;
using NSubstitute;
using NUnit.Framework;
namespace ErsatzTV.Core.Tests.Scheduling.Engine;
[TestFixture]
public class SchedulingEngineTests
{
[Test]
public void Continue_Across_Time_Change()
{
var engine = new SchedulingEngine(
Substitute.For<IMediaCollectionRepository>(),
Substitute.For<IGraphicsElementRepository>(),
Substitute.For<IChannelRepository>(),
Substitute.For<ILogger<SchedulingEngine>>());
var anchor = new PlayoutAnchor
{
NextStart = new DateTimeOffset(new DateTime(2025, 10, 26), TimeSpan.FromHours(-5)).UtcDateTime
};
var start = new DateTimeOffset(new DateTime(2025, 11, 20), TimeSpan.FromHours(-6));
var finish = start.AddDays(1);
engine.BuildBetween(start, finish);
// should not throw
engine.RestoreOrReset(anchor);
}
}

2
ErsatzTV.Core/Scheduling/Engine/SchedulingEngine.cs

@ -92,7 +92,7 @@ public class SchedulingEngine( @@ -92,7 +92,7 @@ public class SchedulingEngine(
{
foreach (PlayoutAnchor anchor in maybeAnchor)
{
_state.CurrentTime = new DateTimeOffset(anchor.NextStart.ToLocalTime(), _state.CurrentTime.Offset);
_state.CurrentTime = new DateTimeOffset(anchor.NextStart, TimeSpan.Zero).ToLocalTime();
if (string.IsNullOrWhiteSpace(anchor.Context))
{

Loading…
Cancel
Save