mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-09 11:46:18 +00:00
make metadata path configurable
This commit is contained in:
@@ -26,6 +26,7 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
||||
{
|
||||
UpdateItemsByNamePath();
|
||||
UpdateTranscodingTempPath();
|
||||
UpdateMetadataPath();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,6 +77,16 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
||||
Configuration.ItemsByNamePath;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user