|
|
|
@ -397,6 +397,12 @@ public class PlayoutBuilder : IPlayoutBuilder |
|
|
|
// finish,
|
|
|
|
// finish,
|
|
|
|
// playoutFinish);
|
|
|
|
// playoutFinish);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (playout.Anchor is not null && playout.Anchor.NextStartOffset > playoutFinish) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// nothing to do
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// build each day with "continue" anchors
|
|
|
|
// build each day with "continue" anchors
|
|
|
|
while (finish < playoutFinish) |
|
|
|
while (finish < playoutFinish) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -420,7 +426,7 @@ public class PlayoutBuilder : IPlayoutBuilder |
|
|
|
// only randomize once (at the start of the playout)
|
|
|
|
// only randomize once (at the start of the playout)
|
|
|
|
randomStartPoint = false; |
|
|
|
randomStartPoint = false; |
|
|
|
|
|
|
|
|
|
|
|
start = playout.Anchor.NextStartOffset; |
|
|
|
start = playout.Anchor?.NextStartOffset ?? start; |
|
|
|
finish = finish.AddDays(1); |
|
|
|
finish = finish.AddDays(1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -668,14 +674,17 @@ public class PlayoutBuilder : IPlayoutBuilder |
|
|
|
// _logger.LogDebug(
|
|
|
|
// _logger.LogDebug(
|
|
|
|
// "Starting playout ({PlayoutId}) for channel {ChannelNumber} - {ChannelName} at {StartTime}",
|
|
|
|
// "Starting playout ({PlayoutId}) for channel {ChannelNumber} - {ChannelName} at {StartTime}",
|
|
|
|
// playout.Id,
|
|
|
|
// playout.Id,
|
|
|
|
// playout.Channel.Number,
|
|
|
|
// referenceData.Channel.Number,
|
|
|
|
// playout.Channel.Name,
|
|
|
|
// referenceData.Channel.Name,
|
|
|
|
// currentTime);
|
|
|
|
// currentTime);
|
|
|
|
|
|
|
|
|
|
|
|
// removing any items scheduled past the start anchor
|
|
|
|
// removing any items scheduled past the start anchor
|
|
|
|
// this could happen if the app was closed after scheduling items
|
|
|
|
// this could happen if the app was closed after scheduling items
|
|
|
|
// but before saving the anchor
|
|
|
|
// but before saving the anchor
|
|
|
|
result = result with { RemoveAfter = currentTime }; |
|
|
|
foreach (var item in referenceData.ExistingItems.Where(i => i.Start >= currentTime)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
result.ItemsToRemove.Add(item.Id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// start with the previously-decided schedule item
|
|
|
|
// start with the previously-decided schedule item
|
|
|
|
// start with the previous multiple/duration states
|
|
|
|
// start with the previous multiple/duration states
|
|
|
|
@ -822,7 +831,7 @@ public class PlayoutBuilder : IPlayoutBuilder |
|
|
|
playoutBuilderState.CurrentTime); |
|
|
|
playoutBuilderState.CurrentTime); |
|
|
|
|
|
|
|
|
|
|
|
// if we ended in a different alternate schedule, fix the anchor data
|
|
|
|
// if we ended in a different alternate schedule, fix the anchor data
|
|
|
|
if (playoutBuilderState.CurrentTime > playoutFinish && activeScheduleAtAnchor.Id != activeSchedule.Id && |
|
|
|
if (playoutBuilderState.CurrentTime >= playoutFinish && activeScheduleAtAnchor.Id != activeSchedule.Id && |
|
|
|
activeScheduleAtAnchor.Items.Count > 0) |
|
|
|
activeScheduleAtAnchor.Items.Count > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PlayoutBuilderState cleanState = playoutBuilderState with |
|
|
|
PlayoutBuilderState cleanState = playoutBuilderState with |
|
|
|
@ -834,11 +843,14 @@ public class PlayoutBuilder : IPlayoutBuilder |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
DateTimeOffset nextStart = PlayoutModeSchedulerBase<ProgramScheduleItem> |
|
|
|
DateTimeOffset nextStart = PlayoutModeSchedulerBase<ProgramScheduleItem> |
|
|
|
.GetStartTimeAfter(cleanState, activeScheduleAtAnchor.Items.Head()); |
|
|
|
.GetStartTimeAfter(cleanState, activeScheduleAtAnchor.Items.OrderBy(i => i.Index).Head()); |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogWarning( |
|
|
|
if (playoutBuilderState.CurrentTime.TimeOfDay > TimeSpan.Zero) |
|
|
|
"Playout build went beyond midnight ({Time}) into a different alternate schedule; this may cause issues with start times on the next day", |
|
|
|
{ |
|
|
|
playoutBuilderState.CurrentTime); |
|
|
|
_logger.LogWarning( |
|
|
|
|
|
|
|
"Playout build went beyond midnight ({Time}) into a different alternate schedule; this may cause issues with start times on the next day", |
|
|
|
|
|
|
|
playoutBuilderState.CurrentTime); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
playout.Anchor.NextStart = nextStart.UtcDateTime; |
|
|
|
playout.Anchor.NextStart = nextStart.UtcDateTime; |
|
|
|
playout.Anchor.InFlood = false; |
|
|
|
playout.Anchor.InFlood = false; |
|
|
|
|