mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
update i/o methods
This commit is contained in:
parent
ba3f23bad4
commit
3e5bb74fcc
|
@ -94,9 +94,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
// Example: if \\server\movies exists, then strip out \\server\movies\action
|
// Example: if \\server\movies exists, then strip out \\server\movies\action
|
||||||
if (isPhysicalRoot)
|
if (isPhysicalRoot)
|
||||||
{
|
{
|
||||||
var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Keys);
|
var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values);
|
||||||
|
|
||||||
fileSystemDictionary = paths.Select(FileSystem.GetDirectoryInfo).ToDictionary(i => i.FullName);
|
fileSystemDictionary = paths.ToDictionary(i => i.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.FileSystemDictionary = fileSystemDictionary;
|
args.FileSystemDictionary = fileSystemDictionary;
|
||||||
|
|
|
@ -129,9 +129,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
// Example: if \\server\movies exists, then strip out \\server\movies\action
|
// Example: if \\server\movies exists, then strip out \\server\movies\action
|
||||||
if (isPhysicalRoot)
|
if (isPhysicalRoot)
|
||||||
{
|
{
|
||||||
var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Keys);
|
var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values);
|
||||||
|
|
||||||
fileSystemDictionary = paths.Select(FileSystem.GetDirectoryInfo).ToDictionary(i => i.FullName);
|
fileSystemDictionary = paths.ToDictionary(i => i.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.FileSystemDictionary = fileSystemDictionary;
|
args.FileSystemDictionary = fileSystemDictionary;
|
||||||
|
|
|
@ -298,7 +298,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="paths">The paths.</param>
|
/// <param name="paths">The paths.</param>
|
||||||
/// <returns>IEnumerable{System.String}.</returns>
|
/// <returns>IEnumerable{System.String}.</returns>
|
||||||
IEnumerable<string> NormalizeRootPathList(IEnumerable<string> paths);
|
IEnumerable<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers the item.
|
/// Registers the item.
|
||||||
|
|
|
@ -599,9 +599,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
// Example: if \\server\movies exists, then strip out \\server\movies\action
|
// Example: if \\server\movies exists, then strip out \\server\movies\action
|
||||||
if (isPhysicalRoot)
|
if (isPhysicalRoot)
|
||||||
{
|
{
|
||||||
var paths = NormalizeRootPathList(fileSystemDictionary.Keys);
|
var paths = NormalizeRootPathList(fileSystemDictionary.Values);
|
||||||
|
|
||||||
fileSystemDictionary = paths.Select(_fileSystem.GetDirectoryInfo).ToDictionary(i => i.FullName);
|
fileSystemDictionary = paths.ToDictionary(i => i.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.FileSystemDictionary = fileSystemDictionary;
|
args.FileSystemDictionary = fileSystemDictionary;
|
||||||
|
@ -616,9 +616,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
return ResolveItem(args);
|
return ResolveItem(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> NormalizeRootPathList(IEnumerable<string> paths)
|
public IEnumerable<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths)
|
||||||
{
|
{
|
||||||
var list = paths.Select(_fileSystem.NormalizePath)
|
var originalList = paths.ToList();
|
||||||
|
|
||||||
|
var list = originalList.Where(i => i.IsDirectory)
|
||||||
|
.Select(i => _fileSystem.NormalizePath(i.FullName))
|
||||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -630,7 +633,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
_logger.Info("Found duplicate path: {0}", dupe);
|
_logger.Info("Found duplicate path: {0}", dupe);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.Except(dupes, StringComparer.OrdinalIgnoreCase);
|
var newList = list.Except(dupes, StringComparer.OrdinalIgnoreCase).Select(_fileSystem.GetDirectoryInfo).ToList();
|
||||||
|
newList.AddRange(originalList.Where(i => !i.IsDirectory));
|
||||||
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue