using System.IO;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Common.Configuration
{
///
/// Class containing extension methods for working with the encoding configuration.
///
public static class EncodingConfigurationExtensions
{
///
/// Gets the encoding options.
///
/// The configuration manager.
/// The encoding options.
public static EncodingOptions GetEncodingOptions(this IConfigurationManager configurationManager)
=> configurationManager.GetConfiguration("encoding");
///
/// Retrieves the transcoding temp path from the encoding configuration.
///
/// The Configuration manager.
/// The transcoding temp path.
public static string GetTranscodePath(this IConfigurationManager configurationManager)
{
var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath;
if (string.IsNullOrEmpty(transcodingTempPath))
{
return Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes");
}
return transcodingTempPath;
}
}
}