Browse Source

Remove manual N/A removal and write directly to stream

David 4 năm trước cách đây
mục cha
commit
f73bb92ce3

+ 3 - 5
Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs

@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             _logger.LogInformation("Recording completed to file {0}", targetFile);
             _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;
             _targetPath = targetFile;
             Directory.CreateDirectory(Path.GetDirectoryName(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.
             // 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);
             _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
             _process = new Process
             {
             {
@@ -113,8 +113,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             _ = StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
             _ = StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
 
 
             _logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
             _logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
-
-            return _taskCompletionSource.Task;
         }
         }
 
 
         private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile, TimeSpan duration)
         private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile, TimeSpan duration)

+ 0 - 2
MediaBrowser.Providers/Plugins/Omdb/OmdbProvider.cs

@@ -353,8 +353,6 @@ namespace MediaBrowser.Providers.Plugins.Omdb
             using var response = await GetOmdbResponse(httpClient, url, cancellationToken).ConfigureAwait(false);
             using var response = await GetOmdbResponse(httpClient, url, cancellationToken).ConfigureAwait(false);
             var content = await response.Content.ReadAsStringAsync(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);
             return JsonSerializer.Deserialize<T>(content, _jsonOptions);
         }
         }