Refactor various components to improve code clarity and maintainability. Update ListUsersQueryHandler to utilize UserListFilter for parameter handling. Refactor BumperSpecFactory and related classes to encapsulate input parameters into dedicated records, enhancing readability. Adjust MediaAsset and Slot classes to streamline content updates with new content models. Improve BumperRenderBackgroundService and MediaProcessingBackgroundService to use MediaReadyInfo for asset readiness, ensuring consistent parameter management across the application.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
namespace TeleWave.Domain.Broadcast;
|
||||
|
||||
/// <summary>
|
||||
/// Текстовое наполнение подблока заставки. Наборы полей взаимоисключающие: при
|
||||
/// <see cref="BumperTextKind.NowNext"/> работают подписи, при <see cref="BumperTextKind.Free"/> —
|
||||
/// произвольные строки; неиспользуемые просто хранятся, чтобы переключение режима не теряло ввод.
|
||||
/// </summary>
|
||||
public sealed record BumperTextContent(
|
||||
BumperTextKind Kind,
|
||||
string NowLabel,
|
||||
string NextLabel,
|
||||
string Line1,
|
||||
string Line2
|
||||
);
|
||||
@@ -58,23 +58,14 @@ public class BumperTextVariant
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
|
||||
public void Update(
|
||||
string name,
|
||||
BumperTextKind kind,
|
||||
string nowLabel,
|
||||
string nextLabel,
|
||||
string line1,
|
||||
string line2,
|
||||
BumperTrigger trigger,
|
||||
int weight
|
||||
)
|
||||
public void Update(string name, BumperTextContent text, BumperTrigger trigger, int weight)
|
||||
{
|
||||
Name = name;
|
||||
Kind = kind;
|
||||
NowLabel = nowLabel;
|
||||
NextLabel = nextLabel;
|
||||
Line1 = line1;
|
||||
Line2 = line2;
|
||||
Kind = text.Kind;
|
||||
NowLabel = text.NowLabel;
|
||||
NextLabel = text.NextLabel;
|
||||
Line1 = text.Line1;
|
||||
Line2 = text.Line2;
|
||||
Trigger = trigger;
|
||||
Weight = Math.Max(0, weight);
|
||||
}
|
||||
|
||||
@@ -47,11 +47,7 @@ public class ScheduleEntry
|
||||
ScheduleEntryKind kind,
|
||||
DateTimeOffset startsAtUtc,
|
||||
DateTimeOffset endsAtUtc,
|
||||
Guid? showId,
|
||||
int? episodeIndex,
|
||||
Guid? slotId,
|
||||
string? traceJson,
|
||||
Guid? collectionId = null
|
||||
ScheduleEntryOrigin origin
|
||||
) =>
|
||||
new()
|
||||
{
|
||||
@@ -61,11 +57,11 @@ public class ScheduleEntry
|
||||
Kind = kind,
|
||||
StartsAtUtc = startsAtUtc,
|
||||
EndsAtUtc = endsAtUtc,
|
||||
ShowId = showId,
|
||||
EpisodeIndex = episodeIndex,
|
||||
SlotId = slotId,
|
||||
TraceJson = traceJson,
|
||||
CollectionId = collectionId,
|
||||
ShowId = origin.ShowId,
|
||||
EpisodeIndex = origin.EpisodeIndex,
|
||||
SlotId = origin.SlotId,
|
||||
TraceJson = origin.TraceJson,
|
||||
CollectionId = origin.CollectionId,
|
||||
};
|
||||
|
||||
public static ScheduleEntry Program(
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace TeleWave.Domain.Broadcast;
|
||||
|
||||
/// <summary>
|
||||
/// Происхождение записи расписания: чем она порождена и в рамках чего. На эфирную математику не
|
||||
/// влияет — нужно EPG (<see cref="ShowId"/>/<see cref="EpisodeIndex"/>) и отладке сетки
|
||||
/// (<see cref="SlotId"/>/<see cref="TraceJson"/>).
|
||||
/// </summary>
|
||||
public sealed record ScheduleEntryOrigin(
|
||||
Guid? ShowId,
|
||||
int? EpisodeIndex,
|
||||
Guid? SlotId,
|
||||
string? TraceJson,
|
||||
/// <summary>Коллекция (франшиза), частью которой шла запись, или null.</summary>
|
||||
Guid? CollectionId = null
|
||||
);
|
||||
@@ -90,26 +90,17 @@ public class MediaAsset
|
||||
Touch();
|
||||
}
|
||||
|
||||
public void MarkReady(
|
||||
TimeSpan duration,
|
||||
int segmentSeconds,
|
||||
int segmentCount,
|
||||
int width,
|
||||
int height,
|
||||
string videoCodec,
|
||||
string audioCodec,
|
||||
string relativePath
|
||||
)
|
||||
public void MarkReady(MediaReadyInfo info)
|
||||
{
|
||||
Status = MediaAssetStatus.Ready;
|
||||
Duration = duration;
|
||||
SegmentSeconds = segmentSeconds;
|
||||
SegmentCount = segmentCount;
|
||||
Width = width;
|
||||
Height = height;
|
||||
VideoCodec = videoCodec;
|
||||
AudioCodec = audioCodec;
|
||||
RelativePath = relativePath;
|
||||
Duration = info.Duration;
|
||||
SegmentSeconds = info.SegmentSeconds;
|
||||
SegmentCount = info.SegmentCount;
|
||||
Width = info.Width;
|
||||
Height = info.Height;
|
||||
VideoCodec = info.VideoCodec;
|
||||
AudioCodec = info.AudioCodec;
|
||||
RelativePath = info.RelativePath;
|
||||
ErrorMessage = null;
|
||||
if (ProcessingStartedAt is { } startedAt)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace TeleWave.Domain.Media;
|
||||
|
||||
/// <summary>
|
||||
/// Результат обработки ассета: что получилось после нарезки в HLS. Домен эти значения не вычисляет —
|
||||
/// их приносит обработчик медиа (ffmpeg), а <see cref="MediaAsset.MarkReady"/> лишь фиксирует.
|
||||
/// </summary>
|
||||
public sealed record MediaReadyInfo(
|
||||
TimeSpan Duration,
|
||||
int SegmentSeconds,
|
||||
int SegmentCount,
|
||||
int Width,
|
||||
int Height,
|
||||
string VideoCodec,
|
||||
string AudioCodec,
|
||||
/// <summary>Путь к каталогу ассета относительно корня хранилища.</summary>
|
||||
string RelativePath
|
||||
);
|
||||
@@ -108,32 +108,21 @@ public class Slot
|
||||
}
|
||||
|
||||
/// <summary>Правит наполнение слота: чем, в каком объёме и с какими врезками.</summary>
|
||||
public void UpdateContent(
|
||||
string title,
|
||||
SlotKind slotKind,
|
||||
Guid? groupId,
|
||||
string? strategyJson,
|
||||
string? repeatSourceJson,
|
||||
SlotBlockMode blockMode,
|
||||
int blockValue,
|
||||
OverflowPolicy overflowPolicy,
|
||||
Guid? junctionBetweenId = null,
|
||||
Guid? junctionAfterId = null
|
||||
)
|
||||
public void UpdateContent(SlotContent content)
|
||||
{
|
||||
JunctionBetweenId = junctionBetweenId;
|
||||
JunctionAfterId = junctionAfterId;
|
||||
Title = title.Trim();
|
||||
SlotKind = slotKind;
|
||||
BlockMode = blockMode;
|
||||
BlockValue = Math.Max(1, blockValue);
|
||||
OverflowPolicy = overflowPolicy;
|
||||
JunctionBetweenId = content.JunctionBetweenId;
|
||||
JunctionAfterId = content.JunctionAfterId;
|
||||
Title = content.Title.Trim();
|
||||
SlotKind = content.SlotKind;
|
||||
BlockMode = content.BlockMode;
|
||||
BlockValue = Math.Max(1, content.BlockValue);
|
||||
OverflowPolicy = content.OverflowPolicy;
|
||||
|
||||
// Поля, не относящиеся к типу слота, гасим: повтор и конец вещания стратегии не имеют,
|
||||
// и оставленный от прежнего типа мусор потом читался бы генератором как настройка.
|
||||
GroupId = slotKind == SlotKind.Content ? groupId : null;
|
||||
StrategyJson = slotKind == SlotKind.Content ? strategyJson : null;
|
||||
RepeatSourceJson = slotKind == SlotKind.Repeat ? repeatSourceJson : null;
|
||||
GroupId = content.SlotKind == SlotKind.Content ? content.GroupId : null;
|
||||
StrategyJson = content.SlotKind == SlotKind.Content ? content.StrategyJson : null;
|
||||
RepeatSourceJson = content.SlotKind == SlotKind.Repeat ? content.RepeatSourceJson : null;
|
||||
}
|
||||
|
||||
/// <summary>Конец слота в сутках канала. Может выйти за полночь — вещательные сутки длиннее суток.</summary>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace TeleWave.Domain.Programming;
|
||||
|
||||
/// <summary>
|
||||
/// Наполнение слота: чем заполнять эфир, в каком объёме и с какими врезками. Отделено от расписания
|
||||
/// слота (<see cref="Slot.UpdateTiming"/>) — это два независимых набора настроек, и правятся они
|
||||
/// в редакторе тоже раздельно.
|
||||
/// </summary>
|
||||
public sealed record SlotContent(
|
||||
string Title,
|
||||
SlotKind SlotKind,
|
||||
/// <summary>Группа контента — только для <see cref="SlotKind.Content"/>, иначе гасится.</summary>
|
||||
Guid? GroupId,
|
||||
string? StrategyJson,
|
||||
string? RepeatSourceJson,
|
||||
SlotBlockMode BlockMode,
|
||||
int BlockValue,
|
||||
OverflowPolicy OverflowPolicy,
|
||||
/// <summary>Стык между единицами внутри блока (null — врезок внутри блока нет).</summary>
|
||||
Guid? JunctionBetweenId = null,
|
||||
/// <summary>Стык в конце блока (null — берётся стык шаблона по умолчанию).</summary>
|
||||
Guid? JunctionAfterId = null
|
||||
);
|
||||
Reference in New Issue
Block a user