From 98ae564226115eeb41cc01b54bb6c9a1707ece3b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 21 Dec 2014 20:02:15 -0500 Subject: add transcode temp path migration --- .../Configuration/ServerConfigurationManager.cs | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs') diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs index 704bdea29..b3b8ccbd8 100644 --- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Configuration; +using System.Collections.Generic; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Implementations.Configuration; using MediaBrowser.Controller; @@ -75,6 +76,13 @@ namespace MediaBrowser.Server.Implementations.Configuration base.OnConfigurationUpdated(); } + public override void AddParts(IEnumerable factories) + { + base.AddParts(factories); + + UpdateTranscodingTempPath(); + } + /// /// Updates the items by name path. /// @@ -95,6 +103,28 @@ namespace MediaBrowser.Server.Implementations.Configuration Configuration.MetadataPath; } + /// + /// Updates the transcoding temporary path. + /// + private void UpdateTranscodingTempPath() + { + var encodingConfig = this.GetConfiguration("encoding"); + + ((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(encodingConfig.TranscodingTempPath) ? + null : + encodingConfig.TranscodingTempPath; + } + + protected override void OnNamedConfigurationUpdated(string key, object configuration) + { + base.OnNamedConfigurationUpdated(key, configuration); + + if (string.Equals(key, "encoding", StringComparison.OrdinalIgnoreCase)) + { + UpdateTranscodingTempPath(); + } + } + /// /// Replaces the configuration. /// -- cgit v1.2.3