From 4a0df15bbd7f4cb87eba2e0a2ff39b74abd083fe Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 4 Dec 2019 22:18:37 +0100 Subject: [PATCH] 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(-) diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs index 67bb25b077..2a5d56c603 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 2bf1f6bc8c..ccf9658988 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; + } } }