Remove manual N/A removal and write directly to stream

This commit is contained in:
David 2020-12-26 20:00:54 +01:00
parent e0499f8769
commit f73bb92ce3
2 changed files with 3 additions and 7 deletions

View File

@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_logger.LogInformation("Recording completed to file {0}", targetFile);
}
private Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
{
_targetPath = targetFile;
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
@ -93,8 +93,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
// FFMpeg writes debug/error info to stderr. This is useful when debugging so let's put it in the log directory.
_logFileStream = new FileStream(logFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true);
var commandLineLogMessageBytes = Encoding.UTF8.GetBytes(JsonSerializer.Serialize(mediaSource, _jsonOptions) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);
_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);
await JsonSerializer.SerializeAsync(_logFileStream, mediaSource, _jsonOptions, cancellationToken).ConfigureAwait(false);
await _logFileStream.WriteAsync(Encoding.UTF8.GetBytes(Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine), cancellationToken);
_process = new Process
{
@ -113,8 +113,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_ = StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
_logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
return _taskCompletionSource.Task;
}
private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile, TimeSpan duration)

View File

@ -353,8 +353,6 @@ namespace MediaBrowser.Providers.Plugins.Omdb
using var response = await GetOmdbResponse(httpClient, url, cancellationToken).ConfigureAwait(false);
var content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
// OMDb is sending "N/A" for no empty number fields
content = content.Replace("\"N/A\"", "\"\"", StringComparison.InvariantCulture);
return JsonSerializer.Deserialize<T>(content, _jsonOptions);
}