|
|
@ -309,44 +309,26 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_hasExited = true;
|
|
|
|
_hasExited = true;
|
|
|
|
|
|
|
|
|
|
|
|
DisposeLogStream();
|
|
|
|
_logFileStream?.Dispose();
|
|
|
|
|
|
|
|
_logFileStream = null;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
var exitCode = process.ExitCode;
|
|
|
|
{
|
|
|
|
|
|
|
|
var exitCode = process.ExitCode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("FFMpeg recording exited with code {ExitCode} for {path}", exitCode, _targetPath);
|
|
|
|
_logger.LogInformation("FFMpeg recording exited with code {ExitCode} for {Path}", exitCode, _targetPath);
|
|
|
|
|
|
|
|
|
|
|
|
if (exitCode == 0)
|
|
|
|
if (exitCode == 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
_taskCompletionSource.TrySetResult(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {path} failed. Exit code {ExitCode}", _targetPath, exitCode)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogError("FFMpeg recording exited with an error for {path}.", _targetPath);
|
|
|
|
_taskCompletionSource.TrySetResult(true);
|
|
|
|
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {path} failed", _targetPath)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
private void DisposeLogStream()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (_logFileStream != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
_taskCompletionSource.TrySetException(
|
|
|
|
{
|
|
|
|
new Exception(
|
|
|
|
_logFileStream.Dispose();
|
|
|
|
string.Format(
|
|
|
|
}
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
catch (Exception ex)
|
|
|
|
"Recording for {0} failed. Exit code {1}",
|
|
|
|
{
|
|
|
|
_targetPath,
|
|
|
|
_logger.LogError(ex, "Error disposing recording log stream");
|
|
|
|
exitCode)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logFileStream = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|