duration mode guide fixes (#1207)
* fix playout mode duration xmltv * fix playout mode duration wrapping midnight
This commit is contained in:
@@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Fix song normalization to match FFmpeg Profile bit depth
|
||||
- Fix bug playing some external subtitle files (e.g. with an apostrophe in the file name)
|
||||
- Fix bug detecting VAAPI capabilities when no device is selected in active FFmpeg Profile
|
||||
- Fix playout mode duration bugs in XMLTV
|
||||
- Tail mode filler will properly include filler duration in XMLTV
|
||||
- Duration that wraps across midnight will no longer have overlapping items in XMLTV
|
||||
|
||||
### Changed
|
||||
- Ignore case of video and audio file extensions in local folder scanner
|
||||
|
||||
@@ -289,7 +289,9 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(1, 50, 0)));
|
||||
playoutItems[2].GuideGroup.Should().Be(3);
|
||||
playoutItems[2].FillerKind.Should().Be(FillerKind.None);
|
||||
playoutItems[2].GuideFinish.HasValue.Should().BeTrue();
|
||||
|
||||
// offline should not set guide finish
|
||||
playoutItems[2].GuideFinish.HasValue.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -111,7 +111,8 @@ public class ChannelGuide
|
||||
|
||||
int finishIndex = j;
|
||||
while (finishIndex + 1 < sorted.Count && (sorted[finishIndex + 1].GuideGroup == startItem.GuideGroup
|
||||
|| sorted[finishIndex + 1].FillerKind == FillerKind.GuideMode))
|
||||
|| sorted[finishIndex + 1].FillerKind is FillerKind.GuideMode
|
||||
or FillerKind.Tail or FillerKind.Fallback))
|
||||
{
|
||||
finishIndex++;
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ public class PlayoutModeSchedulerDuration : PlayoutModeSchedulerBase<ProgramSche
|
||||
{
|
||||
DurationFinish = itemStartTime + scheduleItem.PlayoutDuration
|
||||
};
|
||||
|
||||
durationUntil = nextState.DurationFinish;
|
||||
}
|
||||
|
||||
durationUntil = nextState.DurationFinish;
|
||||
|
||||
TimeSpan itemDuration = DurationForMediaItem(mediaItem);
|
||||
List<MediaChapter> itemChapters = ChaptersForMediaItem(mediaItem);
|
||||
|
||||
@@ -194,10 +194,21 @@ public class PlayoutModeSchedulerDuration : PlayoutModeSchedulerBase<ProgramSche
|
||||
}
|
||||
}
|
||||
|
||||
// clear guide finish on all but the last item
|
||||
var all = playoutItems.Filter(pi => pi.FillerKind == FillerKind.None).ToList();
|
||||
PlayoutItem last = all.MaxBy(pi => pi.FinishOffset);
|
||||
foreach (PlayoutItem item in all.Filter(pi => pi != last))
|
||||
bool hasFallback = playoutItems.Any(p => p.FillerKind == FillerKind.Fallback);
|
||||
|
||||
var playoutItemsToClear = playoutItems
|
||||
.Filter(pi => pi.FillerKind == FillerKind.None)
|
||||
.ToList();
|
||||
|
||||
PlayoutItem lastItem = playoutItemsToClear.MaxBy(pi => pi.FinishOffset);
|
||||
|
||||
// if we've finished the duration or are in offline tail mode with no fallback, keep guide finish on the last item
|
||||
if (nextState.DurationFinish.IsNone && (scheduleItem.TailMode != TailMode.Offline || hasFallback))
|
||||
{
|
||||
playoutItemsToClear.Remove(lastItem);
|
||||
}
|
||||
|
||||
foreach (PlayoutItem item in playoutItemsToClear)
|
||||
{
|
||||
item.GuideFinish = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user