|
|
|
@ -4,41 +4,55 @@ using ErsatzTV.FFmpeg.OutputFormat; |
|
|
|
|
|
|
|
|
|
|
|
namespace ErsatzTV.Application.FFmpegProfiles; |
|
|
|
namespace ErsatzTV.Application.FFmpegProfiles; |
|
|
|
|
|
|
|
|
|
|
|
public class GetFFmpegSettingsHandler : IRequestHandler<GetFFmpegSettings, FFmpegSettingsViewModel> |
|
|
|
public class GetFFmpegSettingsHandler(IConfigElementRepository configElementRepository) |
|
|
|
|
|
|
|
: IRequestHandler<GetFFmpegSettings, FFmpegSettingsViewModel> |
|
|
|
{ |
|
|
|
{ |
|
|
|
private readonly IConfigElementRepository _configElementRepository; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public GetFFmpegSettingsHandler(IConfigElementRepository configElementRepository) => |
|
|
|
|
|
|
|
_configElementRepository = configElementRepository; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<FFmpegSettingsViewModel> Handle( |
|
|
|
public async Task<FFmpegSettingsViewModel> Handle( |
|
|
|
GetFFmpegSettings request, |
|
|
|
GetFFmpegSettings request, |
|
|
|
CancellationToken cancellationToken) |
|
|
|
CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Option<string> ffmpegPath = await _configElementRepository.GetValue<string>(ConfigElementKey.FFmpegPath, cancellationToken); |
|
|
|
Option<string> ffmpegPath = await configElementRepository.GetValue<string>( |
|
|
|
Option<string> ffprobePath = await _configElementRepository.GetValue<string>(ConfigElementKey.FFprobePath, cancellationToken); |
|
|
|
ConfigElementKey.FFmpegPath, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
|
|
|
|
Option<string> ffprobePath = await configElementRepository.GetValue<string>( |
|
|
|
|
|
|
|
ConfigElementKey.FFprobePath, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
Option<int> defaultFFmpegProfileId = |
|
|
|
Option<int> defaultFFmpegProfileId = |
|
|
|
await _configElementRepository.GetValue<int>(ConfigElementKey.FFmpegDefaultProfileId, cancellationToken); |
|
|
|
await configElementRepository.GetValue<int>(ConfigElementKey.FFmpegDefaultProfileId, cancellationToken); |
|
|
|
Option<bool> saveReports = |
|
|
|
Option<bool> saveReports = |
|
|
|
await _configElementRepository.GetValue<bool>(ConfigElementKey.FFmpegSaveReports, cancellationToken); |
|
|
|
await configElementRepository.GetValue<bool>(ConfigElementKey.FFmpegSaveReports, cancellationToken); |
|
|
|
Option<string> preferredAudioLanguageCode = |
|
|
|
Option<string> preferredAudioLanguageCode = |
|
|
|
await _configElementRepository.GetValue<string>(ConfigElementKey.FFmpegPreferredLanguageCode, cancellationToken); |
|
|
|
await configElementRepository.GetValue<string>( |
|
|
|
|
|
|
|
ConfigElementKey.FFmpegPreferredLanguageCode, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
Option<bool> useEmbeddedSubtitles = |
|
|
|
Option<bool> useEmbeddedSubtitles = |
|
|
|
await _configElementRepository.GetValue<bool>(ConfigElementKey.FFmpegUseEmbeddedSubtitles, cancellationToken); |
|
|
|
await configElementRepository.GetValue<bool>( |
|
|
|
|
|
|
|
ConfigElementKey.FFmpegUseEmbeddedSubtitles, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
Option<bool> extractEmbeddedSubtitles = |
|
|
|
Option<bool> extractEmbeddedSubtitles = |
|
|
|
await _configElementRepository.GetValue<bool>(ConfigElementKey.FFmpegExtractEmbeddedSubtitles, cancellationToken); |
|
|
|
await configElementRepository.GetValue<bool>( |
|
|
|
|
|
|
|
ConfigElementKey.FFmpegExtractEmbeddedSubtitles, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
Option<int> watermark = |
|
|
|
Option<int> watermark = |
|
|
|
await _configElementRepository.GetValue<int>(ConfigElementKey.FFmpegGlobalWatermarkId, cancellationToken); |
|
|
|
await configElementRepository.GetValue<int>(ConfigElementKey.FFmpegGlobalWatermarkId, cancellationToken); |
|
|
|
Option<int> fallbackFiller = |
|
|
|
Option<int> fallbackFiller = |
|
|
|
await _configElementRepository.GetValue<int>(ConfigElementKey.FFmpegGlobalFallbackFillerId, cancellationToken); |
|
|
|
await configElementRepository.GetValue<int>( |
|
|
|
|
|
|
|
ConfigElementKey.FFmpegGlobalFallbackFillerId, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
Option<int> hlsSegmenterIdleTimeout = |
|
|
|
Option<int> hlsSegmenterIdleTimeout = |
|
|
|
await _configElementRepository.GetValue<int>(ConfigElementKey.FFmpegSegmenterTimeout, cancellationToken); |
|
|
|
await configElementRepository.GetValue<int>(ConfigElementKey.FFmpegSegmenterTimeout, cancellationToken); |
|
|
|
Option<int> workAheadSegmenterLimit = |
|
|
|
Option<int> workAheadSegmenterLimit = |
|
|
|
await _configElementRepository.GetValue<int>(ConfigElementKey.FFmpegWorkAheadSegmenters, cancellationToken); |
|
|
|
await configElementRepository.GetValue<int>(ConfigElementKey.FFmpegWorkAheadSegmenters, cancellationToken); |
|
|
|
Option<int> initialSegmentCount = |
|
|
|
Option<int> initialSegmentCount = |
|
|
|
await _configElementRepository.GetValue<int>(ConfigElementKey.FFmpegInitialSegmentCount, cancellationToken); |
|
|
|
await configElementRepository.GetValue<int>(ConfigElementKey.FFmpegInitialSegmentCount, cancellationToken); |
|
|
|
Option<OutputFormatKind> outputFormatKind = |
|
|
|
Option<OutputFormatKind> outputFormatKind = |
|
|
|
await _configElementRepository.GetValue<OutputFormatKind>(ConfigElementKey.FFmpegHlsDirectOutputFormat, cancellationToken); |
|
|
|
await configElementRepository.GetValue<OutputFormatKind>( |
|
|
|
|
|
|
|
ConfigElementKey.FFmpegHlsDirectOutputFormat, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
|
|
|
|
Option<string> defaultMpegTsScript = |
|
|
|
|
|
|
|
await configElementRepository.GetValue<string>( |
|
|
|
|
|
|
|
ConfigElementKey.FFmpegDefaultMpegTsScript, |
|
|
|
|
|
|
|
cancellationToken); |
|
|
|
|
|
|
|
|
|
|
|
var result = new FFmpegSettingsViewModel |
|
|
|
var result = new FFmpegSettingsViewModel |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -52,7 +66,8 @@ public class GetFFmpegSettingsHandler : IRequestHandler<GetFFmpegSettings, FFmpe |
|
|
|
HlsSegmenterIdleTimeout = await hlsSegmenterIdleTimeout.IfNoneAsync(60), |
|
|
|
HlsSegmenterIdleTimeout = await hlsSegmenterIdleTimeout.IfNoneAsync(60), |
|
|
|
WorkAheadSegmenterLimit = await workAheadSegmenterLimit.IfNoneAsync(1), |
|
|
|
WorkAheadSegmenterLimit = await workAheadSegmenterLimit.IfNoneAsync(1), |
|
|
|
InitialSegmentCount = await initialSegmentCount.IfNoneAsync(1), |
|
|
|
InitialSegmentCount = await initialSegmentCount.IfNoneAsync(1), |
|
|
|
HlsDirectOutputFormat = await outputFormatKind.IfNoneAsync(OutputFormatKind.MpegTs) |
|
|
|
HlsDirectOutputFormat = await outputFormatKind.IfNoneAsync(OutputFormatKind.MpegTs), |
|
|
|
|
|
|
|
DefaultMpegTsScript = await defaultMpegTsScript.IfNoneAsync("Default"), |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
foreach (int watermarkId in watermark) |
|
|
|
foreach (int watermarkId in watermark) |
|
|
|
|