Refactor code formatting and improve readability: standardize line breaks and indentation across various endpoint files, enhancing code clarity and maintainability. Update package version formatting in Directory.Packages.props for consistency.
This commit is contained in:
+18
-7
@@ -21,9 +21,15 @@ public sealed class GetLivePlaylistQueryHandler(
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
{
|
||||
var channel = await dbContext.Channels.AsNoTracking()
|
||||
var channel = await dbContext
|
||||
.Channels.AsNoTracking()
|
||||
.Where(c => c.Slug == query.Slug && c.IsEnabled)
|
||||
.Select(c => new { c.Id, c.EpochUtc, c.FillerAssetId })
|
||||
.Select(c => new
|
||||
{
|
||||
c.Id,
|
||||
c.EpochUtc,
|
||||
c.FillerAssetId,
|
||||
})
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
if (channel is null)
|
||||
return Result.Failure<LivePlaylistDto>(ChannelErrors.NotFound);
|
||||
@@ -33,7 +39,8 @@ public sealed class GetLivePlaylistQueryHandler(
|
||||
|
||||
// Загружаем записи, пересекающиеся с окном (с небольшим запасом назад).
|
||||
var windowStartTime = query.Now.AddSeconds(-(window + 2) * seg);
|
||||
var rawEntries = await dbContext.ScheduleEntries.AsNoTracking()
|
||||
var rawEntries = await dbContext
|
||||
.ScheduleEntries.AsNoTracking()
|
||||
.Where(e =>
|
||||
e.ChannelId == channel.Id
|
||||
&& e.StartsAtUtc < query.Now
|
||||
@@ -52,7 +59,8 @@ public sealed class GetLivePlaylistQueryHandler(
|
||||
if (channel.FillerAssetId is { } fillerId)
|
||||
assetIds.Add(fillerId);
|
||||
|
||||
var segmentCounts = await dbContext.MediaAssets.AsNoTracking()
|
||||
var segmentCounts = await dbContext
|
||||
.MediaAssets.AsNoTracking()
|
||||
.Where(a =>
|
||||
assetIds.Contains(a.Id)
|
||||
&& a.Status == MediaAssetStatus.Ready
|
||||
@@ -72,7 +80,10 @@ public sealed class GetLivePlaylistQueryHandler(
|
||||
.ToList();
|
||||
|
||||
LiveFiller? filler = null;
|
||||
if (channel.FillerAssetId is { } fid && segmentCounts.TryGetValue(fid, out var fillerSegments))
|
||||
if (
|
||||
channel.FillerAssetId is { } fid
|
||||
&& segmentCounts.TryGetValue(fid, out var fillerSegments)
|
||||
)
|
||||
filler = new LiveFiller(fid, fillerSegments);
|
||||
|
||||
var playlist = LiveWindowCalculator.Build(
|
||||
@@ -82,8 +93,8 @@ public sealed class GetLivePlaylistQueryHandler(
|
||||
var dto = new LivePlaylistDto(
|
||||
playlist.MediaSequence,
|
||||
playlist.TargetDuration,
|
||||
playlist.Segments
|
||||
.Select(s => new LiveSegmentDto(s.AssetId, s.LocalIndex, s.Discontinuity))
|
||||
playlist
|
||||
.Segments.Select(s => new LiveSegmentDto(s.AssetId, s.LocalIndex, s.Discontinuity))
|
||||
.ToList()
|
||||
);
|
||||
return Result.Success(dto);
|
||||
|
||||
Reference in New Issue
Block a user