Stream custom live channels using your own media
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.

33 lines
1.1 KiB

using CliWrap;
using CliWrap.Buffered;
using ErsatzTV.Core.Interfaces.Locking;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Troubleshooting;
public class StartTroubleshootingPlaybackHandler(
IEntityLocker entityLocker,
ILogger<StartTroubleshootingPlaybackHandler> logger)
: IRequestHandler<StartTroubleshootingPlayback>
{
public async Task Handle(StartTroubleshootingPlayback request, CancellationToken cancellationToken)
{
logger.LogDebug("ffmpeg troubleshooting arguments {FFmpegArguments}", request.Command.Arguments);
BufferedCommandResult result = await request.Command
.WithValidation(CommandResultValidation.None)
.ExecuteBufferedAsync(cancellationToken);
entityLocker.UnlockTroubleshootingPlayback();
logger.LogInformation("Troubleshooting playback completed with exit code {ExitCode}", result.ExitCode);
foreach (KeyValuePair<string, string> env in request.Command.EnvironmentVariables)
{
logger.LogInformation("{Key} => {Value}", env.Key, env.Value);
}
// TODO: something with the result ???
}
}