The Free Software Media System - Server Backend & API
Use a separate line for each property initializer
Mark Monteiro7152b55747f5
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 2f7c0a3ebd..12423361ab 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1700,13 +1700,16 @@ namespace Emby.Server.Implementationsthrow new NotSupportedException();}- var processStartInfo = new ProcessStartInfo+ var process = new Process{- FileName = url,- UseShellExecute = true,- ErrorDialog = false+ StartInfo = new ProcessStartInfo+ {+ FileName = url,+ UseShellExecute = true,+ ErrorDialog = false+ },+ EnableRaisingEvents = true};- var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };process.Exited += (sender, args) => ((Process)sender).Dispose();trydiff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 4d777081b6..900f12062f 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -1680,16 +1680,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVtry{- var processStartInfo = new ProcessStartInfo- {- Arguments = GetPostProcessArguments(path, options.RecordingPostProcessorArguments),- CreateNoWindow = true,- ErrorDialog = false,- FileName = options.RecordingPostProcessor,- WindowStyle = ProcessWindowStyle.Hidden,- UseShellExecute = false+ var process = new Process+ {+ StartInfo = new ProcessStartInfo+ {+ Arguments = GetPostProcessArguments(path, options.RecordingPostProcessorArguments),+ CreateNoWindow = true,+ ErrorDialog = false,+ FileName = options.RecordingPostProcessor,+ WindowStyle = ProcessWindowStyle.Hidden,+ UseShellExecute = false+ },+ EnableRaisingEvents = true};- var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };_logger.LogInformation("Running recording post processor {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.csindex 4738272be6..29d17e2bb2 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs@@ -90,9 +90,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVWindowStyle = ProcessWindowStyle.Hidden,ErrorDialog = false};- _process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };- var commandLineLogMessage = _process.StartInfo.FileName + " " + _process.StartInfo.Arguments;+ var commandLineLogMessage = processStartInfo.FileName + " " + processStartInfo.Arguments;_logger.LogInformation(commandLineLogMessage);var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "record-transcode-" + Guid.NewGuid() + ".txt");@@ -104,6 +103,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVvar commandLineLogMessageBytes = Encoding.UTF8.GetBytes(_json.SerializeToString(mediaSource) + Environment.NewLine + Environment.NewLine + commandLineLogMessage + Environment.NewLine + Environment.NewLine);_logFileStream.Write(commandLineLogMessageBytes, 0, commandLineLogMessageBytes.Length);+ _process = new Process+ {+ StartInfo = processStartInfo,+ EnableRaisingEvents = true+ };_process.Exited += (sender, args) => OnFfMpegProcessExited(_process, inputFile);_process.Start();diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.csindex 8d27c33c01..84eb3b373e 100644--- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs+++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs@@ -155,19 +155,22 @@ namespace MediaBrowser.MediaEncoding.AttachmentsinputPath,attachmentStreamIndex,outputPath);- var startInfo = new ProcessStartInfo- {- Arguments = processArgs,- FileName = _mediaEncoder.EncoderPath,- UseShellExecute = false,- CreateNoWindow = true,- WindowStyle = ProcessWindowStyle.Hidden,- ErrorDialog = false- };int exitCode;- using (var process = new Process { StartInfo = startInfo, EnableRaisingEvents = true })+ using (var process = new Process+ {+ StartInfo = new ProcessStartInfo+ {+ Arguments = processArgs,+ FileName = _mediaEncoder.EncoderPath,+ UseShellExecute = false,+ CreateNoWindow = true,+ WindowStyle = ProcessWindowStyle.Hidden,+ ErrorDialog = false+ },+ EnableRaisingEvents = true+ }){_logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.csindex 4042e64f63..c2bfac9d63 100644--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs@@ -359,30 +359,33 @@ namespace MediaBrowser.MediaEncoding.Encoder: "{0} -i {1} -threads 0 -v warning -print_format json -show_streams -show_format";args = string.Format(args, probeSizeArgument, inputPath).Trim();- var processStartInfo = new ProcessStartInfo+ var process = new Process{- CreateNoWindow = true,- UseShellExecute = false,+ StartInfo = new ProcessStartInfo+ {+ CreateNoWindow = true,+ UseShellExecute = false,- // Must consume both or ffmpeg may hang due to deadlocks. See comments below.- RedirectStandardOutput = true,+ // Must consume both or ffmpeg may hang due to deadlocks. See comments below.+ RedirectStandardOutput = true,- FileName = _ffprobePath,- Arguments = args,+ FileName = _ffprobePath,+ Arguments = args,- WindowStyle = ProcessWindowStyle.Hidden,- ErrorDialog = false,+ WindowStyle = ProcessWindowStyle.Hidden,+ ErrorDialog = false,+ },+ EnableRaisingEvents = true};- var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };if (forceEnableLogging){- _logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);+ _logger.LogInformation("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments);}else{- _logger.LogDebug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);+ _logger.LogDebug("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments);}using (var processWrapper = new ProcessWrapper(process, this))@@ -568,19 +571,22 @@ namespace MediaBrowser.MediaEncoding.Encoder}}- var processStartInfo = new ProcessStartInfo+ var process = new Process{- CreateNoWindow = true,- UseShellExecute = false,- FileName = _ffmpegPath,- Arguments = args,- WindowStyle = ProcessWindowStyle.Hidden,- ErrorDialog = false,+ StartInfo = new ProcessStartInfo+ {+ CreateNoWindow = true,+ UseShellExecute = false,+ FileName = _ffmpegPath,+ Arguments = args,+ WindowStyle = ProcessWindowStyle.Hidden,+ ErrorDialog = false,+ },+ EnableRaisingEvents = true};- _logger.LogDebug("{0} {1}", processStartInfo.FileName, processStartInfo.Arguments);+ _logger.LogDebug("{ProcessFileName} {ProcessArguments}", process.StartInfo.FileName, process.StartInfo.Arguments);- var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };using (var processWrapper = new ProcessWrapper(process, this)){bool ranToCompletion;@@ -713,7 +719,11 @@ namespace MediaBrowser.MediaEncoding.Encoderbool ranToCompletion = false;- var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };+ var process = new Process+ {+ StartInfo = processStartInfo,+ EnableRaisingEvents = true+ };using (var processWrapper = new ProcessWrapper(process, this)){trydiff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.csindex b1397d79db..a84dc30c88 100644--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs@@ -426,19 +426,21 @@ namespace MediaBrowser.MediaEncoding.SubtitlesencodingParam = " -sub_charenc " + encodingParam;}- var processStartInfo = new ProcessStartInfo- {- CreateNoWindow = true,- UseShellExecute = false,- FileName = _mediaEncoder.EncoderPath,- Arguments = string.Format("{0} -i \"{1}\" -c:s srt \"{2}\"", encodingParam, inputPath, outputPath),- WindowStyle = ProcessWindowStyle.Hidden,- ErrorDialog = false- };-int exitCode;- using (var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true })+ using (var process = new Process+ {+ StartInfo = new ProcessStartInfo+ {+ CreateNoWindow = true,+ UseShellExecute = false,+ FileName = _mediaEncoder.EncoderPath,+ Arguments = string.Format("{0} -i \"{1}\" -c:s srt \"{2}\"", encodingParam, inputPath, outputPath),+ WindowStyle = ProcessWindowStyle.Hidden,+ ErrorDialog = false+ },+ EnableRaisingEvents = true+ }){_logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);@@ -577,19 +579,21 @@ namespace MediaBrowser.MediaEncoding.SubtitlesoutputCodec,outputPath);- var processStartInfo = new ProcessStartInfo- {- CreateNoWindow = true,- UseShellExecute = false,- FileName = _mediaEncoder.EncoderPath,- Arguments = processArgs,- WindowStyle = ProcessWindowStyle.Hidden,- ErrorDialog = false- };-int exitCode;- using (var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true })+ using (var process = new Process+ {+ StartInfo = new ProcessStartInfo+ {+ CreateNoWindow = true,+ UseShellExecute = false,+ FileName = _mediaEncoder.EncoderPath,+ Arguments = processArgs,+ WindowStyle = ProcessWindowStyle.Hidden,+ ErrorDialog = false+ },+ EnableRaisingEvents = true+ }){_logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);