Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / CI toolchain image resolves (push) Successful in 9s
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 25s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 8m40s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m18s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 6m12s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 4m13s
probe742/combined-newest SECOND
Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
44 lines
1.9 KiB
C#
44 lines
1.9 KiB
C#
using ErsatzTV.Core.Domain;
|
|
using ErsatzTV.FFmpeg.State;
|
|
using ErsatzTV.Infrastructure.Data;
|
|
using ErsatzTV.Infrastructure.Streaming.Graphics;
|
|
|
|
namespace ErsatzTV.Application.Channels;
|
|
|
|
/// <summary>
|
|
/// #732: the On Now / Next overlay is a default rather than an opt-in, so every newly created channel
|
|
/// gets the built-in element attached.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This lives in one place because there is more than one channel-creation path and they diverged
|
|
/// once already: <c>CreateChannelHandler</c> had it and <c>CreateChannelFromLineupHandler</c> -- the
|
|
/// SPA's primary "Add Channel" flow, and the one Auto-Tune bulk-creates through -- did not. Any new
|
|
/// site that persists a <c>Channel</c> must call this. The third site, <c>DbInitializer</c>'s default
|
|
/// channel, needs no call: it runs before <c>AttachOnNowNextByDefault</c> in the same startup, so the
|
|
/// backfill covers it.
|
|
/// </remarks>
|
|
public static class ChannelGraphicsDefaults
|
|
{
|
|
public static async Task Attach(TvContext dbContext, Channel channel, CancellationToken cancellationToken)
|
|
{
|
|
// HLS Direct is skipped because ErsatzTV is not transcoding there -- there is no frame
|
|
// pipeline to draw into, and the editor disables the toggle for the same reason. Identity is
|
|
// the element's filename, never its user-editable Name (the #67 lesson).
|
|
if (channel.StreamingMode is StreamingMode.HttpLiveStreamingDirect)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Option<int> maybeElementId =
|
|
await GraphicsElementSeeder.GetBuiltInElementId(dbContext, cancellationToken);
|
|
|
|
foreach (int elementId in maybeElementId)
|
|
{
|
|
// Add rather than assign: a future create path that carries graphics ids would otherwise
|
|
// be silently discarded here.
|
|
channel.ChannelGraphicsElements ??= [];
|
|
channel.ChannelGraphicsElements.Add(new ChannelGraphicsElement { GraphicsElementId = elementId });
|
|
}
|
|
}
|
|
}
|