Browse Source

add deco setting to use watermarks during filler (#1861)

pull/1862/head
Jason Dove 1 year ago committed by GitHub
parent
commit
2977590a14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 1
      ErsatzTV.Application/Scheduling/Commands/UpdateDeco.cs
  3. 2
      ErsatzTV.Application/Scheduling/Commands/UpdateDecoHandler.cs
  4. 1
      ErsatzTV.Application/Scheduling/DecoViewModel.cs
  5. 1
      ErsatzTV.Application/Scheduling/Mapper.cs
  6. 31
      ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs
  7. 1
      ErsatzTV.Core/Domain/Scheduling/Deco.cs
  8. 5869
      ErsatzTV.Infrastructure.MySql/Migrations/20240805181135_Add_Deco_UseWatermarkDuringFiller.Designer.cs
  9. 29
      ErsatzTV.Infrastructure.MySql/Migrations/20240805181135_Add_Deco_UseWatermarkDuringFiller.cs
  10. 3
      ErsatzTV.Infrastructure.MySql/Migrations/TvContextModelSnapshot.cs
  11. 5708
      ErsatzTV.Infrastructure.Sqlite/Migrations/20240805181036_Add_Deco_UseWatermarkDuringFiller.Designer.cs
  12. 29
      ErsatzTV.Infrastructure.Sqlite/Migrations/20240805181036_Add_Deco_UseWatermarkDuringFiller.cs
  13. 3
      ErsatzTV.Infrastructure.Sqlite/Migrations/TvContextModelSnapshot.cs
  14. 15
      ErsatzTV/Pages/DecoEditor.razor
  15. 1
      ErsatzTV/ViewModels/DecoEditViewModel.cs

2
CHANGELOG.md

@ -37,6 +37,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -37,6 +37,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- POST `/api/channels/{channelNumber}/playout/reset`
- Scan library
- POST `/api/libraries/{libraryId}/scan`
- Add Deco setting to `Use Watermark During Filler`
- This setting is turned OFF by default, meaning filler will NOT use the configured watermark unless this is manually turned on
### Fixed
- Add basic cache busting to XMLTV image URLs

1
ErsatzTV.Application/Scheduling/Commands/UpdateDeco.cs

@ -10,6 +10,7 @@ public record UpdateDeco( @@ -10,6 +10,7 @@ public record UpdateDeco(
string Name,
DecoMode WatermarkMode,
int? WatermarkId,
bool UseWatermarkDuringFiller,
DecoMode DefaultFillerMode,
ProgramScheduleItemCollectionType DefaultFillerCollectionType,
int? DefaultFillerCollectionId,

2
ErsatzTV.Application/Scheduling/Commands/UpdateDecoHandler.cs

@ -26,6 +26,8 @@ public class UpdateDecoHandler(IDbContextFactory<TvContext> dbContextFactory) @@ -26,6 +26,8 @@ public class UpdateDecoHandler(IDbContextFactory<TvContext> dbContextFactory)
// watermark
existing.WatermarkMode = request.WatermarkMode;
existing.WatermarkId = request.WatermarkMode is DecoMode.Override ? request.WatermarkId : null;
existing.UseWatermarkDuringFiller =
request.WatermarkMode is DecoMode.Override && request.UseWatermarkDuringFiller;
// default filler
existing.DefaultFillerMode = request.DefaultFillerMode;

1
ErsatzTV.Application/Scheduling/DecoViewModel.cs

@ -9,6 +9,7 @@ public record DecoViewModel( @@ -9,6 +9,7 @@ public record DecoViewModel(
string Name,
DecoMode WatermarkMode,
int? WatermarkId,
bool UseWatermarkDuringFiller,
DecoMode DefaultFillerMode,
ProgramScheduleItemCollectionType DefaultFillerCollectionType,
int? DefaultFillerCollectionId,

1
ErsatzTV.Application/Scheduling/Mapper.cs

@ -56,6 +56,7 @@ internal static class Mapper @@ -56,6 +56,7 @@ internal static class Mapper
deco.Name,
deco.WatermarkMode,
deco.WatermarkId,
deco.UseWatermarkDuringFiller,
deco.DefaultFillerMode,
deco.DefaultFillerCollectionType,
deco.DefaultFillerCollectionId,

31
ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs

@ -232,7 +232,7 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -232,7 +232,7 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
Option<ChannelWatermark> playoutItemWatermark = Optional(playoutItemWithPath.PlayoutItem.Watermark);
bool disableWatermarks = playoutItemWithPath.PlayoutItem.DisableWatermarks;
WatermarkResult watermarkResult = GetPlayoutItemWatermark(playoutItemWithPath.PlayoutItem.Playout, now);
WatermarkResult watermarkResult = GetPlayoutItemWatermark(playoutItemWithPath.PlayoutItem, now);
switch (watermarkResult)
{
case InheritWatermark:
@ -464,7 +464,10 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -464,7 +464,10 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
case CustomDeadAirFallback custom:
maybeFallback = new FillerPreset
{
AllowWatermarks = false, // TODO: does this need to be configurable?
// always allow watermarks here
// deco settings will disable watermarks if appropriate
AllowWatermarks = true,
CollectionType = custom.CollectionType,
CollectionId = custom.CollectionId,
MediaItemId = custom.MediaItemId,
@ -657,9 +660,9 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -657,9 +660,9 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
};
}
private WatermarkResult GetPlayoutItemWatermark(Playout playout, DateTimeOffset now)
private WatermarkResult GetPlayoutItemWatermark(PlayoutItem playoutItem, DateTimeOffset now)
{
DecoEntries decoEntries = GetDecoEntries(playout, now);
DecoEntries decoEntries = GetDecoEntries(playoutItem.Playout, now);
// first, check deco template / active deco
foreach (Deco templateDeco in decoEntries.TemplateDeco)
@ -667,8 +670,14 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -667,8 +670,14 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
switch (templateDeco.WatermarkMode)
{
case DecoMode.Override:
_logger.LogDebug("Watermark will come from template deco (override)");
return new CustomWatermark(templateDeco.Watermark);
if (playoutItem.FillerKind is FillerKind.None || templateDeco.UseWatermarkDuringFiller)
{
_logger.LogDebug("Watermark will come from template deco (override)");
return new CustomWatermark(templateDeco.Watermark);
}
_logger.LogDebug("Watermark is disabled by template deco during filler");
return new DisableWatermark();
case DecoMode.Disable:
_logger.LogDebug("Watermark is disabled by template deco");
return new DisableWatermark();
@ -684,8 +693,14 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< @@ -684,8 +693,14 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler<
switch (playoutDeco.WatermarkMode)
{
case DecoMode.Override:
_logger.LogDebug("Watermark will come from playout deco (override)");
return new CustomWatermark(playoutDeco.Watermark);
if (playoutItem.FillerKind is FillerKind.None || playoutDeco.UseWatermarkDuringFiller)
{
_logger.LogDebug("Watermark will come from playout deco (override)");
return new CustomWatermark(playoutDeco.Watermark);
}
_logger.LogDebug("Watermark is disabled by playout deco during filler");
return new DisableWatermark();
case DecoMode.Disable:
_logger.LogDebug("Watermark is disabled by playout deco");
return new DisableWatermark();

1
ErsatzTV.Core/Domain/Scheduling/Deco.cs

@ -12,6 +12,7 @@ public class Deco @@ -12,6 +12,7 @@ public class Deco
public DecoMode WatermarkMode { get; set; }
public int? WatermarkId { get; set; }
public ChannelWatermark Watermark { get; set; }
public bool UseWatermarkDuringFiller { get; set; }
// default filler
public DecoMode DefaultFillerMode { get; set; }

5869
ErsatzTV.Infrastructure.MySql/Migrations/20240805181135_Add_Deco_UseWatermarkDuringFiller.Designer.cs generated

File diff suppressed because it is too large Load Diff

29
ErsatzTV.Infrastructure.MySql/Migrations/20240805181135_Add_Deco_UseWatermarkDuringFiller.cs

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.MySql.Migrations
{
/// <inheritdoc />
public partial class Add_Deco_UseWatermarkDuringFiller : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UseWatermarkDuringFiller",
table: "Deco",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseWatermarkDuringFiller",
table: "Deco");
}
}
}

3
ErsatzTV.Infrastructure.MySql/Migrations/TvContextModelSnapshot.cs

@ -2312,6 +2312,9 @@ namespace ErsatzTV.Infrastructure.MySql.Migrations @@ -2312,6 +2312,9 @@ namespace ErsatzTV.Infrastructure.MySql.Migrations
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<bool>("UseWatermarkDuringFiller")
.HasColumnType("tinyint(1)");
b.Property<int?>("WatermarkId")
.HasColumnType("int");

5708
ErsatzTV.Infrastructure.Sqlite/Migrations/20240805181036_Add_Deco_UseWatermarkDuringFiller.Designer.cs generated

File diff suppressed because it is too large Load Diff

29
ErsatzTV.Infrastructure.Sqlite/Migrations/20240805181036_Add_Deco_UseWatermarkDuringFiller.cs

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.Sqlite.Migrations
{
/// <inheritdoc />
public partial class Add_Deco_UseWatermarkDuringFiller : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "UseWatermarkDuringFiller",
table: "Deco",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UseWatermarkDuringFiller",
table: "Deco");
}
}
}

3
ErsatzTV.Infrastructure.Sqlite/Migrations/TvContextModelSnapshot.cs

@ -2197,6 +2197,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations @@ -2197,6 +2197,9 @@ namespace ErsatzTV.Infrastructure.Sqlite.Migrations
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<bool>("UseWatermarkDuringFiller")
.HasColumnType("INTEGER");
b.Property<int?>("WatermarkId")
.HasColumnType("INTEGER");

15
ErsatzTV/Pages/DecoEditor.razor

@ -45,6 +45,12 @@ @@ -45,6 +45,12 @@
<MudSelectItem T="int?" Value="@watermark.Id">@watermark.Name</MudSelectItem>
}
</MudSelect>
<MudSwitch T="bool"
Class="mt-3"
Disabled="@(_deco.WatermarkMode != DecoMode.Override)"
@bind-Value="_deco.UseWatermarkDuringFiller"
Color="Color.Primary"
Label="Use Watermark During Filler"/>
</MudCardContent>
</MudCard>
<MudCard Class="mb-6" Style="width: 350px">
@ -159,7 +165,12 @@ @@ -159,7 +165,12 @@
}
</MudSelect>
}
<MudSwitch T="bool" Class="mt-3" Label="Trim To Fit" @bind-Value="_deco.DefaultFillerTrimToFit" Color="Color.Primary" />
<MudSwitch T="bool"
Class="mt-3"
Disabled="@(_deco.DefaultFillerMode != DecoMode.Override)"
Label="Trim To Fit"
@bind-Value="_deco.DefaultFillerTrimToFit"
Color="Color.Primary" />
</MudCardContent>
</MudCard>
<MudCard Class="mb-6" Style="width: 350px">
@ -344,6 +355,7 @@ @@ -344,6 +355,7 @@
DecoGroupId = deco.DecoGroupId,
WatermarkMode = deco.WatermarkMode,
WatermarkId = deco.WatermarkId,
UseWatermarkDuringFiller = deco.UseWatermarkDuringFiller,
DefaultFillerMode = deco.DefaultFillerMode,
DefaultFillerCollectionType = deco.DefaultFillerCollectionType,
@ -389,6 +401,7 @@ @@ -389,6 +401,7 @@
_deco.Name,
_deco.WatermarkMode,
_deco.WatermarkId,
_deco.UseWatermarkDuringFiller,
_deco.DefaultFillerMode,
_deco.DefaultFillerCollectionType,
_deco.DefaultFillerCollection?.Id,

1
ErsatzTV/ViewModels/DecoEditViewModel.cs

@ -11,6 +11,7 @@ public class DecoEditViewModel @@ -11,6 +11,7 @@ public class DecoEditViewModel
public string Name { get; set; }
public DecoMode WatermarkMode { get; set; }
public int? WatermarkId { get; set; }
public bool UseWatermarkDuringFiller { get; set; }
public DecoMode DefaultFillerMode { get; set; }
public ProgramScheduleItemCollectionType DefaultFillerCollectionType { get; set; }

Loading…
Cancel
Save