diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-22 14:45:55 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-22 14:45:55 -0500 |
| commit | c418f94c98658413ebb078154b7041d3d809ba40 (patch) | |
| tree | fa69e0feb25bf685f1ec8f592eaf660e7e8c4d5d | |
| parent | 3f68882fa8af83448039224760153be3835aa2eb (diff) | |
add recording post processing option
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 44 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 4 |
2 files changed, 48 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 81a6b8508..b7d2d1748 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.cs index cc5148ba9..8f7e94cf0 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -26,6 +26,9 @@ namespace MediaBrowser.Model.LiveTv public 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.LiveTv ListingProviders = new List<ListingsProviderInfo>(); MediaLocationsCreated = new string[] { }; RecordingEncodingFormat = "mp4"; + RecordingPostProcessorArguments = "\"{path}\""; } } |
