diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs | 71 |
1 files changed, 26 insertions, 45 deletions
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs index 031ca85f9..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; @@ -32,7 +33,6 @@ namespace MediaBrowser.Server.Implementations.Configuration : base(applicationPaths, logManager, xmlSerializer) { UpdateItemsByNamePath(); - UpdateTranscodingTempPath(); UpdateMetadataPath(); } @@ -71,12 +71,18 @@ namespace MediaBrowser.Server.Implementations.Configuration protected override void OnConfigurationUpdated() { UpdateItemsByNamePath(); - UpdateTranscodingTempPath(); UpdateMetadataPath(); base.OnConfigurationUpdated(); } + public override void AddParts(IEnumerable<IConfigurationFactory> factories) + { + base.AddParts(factories); + + UpdateTranscodingTempPath(); + } + /// <summary> /// Updates the items by name path. /// </summary> @@ -102,9 +108,21 @@ namespace MediaBrowser.Server.Implementations.Configuration /// </summary> private void UpdateTranscodingTempPath() { - ((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(Configuration.TranscodingTempPath) ? + var encodingConfig = this.GetConfiguration<EncodingOptions>("encoding"); + + ((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(encodingConfig.TranscodingTempPath) ? null : - Configuration.TranscodingTempPath; + encodingConfig.TranscodingTempPath; + } + + protected override void OnNamedConfigurationUpdated(string key, object configuration) + { + base.OnNamedConfigurationUpdated(key, configuration); + + if (string.Equals(key, "encoding", StringComparison.OrdinalIgnoreCase)) + { + UpdateTranscodingTempPath(); + } } /// <summary> @@ -117,7 +135,6 @@ namespace MediaBrowser.Server.Implementations.Configuration var newConfig = (ServerConfiguration)newConfiguration; ValidateItemByNamePath(newConfig); - ValidateTranscodingTempPath(newConfig); ValidatePathSubstitutions(newConfig); ValidateMetadataPath(newConfig); @@ -134,20 +151,6 @@ namespace MediaBrowser.Server.Implementations.Configuration { throw new ArgumentException("Invalid path substitution"); } - - if (!map.From.EndsWith(":\\") && !map.From.EndsWith(":/")) - { - map.From = map.From.TrimEnd('/').TrimEnd('\\'); - } - if (!map.To.EndsWith(":\\") && !map.To.EndsWith(":/")) - { - map.To = map.To.TrimEnd('/').TrimEnd('\\'); - } - - if (string.IsNullOrWhiteSpace(map.From) || string.IsNullOrWhiteSpace(map.To)) - { - throw new ArgumentException("Invalid path substitution"); - } } } @@ -172,26 +175,6 @@ namespace MediaBrowser.Server.Implementations.Configuration } /// <summary> - /// Validates the transcoding temporary path. - /// </summary> - /// <param name="newConfig">The new configuration.</param> - /// <exception cref="DirectoryNotFoundException"></exception> - private void ValidateTranscodingTempPath(ServerConfiguration newConfig) - { - var newPath = newConfig.TranscodingTempPath; - - if (!string.IsNullOrWhiteSpace(newPath) - && !string.Equals(Configuration.TranscodingTempPath ?? string.Empty, newPath)) - { - // Validate - if (!Directory.Exists(newPath)) - { - throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath)); - } - } - } - - /// <summary> /// Validates the metadata path. /// </summary> /// <param name="newConfig">The new configuration.</param> @@ -214,14 +197,12 @@ namespace MediaBrowser.Server.Implementations.Configuration public void DisableMetadataService(string service) { DisableMetadataService(typeof(Movie), Configuration, service); - DisableMetadataService(typeof(MusicAlbum), Configuration, service); - DisableMetadataService(typeof(MusicArtist), Configuration, service); DisableMetadataService(typeof(Episode), Configuration, service); - DisableMetadataService(typeof(Season), Configuration, service); DisableMetadataService(typeof(Series), Configuration, service); + DisableMetadataService(typeof(Season), Configuration, service); + DisableMetadataService(typeof(MusicArtist), Configuration, service); + DisableMetadataService(typeof(MusicAlbum), Configuration, service); DisableMetadataService(typeof(MusicVideo), Configuration, service); - DisableMetadataService(typeof(Trailer), Configuration, service); - DisableMetadataService(typeof(AdultVideo), Configuration, service); DisableMetadataService(typeof(Video), Configuration, service); } |
