fix time zone mix.up
All checks were successful
🏗️ Build Plugin / build (push) Successful in 44s
Latest Release / latest-release (push) Successful in 53s
🧪 Test Plugin / test (push) Successful in 36s

This commit is contained in:
Duncan Tourolle 2026-03-07 17:26:51 +01:00
parent cdab2d76a7
commit 702a5abdc5

View File

@ -160,7 +160,7 @@ public class RecordingService : IRecordingService, IDisposable
// Filter to only future/current livestreams that aren't blocked
return livestreams
.Where(ls => ls.Blocked != true && (ls.ValidTo == null || ls.ValidTo > DateTime.UtcNow))
.Where(ls => ls.Blocked != true && (ls.ValidTo == null || ls.ValidTo.Value.ToUniversalTime() > DateTime.UtcNow))
.OrderBy(ls => ls.ValidFrom)
.ToList();
}
@ -333,13 +333,23 @@ public class RecordingService : IRecordingService, IDisposable
foreach (var entry in _recordings.ToList())
{
// Normalize ValidFrom/ValidTo to UTC for correct comparison
var validFromUtc = entry.ValidFrom.HasValue ? entry.ValidFrom.Value.ToUniversalTime() : (DateTime?)null;
var validToUtc = entry.ValidTo.HasValue ? entry.ValidTo.Value.ToUniversalTime() : (DateTime?)null;
switch (entry.State)
{
case RecordingState.Scheduled:
case RecordingState.WaitingForStream:
// Check if it's time to start recording
if (entry.ValidFrom.HasValue && entry.ValidFrom.Value <= now.AddMinutes(2))
if (validFromUtc.HasValue && validFromUtc.Value <= now.AddMinutes(2))
{
_logger.LogInformation(
"Time to start recording '{Title}': ValidFrom={ValidFrom} (UTC: {ValidFromUtc}), Now={Now}",
entry.Title,
entry.ValidFrom,
validFromUtc,
now);
changed |= await TryStartRecordingAsync(entry, cancellationToken).ConfigureAwait(false);
}
@ -347,7 +357,7 @@ public class RecordingService : IRecordingService, IDisposable
case RecordingState.Recording:
// Check if recording should stop (ValidTo reached or process died)
if (entry.ValidTo.HasValue && entry.ValidTo.Value <= now)
if (validToUtc.HasValue && validToUtc.Value <= now)
{
_logger.LogInformation("Recording '{Title}' reached ValidTo, stopping", entry.Title);
StopFfmpeg(entry.Id);