mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
using System.Diagnostics; |
|
using ErsatzTV.Core; |
|
using ErsatzTV.Core.Domain; |
|
using ErsatzTV.Core.Interfaces.FFmpeg; |
|
using ErsatzTV.Infrastructure.Data; |
|
using ErsatzTV.Infrastructure.Extensions; |
|
using Microsoft.EntityFrameworkCore; |
|
|
|
namespace ErsatzTV.Application.Streaming; |
|
|
|
public class GetConcatProcessByChannelNumberHandler : FFmpegProcessHandler<GetConcatProcessByChannelNumber> |
|
{ |
|
private readonly IFFmpegProcessService _ffmpegProcessService; |
|
|
|
public GetConcatProcessByChannelNumberHandler( |
|
IDbContextFactory<TvContext> dbContextFactory, |
|
IFFmpegProcessService ffmpegProcessService) |
|
: base(dbContextFactory) |
|
{ |
|
_ffmpegProcessService = ffmpegProcessService; |
|
} |
|
|
|
protected override async Task<Either<BaseError, PlayoutItemProcessModel>> GetProcess( |
|
TvContext dbContext, |
|
GetConcatProcessByChannelNumber request, |
|
Channel channel, |
|
string ffmpegPath, |
|
string ffprobePath, |
|
CancellationToken cancellationToken) |
|
{ |
|
bool saveReports = await dbContext.ConfigElements |
|
.GetValue<bool>(ConfigElementKey.FFmpegSaveReports) |
|
.Map(result => result.IfNone(false)); |
|
|
|
Process process = _ffmpegProcessService.ConcatChannel( |
|
ffmpegPath, |
|
saveReports, |
|
channel, |
|
request.Scheme, |
|
request.Host); |
|
|
|
return new PlayoutItemProcessModel(process, Option<TimeSpan>.None, DateTimeOffset.MaxValue); |
|
} |
|
} |