fix time zone mix.up
This commit is contained in:
parent
cdab2d76a7
commit
702a5abdc5
@ -160,7 +160,7 @@ public class RecordingService : IRecordingService, IDisposable
|
|||||||
|
|
||||||
// Filter to only future/current livestreams that aren't blocked
|
// Filter to only future/current livestreams that aren't blocked
|
||||||
return livestreams
|
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)
|
.OrderBy(ls => ls.ValidFrom)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -333,13 +333,23 @@ public class RecordingService : IRecordingService, IDisposable
|
|||||||
|
|
||||||
foreach (var entry in _recordings.ToList())
|
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)
|
switch (entry.State)
|
||||||
{
|
{
|
||||||
case RecordingState.Scheduled:
|
case RecordingState.Scheduled:
|
||||||
case RecordingState.WaitingForStream:
|
case RecordingState.WaitingForStream:
|
||||||
// Check if it's time to start recording
|
// 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);
|
changed |= await TryStartRecordingAsync(entry, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +357,7 @@ public class RecordingService : IRecordingService, IDisposable
|
|||||||
|
|
||||||
case RecordingState.Recording:
|
case RecordingState.Recording:
|
||||||
// Check if recording should stop (ValidTo reached or process died)
|
// 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);
|
_logger.LogInformation("Recording '{Title}' reached ValidTo, stopping", entry.Title);
|
||||||
StopFfmpeg(entry.Id);
|
StopFfmpeg(entry.Id);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user