mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-22 16:54:46 +03:00
support configurable transcoding temporary path
This commit is contained in:
@@ -60,6 +60,7 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
||||
protected override void OnConfigurationUpdated()
|
||||
{
|
||||
UpdateItemsByNamePath();
|
||||
UpdateTranscodingTempPath();
|
||||
|
||||
base.OnConfigurationUpdated();
|
||||
}
|
||||
@@ -74,6 +75,16 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
||||
Configuration.ItemsByNamePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the transcoding temporary path.
|
||||
/// </summary>
|
||||
private void UpdateTranscodingTempPath()
|
||||
{
|
||||
((ServerApplicationPaths)ApplicationPaths).TranscodingTempPath = string.IsNullOrEmpty(Configuration.TranscodingTempPath) ?
|
||||
null :
|
||||
Configuration.TranscodingTempPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the configuration.
|
||||
/// </summary>
|
||||
@@ -84,6 +95,7 @@ namespace MediaBrowser.Server.Implementations.Configuration
|
||||
var newConfig = (ServerConfiguration) newConfiguration;
|
||||
|
||||
ValidateItemByNamePath(newConfig);
|
||||
ValidateTranscodingTempPath(newConfig);
|
||||
|
||||
base.ReplaceConfiguration(newConfiguration);
|
||||
}
|
||||
@@ -107,5 +119,25 @@ 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user