Browse Source

fix guide group generation for `duration` yaml instruction (#1943)

pull/1946/head
Jason Dove 9 months ago committed by GitHub
parent
commit
fbb7a661fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 3
      ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutAllHandler.cs
  3. 3
      ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutCountHandler.cs
  4. 4
      ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutDurationHandler.cs
  5. 4
      ErsatzTV.Core/Scheduling/YamlScheduling/YamlPlayoutBuilder.cs
  6. 22
      ErsatzTV.Core/Scheduling/YamlScheduling/YamlPlayoutContext.cs

1
CHANGELOG.md

@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix selecting audio stream with preferred title
- Fix synchronizing Plex collections
- If this breaks collection sync for you, you will need to update your Plex server
- Fix guide group generation for `duration` YAML instructions
## [0.8.8-beta] - 2024-09-19
### Added

3
ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutAllHandler.cs

@ -49,7 +49,7 @@ public class YamlPlayoutAllHandler(EnumeratorCache enumeratorCache) : YamlPlayou @@ -49,7 +49,7 @@ public class YamlPlayoutAllHandler(EnumeratorCache enumeratorCache) : YamlPlayou
//PreferredAudioTitle = scheduleItem.PreferredAudioTitle,
//PreferredSubtitleLanguageCode = scheduleItem.PreferredSubtitleLanguageCode,
//SubtitleMode = scheduleItem.SubtitleMode
GuideGroup = context.NextGuideGroup()
GuideGroup = context.PeekNextGuideGroup()
//GuideStart = effectiveBlock.Start.UtcDateTime,
//GuideFinish = blockFinish.UtcDateTime,
//BlockKey = JsonConvert.SerializeObject(effectiveBlock.BlockKey),
@ -58,6 +58,7 @@ public class YamlPlayoutAllHandler(EnumeratorCache enumeratorCache) : YamlPlayou @@ -58,6 +58,7 @@ public class YamlPlayoutAllHandler(EnumeratorCache enumeratorCache) : YamlPlayou
};
context.Playout.Items.Add(playoutItem);
context.AdvanceGuideGroup();
// create history record
Option<PlayoutHistory> maybeHistory = GetHistoryForItem(

3
ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutCountHandler.cs

@ -49,7 +49,7 @@ public class YamlPlayoutCountHandler(EnumeratorCache enumeratorCache) : YamlPlay @@ -49,7 +49,7 @@ public class YamlPlayoutCountHandler(EnumeratorCache enumeratorCache) : YamlPlay
//PreferredAudioTitle = scheduleItem.PreferredAudioTitle,
//PreferredSubtitleLanguageCode = scheduleItem.PreferredSubtitleLanguageCode,
//SubtitleMode = scheduleItem.SubtitleMode
GuideGroup = context.NextGuideGroup()
GuideGroup = context.PeekNextGuideGroup()
//GuideStart = effectiveBlock.Start.UtcDateTime,
//GuideFinish = blockFinish.UtcDateTime,
//BlockKey = JsonConvert.SerializeObject(effectiveBlock.BlockKey),
@ -58,6 +58,7 @@ public class YamlPlayoutCountHandler(EnumeratorCache enumeratorCache) : YamlPlay @@ -58,6 +58,7 @@ public class YamlPlayoutCountHandler(EnumeratorCache enumeratorCache) : YamlPlay
};
context.Playout.Items.Add(playoutItem);
context.AdvanceGuideGroup();
// create history record
Option<PlayoutHistory> maybeHistory = GetHistoryForItem(

4
ErsatzTV.Core/Scheduling/YamlScheduling/Handlers/YamlPlayoutDurationHandler.cs

@ -91,7 +91,7 @@ public class YamlPlayoutDurationHandler(EnumeratorCache enumeratorCache) : YamlP @@ -91,7 +91,7 @@ public class YamlPlayoutDurationHandler(EnumeratorCache enumeratorCache) : YamlP
Finish = context.CurrentTime.UtcDateTime + itemDuration,
InPoint = TimeSpan.Zero,
OutPoint = itemDuration,
GuideGroup = context.NextGuideGroup(),
GuideGroup = context.PeekNextGuideGroup(),
FillerKind = fillerKind,
CustomTitle = string.IsNullOrWhiteSpace(customTitle) ? null : customTitle
//DisableWatermarks = !allowWatermarks
@ -100,6 +100,7 @@ public class YamlPlayoutDurationHandler(EnumeratorCache enumeratorCache) : YamlP @@ -100,6 +100,7 @@ public class YamlPlayoutDurationHandler(EnumeratorCache enumeratorCache) : YamlP
if (remainingToFill - itemDuration >= TimeSpan.Zero)
{
context.Playout.Items.Add(playoutItem);
context.AdvanceGuideGroup();
// create history record
Option<PlayoutHistory> maybeHistory = GetHistoryForItem(
@ -132,6 +133,7 @@ public class YamlPlayoutDurationHandler(EnumeratorCache enumeratorCache) : YamlP @@ -132,6 +133,7 @@ public class YamlPlayoutDurationHandler(EnumeratorCache enumeratorCache) : YamlP
playoutItem.OutPoint = playoutItem.Finish - playoutItem.Start;
context.Playout.Items.Add(playoutItem);
context.AdvanceGuideGroup();
// create history record
Option<PlayoutHistory> maybeHistory = GetHistoryForItem(

4
ErsatzTV.Core/Scheduling/YamlScheduling/YamlPlayoutBuilder.cs

@ -170,9 +170,11 @@ public class YamlPlayoutBuilder( @@ -170,9 +170,11 @@ public class YamlPlayoutBuilder(
{
NextStart = maxTime,
NextInstructionIndex = context.InstructionIndex,
NextGuideGroup = context.NextGuideGroup()
NextGuideGroup = context.PeekNextGuideGroup()
};
context.AdvanceGuideGroup();
// logger.LogDebug(
// "Saving yaml context at {Start}, instruction {Instruction}",
// maxTime,

22
ErsatzTV.Core/Scheduling/YamlScheduling/YamlPlayoutContext.cs

@ -28,27 +28,41 @@ public class YamlPlayoutContext(Playout playout, YamlPlayoutDefinition definitio @@ -28,27 +28,41 @@ public class YamlPlayoutContext(Playout playout, YamlPlayoutDefinition definitio
public bool VisitedAll => _visitedInstructions.Count >= Definition.Playout.Count;
public int NextGuideGroup()
public int PeekNextGuideGroup()
{
if (_guideGroupLocked)
{
return _guideGroup;
}
int result = _guideGroup + 1;
if (result > 1000)
{
result = 1;
}
return result;
}
public void AdvanceGuideGroup()
{
if (_guideGroupLocked)
{
return;
}
_guideGroup++;
if (_guideGroup > 1000)
{
_guideGroup = 1;
}
return _guideGroup;
}
public void LockGuideGroup(bool advance = true)
{
if (advance)
{
NextGuideGroup();
AdvanceGuideGroup();
}
_guideGroupLocked = true;

Loading…
Cancel
Save