add recording post processing option

pull/702/head
Luke Pulverenti 8 years ago
parent 3f68882fa8
commit c418f94c98

@ -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)

@ -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}\"";
}
}

Loading…
Cancel
Save