mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* add deco graphics elements, selector and tests * add migrations * edit deco graphics elements from ui * update changelogpull/2414/head
27 changed files with 13723 additions and 6 deletions
@ -0,0 +1,374 @@
@@ -0,0 +1,374 @@
|
||||
using ErsatzTV.Core.Domain; |
||||
using ErsatzTV.Core.Domain.Filler; |
||||
using ErsatzTV.Core.Domain.Scheduling; |
||||
using ErsatzTV.Core.FFmpeg; |
||||
using Microsoft.Extensions.Logging; |
||||
using NUnit.Framework; |
||||
using Serilog; |
||||
using Shouldly; |
||||
|
||||
namespace ErsatzTV.Core.Tests.FFmpeg; |
||||
|
||||
[TestFixture] |
||||
public class GraphicsElementSelectorTests |
||||
{ |
||||
private static readonly GraphicsElementSelector GraphicsElementSelector; |
||||
private static readonly DateTimeOffset Now = new(2025, 08, 17, 12, 0, 0, TimeSpan.FromHours(-5)); |
||||
|
||||
private static readonly GraphicsElement GraphicsElementTemplateDeco; |
||||
private static readonly GraphicsElement GraphicsElementDefaultDeco; |
||||
private static readonly GraphicsElement GraphicsElementPlayoutItem; |
||||
|
||||
private static readonly Channel Channel; |
||||
private static readonly Channel ChannelHlsDirect; |
||||
|
||||
private static readonly PlayoutItem PlayoutItemWithNoGraphics; |
||||
private static readonly PlayoutItem PlayoutItemWithGraphics; |
||||
private static readonly PlayoutItem PlayoutItemWithGraphicsAsFiller; |
||||
|
||||
private static readonly PlayoutItem TemplateDecoInherit; |
||||
private static readonly PlayoutItem TemplateDecoDisable; |
||||
private static readonly PlayoutItem TemplateDecoOverride; |
||||
private static readonly PlayoutItem TemplateDecoMerge; |
||||
private static readonly PlayoutItem TemplateDecoMergeFillerDisabled; |
||||
|
||||
private static readonly PlayoutItem DefaultDecoInherit; |
||||
private static readonly PlayoutItem DefaultDecoDisable; |
||||
private static readonly PlayoutItem DefaultDecoOverride; |
||||
private static readonly PlayoutItem DefaultDecoMerge; |
||||
|
||||
private static readonly PlayoutItem TemplateDecoInheritDefaultDecoMerge; |
||||
private static readonly PlayoutItem TemplateDecoMergeDefaultDecoInherit; |
||||
private static readonly PlayoutItem TemplateDecoMergeDefaultDecoMerge; |
||||
private static readonly PlayoutItem TemplateDecoOverrideDefaultDecoMerge; |
||||
|
||||
static GraphicsElementSelectorTests() |
||||
{ |
||||
Log.Logger = new LoggerConfiguration() |
||||
.MinimumLevel.Debug() |
||||
.WriteTo.Console() |
||||
.CreateLogger(); |
||||
|
||||
var loggerFactory = new LoggerFactory().AddSerilog(Log.Logger); |
||||
|
||||
GraphicsElementSelector = new GraphicsElementSelector( |
||||
new DecoSelector(loggerFactory.CreateLogger<DecoSelector>()), |
||||
loggerFactory.CreateLogger<GraphicsElementSelector>()); |
||||
|
||||
GraphicsElementTemplateDeco = new GraphicsElement { Id = 1, Path = "Template Deco GE" }; |
||||
GraphicsElementDefaultDeco = new GraphicsElement { Id = 2, Path = "Default Deco GE" }; |
||||
GraphicsElementPlayoutItem = new GraphicsElement { Id = 3, Path = "Playout Item GE" }; |
||||
|
||||
Channel = new Channel(Guid.NewGuid()); |
||||
ChannelHlsDirect = new Channel(Guid.NewGuid()) { StreamingMode = StreamingMode.HttpLiveStreamingDirect }; |
||||
|
||||
PlayoutItemWithNoGraphics = new PlayoutItem { PlayoutItemGraphicsElements = [] }; |
||||
PlayoutItemWithGraphics = new PlayoutItem |
||||
{ |
||||
PlayoutItemGraphicsElements = |
||||
[ |
||||
new PlayoutItemGraphicsElement { GraphicsElement = GraphicsElementPlayoutItem } |
||||
] |
||||
}; |
||||
PlayoutItemWithGraphicsAsFiller = new PlayoutItem |
||||
{ |
||||
PlayoutItemGraphicsElements = |
||||
[ |
||||
new PlayoutItemGraphicsElement { GraphicsElement = GraphicsElementPlayoutItem } |
||||
], |
||||
FillerKind = FillerKind.Tail |
||||
}; |
||||
|
||||
var decoWithInherit = new DecoTemplate |
||||
{ Items = [new DecoTemplateItem { Deco = new Deco { GraphicsElementsMode = DecoMode.Inherit } }] }; |
||||
var decoWithDisable = new DecoTemplate |
||||
{ Items = [new DecoTemplateItem { Deco = new Deco { GraphicsElementsMode = DecoMode.Disable } }] }; |
||||
var decoWithOverride = new DecoTemplate |
||||
{ |
||||
Items = |
||||
[ |
||||
new DecoTemplateItem |
||||
{ |
||||
Deco = new Deco |
||||
{ |
||||
GraphicsElementsMode = DecoMode.Override, |
||||
DecoGraphicsElements = |
||||
[new DecoGraphicsElement { GraphicsElement = GraphicsElementTemplateDeco }] |
||||
} |
||||
} |
||||
] |
||||
}; |
||||
var decoWithMerge = new DecoTemplate |
||||
{ |
||||
Items = |
||||
[ |
||||
new DecoTemplateItem |
||||
{ |
||||
Deco = new Deco |
||||
{ |
||||
GraphicsElementsMode = DecoMode.Merge, |
||||
DecoGraphicsElements = |
||||
[new DecoGraphicsElement { GraphicsElement = GraphicsElementTemplateDeco }], |
||||
UseGraphicsElementsDuringFiller = true |
||||
} |
||||
} |
||||
] |
||||
}; |
||||
|
||||
var decoWithMergeFillerDisabled = new DecoTemplate |
||||
{ |
||||
Items = |
||||
[ |
||||
new DecoTemplateItem |
||||
{ |
||||
Deco = new Deco |
||||
{ |
||||
GraphicsElementsMode = DecoMode.Merge, |
||||
DecoGraphicsElements = |
||||
[new DecoGraphicsElement { GraphicsElement = GraphicsElementTemplateDeco }], |
||||
UseGraphicsElementsDuringFiller = false |
||||
} |
||||
} |
||||
] |
||||
}; |
||||
|
||||
var playoutWithTemplateDecoInherit = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithInherit |
||||
} |
||||
] |
||||
}; |
||||
|
||||
var playoutWithTemplateDecoDisable = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithDisable |
||||
} |
||||
] |
||||
}; |
||||
|
||||
var playoutWithTemplateDecoOverride = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithOverride |
||||
} |
||||
] |
||||
}; |
||||
|
||||
var playoutWithTemplateDecoMerge = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithMerge |
||||
} |
||||
] |
||||
}; |
||||
|
||||
var playoutWithTemplateDecoMergeFillerDisabled = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithMergeFillerDisabled |
||||
} |
||||
] |
||||
}; |
||||
|
||||
TemplateDecoInherit = new PlayoutItem |
||||
{ Playout = playoutWithTemplateDecoInherit, PlayoutItemGraphicsElements = [] }; |
||||
TemplateDecoDisable = new PlayoutItem |
||||
{ Playout = playoutWithTemplateDecoDisable, PlayoutItemGraphicsElements = [] }; |
||||
TemplateDecoOverride = new PlayoutItem |
||||
{ Playout = playoutWithTemplateDecoOverride, PlayoutItemGraphicsElements = [] }; |
||||
TemplateDecoMerge = new PlayoutItem |
||||
{ Playout = playoutWithTemplateDecoMerge, PlayoutItemGraphicsElements = [] }; |
||||
TemplateDecoMergeFillerDisabled = new PlayoutItem |
||||
{ Playout = playoutWithTemplateDecoMergeFillerDisabled, FillerKind = FillerKind.Tail }; |
||||
|
||||
var playoutWithDecoInherit = new Playout |
||||
{ Deco = new Deco { GraphicsElementsMode = DecoMode.Inherit }, Templates = [] }; |
||||
var playoutWithDecoDisable = new Playout |
||||
{ Deco = new Deco { GraphicsElementsMode = DecoMode.Disable }, Templates = [] }; |
||||
var playoutWithDecoOverride = new Playout |
||||
{ |
||||
Deco = new Deco |
||||
{ |
||||
GraphicsElementsMode = DecoMode.Override, |
||||
DecoGraphicsElements = [new DecoGraphicsElement { GraphicsElement = GraphicsElementDefaultDeco }] |
||||
}, |
||||
Templates = [] |
||||
}; |
||||
var playoutWithDecoMerge = new Playout |
||||
{ |
||||
Deco = new Deco |
||||
{ |
||||
GraphicsElementsMode = DecoMode.Merge, |
||||
DecoGraphicsElements = [new DecoGraphicsElement { GraphicsElement = GraphicsElementDefaultDeco }] |
||||
}, |
||||
Templates = [] |
||||
}; |
||||
|
||||
DefaultDecoInherit = new PlayoutItem { Playout = playoutWithDecoInherit, PlayoutItemGraphicsElements = [] }; |
||||
DefaultDecoDisable = new PlayoutItem { Playout = playoutWithDecoDisable, PlayoutItemGraphicsElements = [] }; |
||||
DefaultDecoOverride = new PlayoutItem { Playout = playoutWithDecoOverride, PlayoutItemGraphicsElements = [] }; |
||||
DefaultDecoMerge = new PlayoutItem { Playout = playoutWithDecoMerge, PlayoutItemGraphicsElements = [] }; |
||||
|
||||
var playoutWithTemplateInheritDefaultMerge = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithInherit |
||||
} |
||||
], |
||||
Deco = playoutWithDecoMerge.Deco |
||||
}; |
||||
|
||||
TemplateDecoInheritDefaultDecoMerge = new PlayoutItem |
||||
{ Playout = playoutWithTemplateInheritDefaultMerge, PlayoutItemGraphicsElements = [] }; |
||||
|
||||
var playoutWithTemplateMergeDefaultInherit = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithMerge |
||||
} |
||||
], |
||||
Deco = playoutWithDecoInherit.Deco |
||||
}; |
||||
|
||||
TemplateDecoMergeDefaultDecoInherit = new PlayoutItem |
||||
{ Playout = playoutWithTemplateMergeDefaultInherit, PlayoutItemGraphicsElements = [] }; |
||||
|
||||
var playoutWithTemplateMergeDefaultMerge = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithMerge |
||||
} |
||||
], |
||||
Deco = playoutWithDecoMerge.Deco |
||||
}; |
||||
|
||||
TemplateDecoMergeDefaultDecoMerge = new PlayoutItem |
||||
{ Playout = playoutWithTemplateMergeDefaultMerge, PlayoutItemGraphicsElements = [] }; |
||||
|
||||
var playoutWithTemplateOverrideDefaultMerge = new Playout |
||||
{ |
||||
Templates = |
||||
[ |
||||
new PlayoutTemplate |
||||
{ |
||||
DaysOfWeek = PlayoutTemplate.AllDaysOfWeek(), |
||||
DaysOfMonth = PlayoutTemplate.AllDaysOfMonth(), |
||||
MonthsOfYear = PlayoutTemplate.AllMonthsOfYear(), |
||||
DecoTemplate = decoWithOverride |
||||
} |
||||
], |
||||
Deco = playoutWithDecoMerge.Deco |
||||
}; |
||||
|
||||
TemplateDecoOverrideDefaultDecoMerge = new PlayoutItem |
||||
{ Playout = playoutWithTemplateOverrideDefaultMerge, PlayoutItemGraphicsElements = [] }; |
||||
} |
||||
|
||||
private static IEnumerable<(Channel channel, PlayoutItem playoutItem, List<GraphicsElement> expected)> |
||||
SelectGraphicsElementsTestCases() |
||||
{ |
||||
// HLS direct streaming mode disables graphics
|
||||
yield return (ChannelHlsDirect, PlayoutItemWithGraphics, []); |
||||
|
||||
// no graphics configured
|
||||
yield return (Channel, PlayoutItemWithNoGraphics, []); |
||||
|
||||
// only playout item graphics
|
||||
yield return (Channel, PlayoutItemWithGraphics, [GraphicsElementPlayoutItem]); |
||||
|
||||
// template deco disable
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoDisable.Playout, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, []); |
||||
|
||||
// template deco override
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoOverride.Playout, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementTemplateDeco]); |
||||
|
||||
// template deco merge
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoMerge.Playout, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementTemplateDeco, GraphicsElementPlayoutItem]); |
||||
|
||||
// template deco inherit, default deco disable
|
||||
yield return (Channel, new PlayoutItem { Playout = new Playout { Templates = TemplateDecoInherit.Playout.Templates, Deco = DefaultDecoDisable.Playout.Deco }, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, []); |
||||
|
||||
// template deco inherit, default deco override
|
||||
yield return (Channel, new PlayoutItem { Playout = new Playout { Templates = TemplateDecoInherit.Playout.Templates, Deco = DefaultDecoOverride.Playout.Deco }, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementDefaultDeco]); |
||||
|
||||
// template deco inherit, default deco merge
|
||||
yield return (Channel, new PlayoutItem { Playout = new Playout { Templates = TemplateDecoInherit.Playout.Templates, Deco = DefaultDecoMerge.Playout.Deco }, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementDefaultDeco, GraphicsElementPlayoutItem]); |
||||
|
||||
// template deco merge, default deco merge
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoMergeDefaultDecoMerge.Playout, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementTemplateDeco, GraphicsElementDefaultDeco, GraphicsElementPlayoutItem]); |
||||
|
||||
// template deco merge, default deco inherit
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoMergeDefaultDecoInherit.Playout, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementTemplateDeco, GraphicsElementPlayoutItem]); |
||||
|
||||
// template deco override, default deco merge (template override should win)
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoOverrideDefaultDecoMerge.Playout, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementTemplateDeco]); |
||||
|
||||
// filler item with template deco merge, filler disabled
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoMergeFillerDisabled.Playout, FillerKind = FillerKind.Tail, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, []); |
||||
|
||||
// filler item with template deco merge, filler enabled
|
||||
yield return (Channel, new PlayoutItem { Playout = TemplateDecoMerge.Playout, FillerKind = FillerKind.Tail, PlayoutItemGraphicsElements = PlayoutItemWithGraphics.PlayoutItemGraphicsElements }, [GraphicsElementTemplateDeco, GraphicsElementPlayoutItem]); |
||||
} |
||||
|
||||
[TestCaseSource(nameof(SelectGraphicsElementsTestCases))] |
||||
public void Should_Select_Appropriate_Graphics_Elements( |
||||
(Channel channel, PlayoutItem playoutItem, List<GraphicsElement> expected) testCase) |
||||
{ |
||||
List<PlayoutItemGraphicsElement> result = GraphicsElementSelector.SelectGraphicsElements( |
||||
testCase.channel, |
||||
testCase.playoutItem, |
||||
Now); |
||||
|
||||
result.Map(pige => pige.GraphicsElement).ShouldBe(testCase.expected); |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
using ErsatzTV.Core.Domain.Scheduling; |
||||
|
||||
namespace ErsatzTV.Core.Domain; |
||||
|
||||
public class DecoGraphicsElement |
||||
{ |
||||
public int DecoId { get; set; } |
||||
public Deco Deco { get; set; } |
||||
public int GraphicsElementId { get; set; } |
||||
public GraphicsElement GraphicsElement { get; set; } |
||||
} |
||||
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
using ErsatzTV.Core.Domain; |
||||
using ErsatzTV.Core.Domain.Filler; |
||||
using ErsatzTV.Core.Domain.Scheduling; |
||||
using ErsatzTV.Core.Interfaces.FFmpeg; |
||||
using Microsoft.Extensions.Logging; |
||||
|
||||
namespace ErsatzTV.Core.FFmpeg; |
||||
|
||||
public class GraphicsElementSelector(IDecoSelector decoSelector, ILogger<GraphicsElementSelector> logger) |
||||
: IGraphicsElementSelector |
||||
{ |
||||
public List<PlayoutItemGraphicsElement> SelectGraphicsElements( |
||||
Channel channel, |
||||
PlayoutItem playoutItem, |
||||
DateTimeOffset now) |
||||
{ |
||||
logger.LogDebug("Checking for graphics elements at {Now}", now); |
||||
|
||||
var result = new List<PlayoutItemGraphicsElement>(); |
||||
|
||||
if (channel.StreamingMode == StreamingMode.HttpLiveStreamingDirect) |
||||
{ |
||||
return result; |
||||
} |
||||
|
||||
// if (playoutItem.DisableWatermarks)
|
||||
// {
|
||||
// logger.LogDebug("Graphics elements are disabled by playout item");
|
||||
// return result;
|
||||
// }
|
||||
|
||||
DecoEntries decoEntries = decoSelector.GetDecoEntries(playoutItem.Playout, now); |
||||
|
||||
// first, check deco template / active deco
|
||||
foreach (Deco templateDeco in decoEntries.TemplateDeco) |
||||
{ |
||||
var done = false; |
||||
|
||||
switch (templateDeco.GraphicsElementsMode) |
||||
{ |
||||
case DecoMode.Merge: |
||||
if (playoutItem.FillerKind is FillerKind.None || templateDeco.UseGraphicsElementsDuringFiller) |
||||
{ |
||||
logger.LogDebug("Graphics elements will come from template deco (merge)"); |
||||
result.AddRange( |
||||
templateDeco.DecoGraphicsElements.Map(dge => dge.GraphicsElement).Map(ge => |
||||
new PlayoutItemGraphicsElement { PlayoutItem = playoutItem, GraphicsElement = ge })); |
||||
break; |
||||
} |
||||
|
||||
logger.LogDebug("Graphics elements are disabled by template deco during filler"); |
||||
result.Clear(); |
||||
done = true; |
||||
break; |
||||
case DecoMode.Override: |
||||
if (playoutItem.FillerKind is FillerKind.None || templateDeco.UseGraphicsElementsDuringFiller) |
||||
{ |
||||
logger.LogDebug("Graphics elements will come from template deco (replace)"); |
||||
result.AddRange( |
||||
templateDeco.DecoGraphicsElements.Map(dge => dge.GraphicsElement).Map(ge => |
||||
new PlayoutItemGraphicsElement { PlayoutItem = playoutItem, GraphicsElement = ge })); |
||||
done = true; |
||||
break; |
||||
} |
||||
|
||||
logger.LogDebug("Graphics elements are disabled by template deco during filler"); |
||||
result.Clear(); |
||||
done = true; |
||||
break; |
||||
case DecoMode.Disable: |
||||
logger.LogDebug("Graphics elements are disabled by template deco"); |
||||
done = true; |
||||
break; |
||||
case DecoMode.Inherit: |
||||
logger.LogDebug("Graphics elements will inherit from playout deco"); |
||||
break; |
||||
} |
||||
|
||||
if (done) |
||||
{ |
||||
return result; |
||||
} |
||||
} |
||||
|
||||
// second, check playout deco
|
||||
foreach (Deco playoutDeco in decoEntries.PlayoutDeco) |
||||
{ |
||||
var done = false; |
||||
|
||||
switch (playoutDeco.GraphicsElementsMode) |
||||
{ |
||||
case DecoMode.Merge: |
||||
if (playoutItem.FillerKind is FillerKind.None || playoutDeco.UseGraphicsElementsDuringFiller) |
||||
{ |
||||
logger.LogDebug("Graphics elements will come from playout deco (merge)"); |
||||
result.AddRange( |
||||
playoutDeco.DecoGraphicsElements.Map(dge => dge.GraphicsElement).Map(ge => |
||||
new PlayoutItemGraphicsElement { PlayoutItem = playoutItem, GraphicsElement = ge })); |
||||
break; |
||||
} |
||||
|
||||
logger.LogDebug("Graphics elements are disabled by playout deco during filler"); |
||||
result.Clear(); |
||||
done = true; |
||||
break; |
||||
case DecoMode.Override: |
||||
if (playoutItem.FillerKind is FillerKind.None || playoutDeco.UseGraphicsElementsDuringFiller) |
||||
{ |
||||
logger.LogDebug("Graphics elements will come from playout deco (replace)"); |
||||
result.AddRange( |
||||
playoutDeco.DecoGraphicsElements.Map(dge => dge.GraphicsElement).Map(ge => |
||||
new PlayoutItemGraphicsElement { PlayoutItem = playoutItem, GraphicsElement = ge })); |
||||
done = true; |
||||
break; |
||||
} |
||||
|
||||
logger.LogDebug("Graphics elements are disabled by playout deco during filler"); |
||||
result.Clear(); |
||||
done = true; |
||||
break; |
||||
case DecoMode.Disable: |
||||
logger.LogDebug("Graphics elements are disabled by playout deco"); |
||||
done = true; |
||||
break; |
||||
case DecoMode.Inherit: |
||||
logger.LogDebug("Graphics elements will inherit from channel and/or global setting"); |
||||
break; |
||||
} |
||||
|
||||
if (done) |
||||
{ |
||||
return result; |
||||
} |
||||
} |
||||
|
||||
result.AddRange(playoutItem.PlayoutItemGraphicsElements); |
||||
|
||||
return result; |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
using ErsatzTV.Core.Domain; |
||||
|
||||
namespace ErsatzTV.Core.Interfaces.FFmpeg; |
||||
|
||||
public interface IGraphicsElementSelector |
||||
{ |
||||
List<PlayoutItemGraphicsElement> SelectGraphicsElements( |
||||
Channel channel, |
||||
PlayoutItem playoutItem, |
||||
DateTimeOffset now); |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Add_DecoGraphicsElements : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AddColumn<int>( |
||||
name: "GraphicsElementsMode", |
||||
table: "Deco", |
||||
type: "int", |
||||
nullable: false, |
||||
defaultValue: 0); |
||||
|
||||
migrationBuilder.AddColumn<bool>( |
||||
name: "UseGraphicsElementsDuringFiller", |
||||
table: "Deco", |
||||
type: "tinyint(1)", |
||||
nullable: false, |
||||
defaultValue: false); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "DecoGraphicsElement", |
||||
columns: table => new |
||||
{ |
||||
DecoId = table.Column<int>(type: "int", nullable: false), |
||||
GraphicsElementId = table.Column<int>(type: "int", nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_DecoGraphicsElement", x => new { x.DecoId, x.GraphicsElementId }); |
||||
table.ForeignKey( |
||||
name: "FK_DecoGraphicsElement_Deco_DecoId", |
||||
column: x => x.DecoId, |
||||
principalTable: "Deco", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_DecoGraphicsElement_GraphicsElement_GraphicsElementId", |
||||
column: x => x.GraphicsElementId, |
||||
principalTable: "GraphicsElement", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}) |
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_DecoGraphicsElement_GraphicsElementId", |
||||
table: "DecoGraphicsElement", |
||||
column: "GraphicsElementId"); |
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropTable( |
||||
name: "DecoGraphicsElement"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "GraphicsElementsMode", |
||||
table: "Deco"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "UseGraphicsElementsDuringFiller", |
||||
table: "Deco"); |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Add_DecoGraphicsElements : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AddColumn<int>( |
||||
name: "GraphicsElementsMode", |
||||
table: "Deco", |
||||
type: "INTEGER", |
||||
nullable: false, |
||||
defaultValue: 0); |
||||
|
||||
migrationBuilder.AddColumn<bool>( |
||||
name: "UseGraphicsElementsDuringFiller", |
||||
table: "Deco", |
||||
type: "INTEGER", |
||||
nullable: false, |
||||
defaultValue: false); |
||||
|
||||
migrationBuilder.CreateTable( |
||||
name: "DecoGraphicsElement", |
||||
columns: table => new |
||||
{ |
||||
DecoId = table.Column<int>(type: "INTEGER", nullable: false), |
||||
GraphicsElementId = table.Column<int>(type: "INTEGER", nullable: false) |
||||
}, |
||||
constraints: table => |
||||
{ |
||||
table.PrimaryKey("PK_DecoGraphicsElement", x => new { x.DecoId, x.GraphicsElementId }); |
||||
table.ForeignKey( |
||||
name: "FK_DecoGraphicsElement_Deco_DecoId", |
||||
column: x => x.DecoId, |
||||
principalTable: "Deco", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
table.ForeignKey( |
||||
name: "FK_DecoGraphicsElement_GraphicsElement_GraphicsElementId", |
||||
column: x => x.GraphicsElementId, |
||||
principalTable: "GraphicsElement", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Cascade); |
||||
}); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_DecoGraphicsElement_GraphicsElementId", |
||||
table: "DecoGraphicsElement", |
||||
column: "GraphicsElementId"); |
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropTable( |
||||
name: "DecoGraphicsElement"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "GraphicsElementsMode", |
||||
table: "Deco"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "UseGraphicsElementsDuringFiller", |
||||
table: "Deco"); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue