The Free Software Media System - Server Backend & API
add recording post processing option
Luke Pulverentic418f94c9865
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 81a6b8508c..b7d2d1748d 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -38,6 +38,7 @@ using MediaBrowser.Model.Diagnostics;using MediaBrowser.Model.FileOrganization;using MediaBrowser.Model.System;using MediaBrowser.Model.Threading;+using MediaBrowser.Model.Extensions;namespace Emby.Server.Implementations.LiveTv.EmbyTV{@@ -1550,6 +1551,49 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV// _logger.ErrorException("Error processing new recording", ex);// }//}+ PostProcessRecording(timer, path);+ }++ private void PostProcessRecording(TimerInfo timer, string path)+ {+ var options = GetConfiguration();+ if (string.IsNullOrWhiteSpace(options.RecordingPostProcessor))+ {+ return;+ }++ try+ {+ var process = _processFactory.Create(new ProcessOptions+ {+ Arguments = GetPostProcessArguments(path, options.RecordingPostProcessorArguments),+ CreateNoWindow = true,+ EnableRaisingEvents = true,+ ErrorDialog = false,+ FileName = options.RecordingPostProcessor,+ IsHidden = true,+ UseShellExecute = true+ });++ _logger.Info("Running recording post processor {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);++ process.Exited += Process_Exited;+ process.Start();+ }+ catch (Exception ex)+ {+ _logger.ErrorException("Error running recording post processor", ex);+ }+ }++ private string GetPostProcessArguments(string path, string arguments)+ {+ return arguments.Replace("{path}", path, StringComparison.OrdinalIgnoreCase);+ }++ private void Process_Exited(object sender, EventArgs e)+ {+ ((IProcess)sender).Dispose();}private void SaveNfo(TimerInfo timer, string recordingPath, string seriesPath)diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.csindex cc5148ba95..8f7e94cf02 100644--- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs+++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs@@ -26,6 +26,9 @@ namespace MediaBrowser.Model.LiveTvpublic string[] MediaLocationsCreated { get; set; }+ public string RecordingPostProcessor { get; set; }+ public string RecordingPostProcessorArguments { get; set; }+public LiveTvOptions(){EnableMovieProviders = true;@@ -34,6 +37,7 @@ namespace MediaBrowser.Model.LiveTvListingProviders = new List<ListingsProviderInfo>();MediaLocationsCreated = new string[] { };RecordingEncodingFormat = "mp4";+ RecordingPostProcessorArguments = "\"{path}\"";}}