evenly divide epg time for schedule blocks (#1607)
* add checkbox to include block items in program guide * evenly divide epg time for schedule blocks
This commit is contained in:
@@ -32,8 +32,6 @@ public class BlockPlayoutBuilder(
|
||||
playout.Channel.Number,
|
||||
playout.Channel.Name);
|
||||
|
||||
var random = new Random();
|
||||
|
||||
List<PlaybackOrder> allowedPlaybackOrders =
|
||||
[
|
||||
PlaybackOrder.Chronological,
|
||||
@@ -149,14 +147,16 @@ public class BlockPlayoutBuilder(
|
||||
Finish = currentTime.UtcDateTime + itemDuration,
|
||||
InPoint = TimeSpan.Zero,
|
||||
OutPoint = itemDuration,
|
||||
FillerKind = FillerKind.None,
|
||||
FillerKind = blockItem.IncludeInProgramGuide ? FillerKind.None : FillerKind.GuideMode,
|
||||
//CustomTitle = scheduleItem.CustomTitle,
|
||||
//WatermarkId = scheduleItem.WatermarkId,
|
||||
//PreferredAudioLanguageCode = scheduleItem.PreferredAudioLanguageCode,
|
||||
//PreferredAudioTitle = scheduleItem.PreferredAudioTitle,
|
||||
//PreferredSubtitleLanguageCode = scheduleItem.PreferredSubtitleLanguageCode,
|
||||
//SubtitleMode = scheduleItem.SubtitleMode
|
||||
GuideGroup = random.Next(),
|
||||
GuideGroup = effectiveBlock.TemplateItemId,
|
||||
GuideStart = effectiveBlock.Start.UtcDateTime,
|
||||
GuideFinish = blockFinish.UtcDateTime,
|
||||
BlockKey = JsonConvert.SerializeObject(effectiveBlock.BlockKey),
|
||||
CollectionKey = JsonConvert.SerializeObject(collectionKey, JsonSettings),
|
||||
CollectionEtag = collectionEtags[collectionKey]
|
||||
|
||||
@@ -2,7 +2,7 @@ using ErsatzTV.Core.Domain.Scheduling;
|
||||
|
||||
namespace ErsatzTV.Core.Scheduling.BlockScheduling;
|
||||
|
||||
internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset Start)
|
||||
internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset Start, int TemplateItemId)
|
||||
{
|
||||
public static List<EffectiveBlock> GetEffectiveBlocks(
|
||||
ICollection<PlayoutTemplate> templates,
|
||||
@@ -27,6 +27,7 @@ internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset St
|
||||
|
||||
var newBlocks = playoutTemplate.Template.Items
|
||||
.Map(i => ToEffectiveBlock(playoutTemplate, i, today, start))
|
||||
.Map(NormalizeGuideMode)
|
||||
.ToList();
|
||||
|
||||
effectiveBlocks.AddRange(newBlocks);
|
||||
@@ -56,5 +57,20 @@ internal record EffectiveBlock(Block Block, BlockKey BlockKey, DateTimeOffset St
|
||||
templateItem.StartTime.Hours,
|
||||
templateItem.StartTime.Minutes,
|
||||
0,
|
||||
start.Offset));
|
||||
start.Offset),
|
||||
templateItem.Id);
|
||||
|
||||
private static EffectiveBlock NormalizeGuideMode(EffectiveBlock effectiveBlock)
|
||||
{
|
||||
if (effectiveBlock.Block.Items is not null &&
|
||||
effectiveBlock.Block.Items.All(bi => bi.IncludeInProgramGuide == false))
|
||||
{
|
||||
foreach (BlockItem blockItem in effectiveBlock.Block.Items)
|
||||
{
|
||||
blockItem.IncludeInProgramGuide = true;
|
||||
}
|
||||
}
|
||||
|
||||
return effectiveBlock;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user