From d4b438791f49dc74fe05ad20575d5f0c111ee234 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Fri, 8 Nov 2019 12:49:00 +0100 Subject: Don't append transcodes to transcoding temp path --- .../EncodingConfigurationExtensions.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs (limited to 'MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs') diff --git a/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs b/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs new file mode 100644 index 000000000..6a3e94645 --- /dev/null +++ b/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs @@ -0,0 +1,28 @@ +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) + => configurationManager.GetEncodingOptions().TranscodingTempPath + ?? Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcoding-temp"); + } +} -- cgit v1.2.3 From e808e8b2d2184a1759abe29d57be8396a39b598d Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Sun, 24 Nov 2019 20:15:53 +0100 Subject: Update MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs Co-Authored-By: dkanada --- MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs') diff --git a/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs b/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs index 6a3e94645..2bf1f6bc8 100644 --- a/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs +++ b/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs @@ -23,6 +23,6 @@ namespace MediaBrowser.Common.Configuration /// The transcoding temp path. public static string GetTranscodePath(this IConfigurationManager configurationManager) => configurationManager.GetEncodingOptions().TranscodingTempPath - ?? Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcoding-temp"); + ?? Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes"); } } -- cgit v1.2.3 From 4a0df15bbd7f4cb87eba2e0a2ff39b74abd083fe Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 4 Dec 2019 22:18:37 +0100 Subject: Fix GetTranscodePath function and cache path update logline * GetTranscodePath returned an empty string after the option was left blank in the web UI * Unified the log style for all paths --- .../AppBase/BaseConfigurationManager.cs | 10 ++++++---- .../Configuration/EncodingConfigurationExtensions.cs | 11 +++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs') diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs index 67bb25b07..2a5d56c60 100644 --- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs +++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs @@ -84,6 +84,7 @@ namespace Emby.Server.Implementations.AppBase /// /// The logger. protected ILogger Logger { get; private set; } + /// /// Gets the XML serializer. /// @@ -97,7 +98,7 @@ namespace Emby.Server.Implementations.AppBase public IApplicationPaths CommonApplicationPaths { get; private set; } /// - /// Gets the system configuration. + /// Gets or sets the system configuration. /// /// The configuration. public BaseApplicationConfiguration CommonConfiguration @@ -123,6 +124,7 @@ namespace Emby.Server.Implementations.AppBase return _configuration; } } + protected set { _configuration = value; @@ -215,7 +217,7 @@ namespace Emby.Server.Implementations.AppBase cachePath = CommonConfiguration.CachePath; } - Logger.LogInformation("Setting cache path to " + cachePath); + Logger.LogInformation("Setting cache path: {Path}", cachePath); ((BaseApplicationPaths)CommonApplicationPaths).CachePath = cachePath; } @@ -223,7 +225,7 @@ namespace Emby.Server.Implementations.AppBase /// Replaces the cache path. /// /// The new configuration. - /// + /// The new cache path doesn't exist. private void ValidateCachePath(BaseApplicationConfiguration newConfig) { var newPath = newConfig.CachePath; @@ -234,7 +236,7 @@ namespace Emby.Server.Implementations.AppBase // Validate if (!Directory.Exists(newPath)) { - throw new FileNotFoundException( + throw new DirectoryNotFoundException( string.Format( CultureInfo.InvariantCulture, "{0} does not exist.", diff --git a/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs b/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs index 2bf1f6bc8..ccf965898 100644 --- a/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs +++ b/MediaBrowser.Common/Configuration/EncodingConfigurationExtensions.cs @@ -22,7 +22,14 @@ namespace MediaBrowser.Common.Configuration /// The Configuration manager. /// The transcoding temp path. public static string GetTranscodePath(this IConfigurationManager configurationManager) - => configurationManager.GetEncodingOptions().TranscodingTempPath - ?? Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes"); + { + var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath; + if (string.IsNullOrEmpty(transcodingTempPath)) + { + return Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes"); + } + + return transcodingTempPath; + } } } -- cgit v1.2.3