mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-01 12:44:25 -04:00
Merge pull request #2990 from mark-monteiro/create-missing-folders
Create Missing Data Folders (cherry picked from commit 00d8983d7cec0594efac8d85a927dba3c3391bdf) Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
parent
21a6c2e1e2
commit
a3d048a0d9
@ -67,6 +67,9 @@ namespace Emby.Server.Implementations.Configuration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the metadata path.
|
/// Updates the metadata path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <exception cref="UnauthorizedAccessException">If the directory does not exist, and the caller does not have the required permission to create it.</exception>
|
||||||
|
/// <exception cref="NotSupportedException">If there is a custom path transcoding path specified, but it is invalid.</exception>
|
||||||
|
/// <exception cref="IOException">If the directory does not exist, and it also could not be created.</exception>
|
||||||
private void UpdateMetadataPath()
|
private void UpdateMetadataPath()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(Configuration.MetadataPath))
|
if (string.IsNullOrWhiteSpace(Configuration.MetadataPath))
|
||||||
@ -77,6 +80,7 @@ namespace Emby.Server.Implementations.Configuration
|
|||||||
{
|
{
|
||||||
((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = Configuration.MetadataPath;
|
((ServerApplicationPaths)ApplicationPaths).InternalMetadataPath = Configuration.MetadataPath;
|
||||||
}
|
}
|
||||||
|
Directory.CreateDirectory(ApplicationPaths.InternalMetadataPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -9,8 +9,6 @@ namespace Emby.Server.Implementations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
|
public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths
|
||||||
{
|
{
|
||||||
private string _internalMetadataPath;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class.
|
/// Initializes a new instance of the <see cref="ServerApplicationPaths" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,6 +25,7 @@ namespace Emby.Server.Implementations
|
|||||||
cacheDirectoryPath,
|
cacheDirectoryPath,
|
||||||
webDirectoryPath)
|
webDirectoryPath)
|
||||||
{
|
{
|
||||||
|
InternalMetadataPath = DefaultInternalMetadataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -98,12 +97,11 @@ namespace Emby.Server.Implementations
|
|||||||
/// <value>The user configuration directory path.</value>
|
/// <value>The user configuration directory path.</value>
|
||||||
public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users");
|
public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users");
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public string DefaultInternalMetadataPath => Path.Combine(ProgramDataPath, "metadata");
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string InternalMetadataPath
|
public string InternalMetadataPath { get; set; }
|
||||||
{
|
|
||||||
get => _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata"));
|
|
||||||
set => _internalMetadataPath = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string VirtualInternalMetadataPath { get; } = "%MetadataPath%";
|
public string VirtualInternalMetadataPath { get; } = "%MetadataPath%";
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
@ -17,18 +18,25 @@ namespace MediaBrowser.Common.Configuration
|
|||||||
=> configurationManager.GetConfiguration<EncodingOptions>("encoding");
|
=> configurationManager.GetConfiguration<EncodingOptions>("encoding");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the transcoding temp path from the encoding configuration.
|
/// Retrieves the transcoding temp path from the encoding configuration, falling back to a default if no path
|
||||||
|
/// is specified in configuration. If the directory does not exist, it will be created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configurationManager">The Configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
/// <returns>The transcoding temp path.</returns>
|
/// <returns>The transcoding temp path.</returns>
|
||||||
|
/// <exception cref="UnauthorizedAccessException">If the directory does not exist, and the caller does not have the required permission to create it.</exception>
|
||||||
|
/// <exception cref="NotSupportedException">If there is a custom path transcoding path specified, but it is invalid.</exception>
|
||||||
|
/// <exception cref="IOException">If the directory does not exist, and it also could not be created.</exception>
|
||||||
public static string GetTranscodePath(this IConfigurationManager configurationManager)
|
public static string GetTranscodePath(this IConfigurationManager configurationManager)
|
||||||
{
|
{
|
||||||
|
// Get the configured path and fall back to a default
|
||||||
var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath;
|
var transcodingTempPath = configurationManager.GetEncodingOptions().TranscodingTempPath;
|
||||||
if (string.IsNullOrEmpty(transcodingTempPath))
|
if (string.IsNullOrEmpty(transcodingTempPath))
|
||||||
{
|
{
|
||||||
return Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes");
|
transcodingTempPath = Path.Combine(configurationManager.CommonApplicationPaths.ProgramDataPath, "transcodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the directory exists
|
||||||
|
Directory.CreateDirectory(transcodingTempPath);
|
||||||
return transcodingTempPath;
|
return transcodingTempPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,12 @@ namespace MediaBrowser.Controller
|
|||||||
string UserConfigurationDirectoryPath { get; }
|
string UserConfigurationDirectoryPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the internal metadata path.
|
/// Gets the default internal metadata path.
|
||||||
|
/// </summary>
|
||||||
|
string DefaultInternalMetadataPath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the internal metadata path, either a custom path or the default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The internal metadata path.</value>
|
/// <value>The internal metadata path.</value>
|
||||||
string InternalMetadataPath { get; }
|
string InternalMetadataPath { get; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user