PR Gates / CI image pin matches docker/ci (pull_request) Successful in 12s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 17s
PR Gates / Docs update reminder (pull_request) Successful in 19s
PR Gates / decisions lifecycle (pull_request) Successful in 22s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 13m44s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 17m8s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 20m34s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 20m41s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
CreateChannelFromLineupHandler resolved every advanced override with advanced.X ?? template.X, so null always meant INHERIT and a channel could not drop a template-set watermark / filler / preferred language. Add an optional typed `clear` enum list to CreateChannelFromLineupAdvancedOptions: omitted/null still inherits (byte-stable for existing clients), a field named in `clear` is forced to none. Set+clear of the same field is a 422. The enum (CreateChannelFromLineupClearField) lives in ErsatzTV.Core so the OpenAPI string-enum scan renders it as a string enum, matching every sibling advanced-options enum. Handler resolves clearable fields once via ResolveClearable and validates set/clear conflicts via ValidateClear; reference validation skips existence checks for cleared (null) refs. SPA: the shared advancedOptions model re-adds a real "None" option to the five id selects (watermark + fillers) in both the Channel Builder and the Auto-Tune DetailPanel, routed through a CLEAR overrides sentinel that applyOverridesToRequest folds into advanced.clear (never leaking onto the wire as a field value). The backend enum also covers the preferred audio/subtitle language strings for machine clients; the SPA text inputs keep "empty = inherit" (tri-state deferred). Docs: api-conventions.md §2, spa-conventions.md §11, decisions.md record api.from-lineup-clear-to-none; v1.json + generated TS regenerated. fixes #135 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
121 lines
3.9 KiB
C#
121 lines
3.9 KiB
C#
#nullable enable
|
|
|
|
using ErsatzTV.Application.Artworks;
|
|
using ErsatzTV.Application.Channels;
|
|
using ErsatzTV.Core.Api.Channels;
|
|
using ErsatzTV.Core.Api.LibraryBrowse;
|
|
using ErsatzTV.Core.Domain;
|
|
using ErsatzTV.Core.Scheduling;
|
|
|
|
namespace ErsatzTV.Controllers.Api.Requests;
|
|
|
|
/// <summary>
|
|
/// Composite request to create a channel, its generated schedule/playlist and a classic playout in one call.
|
|
/// Template defaults are stamped at create time; any value set in <see cref="Advanced" /> overrides the template.
|
|
/// A single-item lineup references its target directly; a multi-item lineup is played in order via a generated
|
|
/// system playlist.
|
|
/// </summary>
|
|
public record CreateChannelFromLineupRequest(
|
|
string Name,
|
|
string Number,
|
|
string Group,
|
|
string Categories,
|
|
ArtworkContentTypeModel Logo,
|
|
bool IsEnabled,
|
|
bool ShowInEpg,
|
|
int TemplateId,
|
|
CreateChannelFromLineupAdvancedOptionsRequest? Advanced,
|
|
List<CreateChannelFromLineupItemRequest> Lineup)
|
|
{
|
|
public CreateChannelFromLineup ToCommand() =>
|
|
new(
|
|
Name,
|
|
Number,
|
|
Group,
|
|
Categories,
|
|
(Logo ?? ArtworkContentTypeModel.None).Sanitized(),
|
|
IsEnabled,
|
|
ShowInEpg,
|
|
TemplateId,
|
|
Advanced?.ToCommand() ?? new CreateChannelFromLineupAdvancedOptions(),
|
|
Lineup.Map(i => i.ToCommand()).ToList());
|
|
}
|
|
|
|
public record CreateChannelFromLineupAdvancedOptionsRequest(
|
|
PlaybackOrder? PlaybackOrder = null,
|
|
int? FFmpegProfileId = null,
|
|
int? WatermarkId = null,
|
|
int? FallbackFillerId = null,
|
|
int? PreRollFillerId = null,
|
|
int? MidRollFillerId = null,
|
|
int? PostRollFillerId = null,
|
|
ChannelStreamSelectorMode? StreamSelectorMode = null,
|
|
string? StreamSelector = null,
|
|
string? PreferredAudioLanguageCode = null,
|
|
string? PreferredAudioTitle = null,
|
|
ChannelPlayoutSource? PlayoutSource = null,
|
|
ChannelPlayoutMode? PlayoutMode = null,
|
|
StreamingMode? StreamingMode = null,
|
|
string? PreferredSubtitleLanguageCode = null,
|
|
ChannelSubtitleMode? SubtitleMode = null,
|
|
ChannelMusicVideoCreditsMode? MusicVideoCreditsMode = null,
|
|
string? MusicVideoCreditsTemplate = null,
|
|
ChannelSongVideoMode? SongVideoMode = null,
|
|
ChannelTranscodeMode? TranscodeMode = null,
|
|
ChannelIdleBehavior? IdleBehavior = null,
|
|
bool? ShuffleScheduleItems = null,
|
|
bool? RandomStartPoint = null,
|
|
FixedStartTimeBehavior? FixedStartTimeBehavior = null,
|
|
List<CreateChannelFromLineupClearField>? Clear = null)
|
|
{
|
|
public CreateChannelFromLineupAdvancedOptions ToCommand() =>
|
|
new(
|
|
PlaybackOrder,
|
|
FFmpegProfileId,
|
|
WatermarkId,
|
|
FallbackFillerId,
|
|
PreRollFillerId,
|
|
MidRollFillerId,
|
|
PostRollFillerId,
|
|
StreamSelectorMode,
|
|
StreamSelector,
|
|
PreferredAudioLanguageCode,
|
|
PreferredAudioTitle,
|
|
PlayoutSource,
|
|
PlayoutMode,
|
|
StreamingMode,
|
|
PreferredSubtitleLanguageCode,
|
|
SubtitleMode,
|
|
MusicVideoCreditsMode,
|
|
MusicVideoCreditsTemplate,
|
|
SongVideoMode,
|
|
TranscodeMode,
|
|
IdleBehavior,
|
|
ShuffleScheduleItems,
|
|
RandomStartPoint,
|
|
FixedStartTimeBehavior,
|
|
Clear);
|
|
}
|
|
|
|
public record CreateChannelFromLineupItemRequest(
|
|
LibraryBrowseMediaType MediaType,
|
|
CollectionType CollectionType,
|
|
int? CollectionId,
|
|
int? MultiCollectionId,
|
|
int? SmartCollectionId,
|
|
int? RerunCollectionId,
|
|
int? MediaItemId,
|
|
int? PlaylistId)
|
|
{
|
|
public CreateChannelFromLineupItem ToCommand() =>
|
|
new(
|
|
MediaType,
|
|
CollectionType,
|
|
CollectionId,
|
|
MultiCollectionId,
|
|
SmartCollectionId,
|
|
RerunCollectionId,
|
|
MediaItemId,
|
|
PlaylistId);
|
|
}
|