diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-03-25 17:13:55 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-03-25 17:13:55 -0400 |
| commit | 31e8288393bead548e815a081c34d7e688fa0643 (patch) | |
| tree | 0c81d134d1177d26d5462a02c8e82d1aea8745a3 /MediaBrowser.Server.Implementations/Configuration | |
| parent | 7c94203d05627483db68846f8b1dc88066a997f4 (diff) | |
make metadata path configurable
Diffstat (limited to 'MediaBrowser.Server.Implementations/Configuration')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs index 415205cb1..cb3621fd1 100644 --- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -26,6 +26,7 @@ namespace MediaBrowser.Server.Implementations.Configuration { UpdateItemsByNamePath(); UpdateTranscodingTempPath(); + UpdateMetadataPath(); } /// <summary> @@ -77,6 +78,16 @@ namespace MediaBrowser.Server.Implementations.Configuration } /// <summary> + /// Updates the metadata path. + /// </summary> + private void UpdateMetadataPath() + { + ((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = string.IsNullOrEmpty(Configuration.MetadataPath) ? + null : + Configuration.MetadataPath; + } + + /// <summary> /// Updates the transcoding temporary path. /// </summary> private void UpdateTranscodingTempPath() @@ -98,6 +109,7 @@ namespace MediaBrowser.Server.Implementations.Configuration ValidateItemByNamePath(newConfig); ValidateTranscodingTempPath(newConfig); ValidatePathSubstitutions(newConfig); + ValidateMetadataPath(newConfig); base.ReplaceConfiguration(newConfiguration); } @@ -166,5 +178,25 @@ namespace MediaBrowser.Server.Implementations.Configuration } } } + + /// <summary> + /// Validates the metadata path. + /// </summary> + /// <param name="newConfig">The new configuration.</param> + /// <exception cref="System.IO.DirectoryNotFoundException"></exception> + private void ValidateMetadataPath(ServerConfiguration newConfig) + { + var newPath = newConfig.MetadataPath; + + if (!string.IsNullOrWhiteSpace(newPath) + && !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath)) + { + // Validate + if (!Directory.Exists(newPath)) + { + throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath)); + } + } + } } } |
