diff options
Diffstat (limited to 'MediaBrowser.MediaEncoding')
7 files changed, 32 insertions, 54 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index 1fd34c8fd..187f350b8 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -124,7 +124,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - Logger.LogError("Error starting ffmpeg", ex); + Logger.LogError(ex, "Error starting ffmpeg"); OnTranscodeFailedToStart(encodingJob.OutputFilePath, encodingJob); @@ -179,9 +179,9 @@ namespace MediaBrowser.MediaEncoding.Encoder isSuccesful = exitCode == 0; } - catch + catch (Exception ex) { - Logger.LogError("FFMpeg exited with an error."); + Logger.LogError(ex, "FFMpeg exited with an error."); } if (isSuccesful && !job.IsCancelled) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 9653e561c..fb131f304 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -41,7 +41,7 @@ namespace MediaBrowser.MediaEncoding.Encoder { if (logOutput) { - _logger.LogError("Error validating encoder", ex); + _logger.LogError(ex, "Error validating encoder"); } } @@ -78,9 +78,9 @@ namespace MediaBrowser.MediaEncoding.Encoder { output = GetProcessOutput(encoderAppPath, "-decoders"); } - catch (Exception ) + catch (Exception ex) { - //_logger.LogError("Error detecting available decoders", ex); + _logger.LogError(ex, "Error detecting available decoders"); } var found = new List<string>(); @@ -187,7 +187,7 @@ namespace MediaBrowser.MediaEncoding.Encoder RedirectStandardOutput = true }); - _logger.LogInformation("Running {0} {1}", path, arguments); + _logger.LogInformation("Running {path} {arguments}", path, arguments); using (process) { @@ -199,16 +199,16 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch { - _logger.LogInformation("Killing process {0} {1}", path, arguments); + _logger.LogInformation("Killing process {path} {arguments}", path, arguments); // Hate having to do this try { process.Kill(); } - catch (Exception ex1) + catch (Exception ex) { - _logger.LogError("Error killing process", ex1); + _logger.LogError(ex, "Error killing process"); } throw; diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs index dcaf4a2b1..e97898ac5 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs @@ -81,7 +81,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - _logger.LogError("Error disposing log stream", ex); + _logger.LogError(ex, "Error disposing log stream"); } LogFileStream = null; @@ -98,7 +98,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - _logger.LogError("Error closing media source", ex); + _logger.LogError(ex, "Error closing media source"); } } } diff --git a/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs b/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs index 2f0161962..d2cf7f395 100644 --- a/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs +++ b/MediaBrowser.MediaEncoding/Encoder/FontConfigLoader.cs @@ -72,12 +72,12 @@ namespace MediaBrowser.MediaEncoding.Encoder catch (HttpException ex) { // Don't let the server crash because of this - _logger.LogError("Error downloading ffmpeg font files", ex); + _logger.LogError(ex, "Error downloading ffmpeg font files"); } catch (Exception ex) { // Don't let the server crash because of this - _logger.LogError("Error writing ffmpeg font files", ex); + _logger.LogError(ex, "Error writing ffmpeg font files"); } } @@ -103,7 +103,7 @@ namespace MediaBrowser.MediaEncoding.Encoder catch (IOException ex) { // Log this, but don't let it fail the operation - _logger.LogError("Error copying file", ex); + _logger.LogError(ex, "Error copying file"); } } @@ -127,7 +127,7 @@ namespace MediaBrowser.MediaEncoding.Encoder catch (Exception ex) { // The core can function without the font file, so handle this - _logger.LogError("Failed to download ffmpeg font file from {0}", ex, url); + _logger.LogError(ex, "Failed to download ffmpeg font file from {url}", url); } } @@ -145,12 +145,12 @@ namespace MediaBrowser.MediaEncoding.Encoder catch (IOException ex) { // Log this, but don't let it fail the operation - _logger.LogError("Error deleting temp file {0}", ex, tempFile); + _logger.LogError(ex, "Error deleting temp file {path}", tempFile); } } private void Extract7zArchive(string archivePath, string targetPath) { - _logger.LogInformation("Extracting {0} to {1}", archivePath, targetPath); + _logger.LogInformation("Extracting {ArchivePath} to {TargetPath}", archivePath, targetPath); _zipClient.ExtractAllFrom7z(archivePath, targetPath, true); } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 4cd66e5ce..a661d7691 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -102,8 +102,6 @@ namespace MediaBrowser.MediaEncoding.Encoder _originalFFMpegPath = ffMpegPath; _hasExternalEncoder = hasExternalEncoder; - - SetEnvironmentVariable(); } private readonly object _logLock = new object(); @@ -117,7 +115,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - _logger.LogError("Error setting FFREPORT environment variable", ex); + _logger.LogError(ex, "Error setting FFREPORT environment variable"); } } } @@ -132,31 +130,11 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - //_logger.LogError("Error setting FFREPORT environment variable", ex); + _logger.LogError(ex, "Error setting FFREPORT environment variable"); } } } - private void SetEnvironmentVariable() - { - try - { - //_environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32"); - } - catch (Exception ex) - { - _logger.LogError("Error setting FFREPORT environment variable", ex); - } - try - { - //_environmentInfo.SetUserEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32"); - } - catch (Exception ex) - { - _logger.LogError("Error setting FFREPORT environment variable", ex); - } - } - public string EncoderLocationType { get @@ -649,9 +627,9 @@ namespace MediaBrowser.MediaEncoding.Encoder { throw; } - catch + catch (Exception ex) { - _logger.LogError("I-frame image extraction failed, will attempt standard way. Input: {0}", inputArgument); + _logger.LogError(ex, "I-frame image extraction failed, will attempt standard way. Input: {arguments}", inputArgument); } } @@ -999,7 +977,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - _logger.LogError("Error in WaitForExit", ex); + _logger.LogError(ex, "Error in WaitForExit"); } try @@ -1010,7 +988,7 @@ namespace MediaBrowser.MediaEncoding.Encoder } catch (Exception ex) { - _logger.LogError("Error killing process", ex); + _logger.LogError(ex, "Error killing process"); } } diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index c3cf61dc1..d0ccef2f8 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -1351,11 +1351,11 @@ namespace MediaBrowser.MediaEncoding.Probing { video.Timestamp = GetMpegTimestamp(video.Path); - _logger.LogDebug("Video has {0} timestamp", video.Timestamp); + _logger.LogDebug("Video has {timestamp} timestamp", video.Timestamp); } catch (Exception ex) { - _logger.LogError("Error extracting timestamp info from {0}", ex, video.Path); + _logger.LogError(ex, "Error extracting timestamp info from {path}", video.Path); video.Timestamp = null; } } diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index a3e0f89a9..43f775392 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -431,7 +431,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } catch (Exception ex) { - _logger.LogError("Error starting ffmpeg", ex); + _logger.LogError(ex, "Error starting ffmpeg"); throw; } @@ -448,7 +448,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } catch (Exception ex) { - _logger.LogError("Error killing subtitle conversion process", ex); + _logger.LogError(ex, "Error killing subtitle conversion process"); } } @@ -471,7 +471,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } catch (IOException ex) { - _logger.LogError("Error deleting converted subtitle {0}", ex, outputPath); + _logger.LogError(ex, "Error deleting converted subtitle {0}", outputPath); } } } @@ -561,7 +561,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } catch (Exception ex) { - _logger.LogError("Error starting ffmpeg", ex); + _logger.LogError(ex, "Error starting ffmpeg"); throw; } @@ -578,7 +578,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } catch (Exception ex) { - _logger.LogError("Error killing subtitle extraction process", ex); + _logger.LogError(ex, "Error killing subtitle extraction process"); } } @@ -603,7 +603,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } catch (IOException ex) { - _logger.LogError("Error deleting extracted subtitle {0}", ex, outputPath); + _logger.LogError(ex, "Error deleting extracted subtitle {0}", outputPath); } } else if (!_fileSystem.FileExists(outputPath)) |
