mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 06:18:28 +01:00
improve smb support
This commit is contained in:
@@ -288,7 +288,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return Path;
|
||||
}
|
||||
|
||||
return System.IO.Path.GetDirectoryName(Path);
|
||||
return FileSystem.GetDirectoryName(Path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1917,7 +1917,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var allFiles = ImageInfos
|
||||
.Where(i => i.IsLocalFile)
|
||||
.Select(i => System.IO.Path.GetDirectoryName(i.Path))
|
||||
.Select(i => FileSystem.GetDirectoryName(i.Path))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.SelectMany(directoryService.GetFilePaths)
|
||||
.ToList();
|
||||
@@ -2092,7 +2092,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList();
|
||||
extensions.AddRange(SupportedImageExtensionsList);
|
||||
|
||||
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false)
|
||||
return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(), false, false)
|
||||
.Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
.SelectMany(c => c.LinkedChildren)
|
||||
.ToList();
|
||||
|
||||
var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer());
|
||||
var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer(FileSystem));
|
||||
|
||||
LinkedChildren = linkedChildren;
|
||||
|
||||
@@ -332,13 +332,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
.OfType<Folder>()
|
||||
.ToList();
|
||||
|
||||
return PhysicalLocations.Where(i => !string.Equals(i, Path, StringComparison.OrdinalIgnoreCase)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id);
|
||||
return PhysicalLocations.Where(i => !FileSystem.AreEqual(i, Path)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id);
|
||||
}
|
||||
|
||||
private IEnumerable<Folder> GetPhysicalParents(string path, List<Folder> rootChildren)
|
||||
{
|
||||
var result = rootChildren
|
||||
.Where(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||
.Where(i => FileSystem.AreEqual(i.Path, path))
|
||||
.ToList();
|
||||
|
||||
if (result.Count == 0)
|
||||
|
||||
@@ -640,7 +640,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return true;
|
||||
}
|
||||
|
||||
path = System.IO.Path.GetDirectoryName(path);
|
||||
path = FileSystem.GetDirectoryName(path);
|
||||
}
|
||||
|
||||
return allLibraryPaths.Any(i => ContainsPath(i, originalPath));
|
||||
@@ -1206,11 +1206,17 @@ namespace MediaBrowser.Controller.Entities
|
||||
return GetLinkedChildren();
|
||||
}
|
||||
|
||||
var locations = user.RootFolder
|
||||
.Children
|
||||
if (LinkedChildren.Count == 0)
|
||||
{
|
||||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
var allUserRootChildren = user.RootFolder.Children.OfType<Folder>().ToList();
|
||||
|
||||
var collectionFolderIds = allUserRootChildren
|
||||
.OfType<CollectionFolder>()
|
||||
.Where(i => i.IsVisible(user))
|
||||
.SelectMany(i => i.PhysicalLocations)
|
||||
.Select(i => i.Id)
|
||||
.ToList();
|
||||
|
||||
return LinkedChildren
|
||||
@@ -1228,9 +1234,16 @@ namespace MediaBrowser.Controller.Entities
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (childLocationType == LocationType.FileSystem && !locations.Any(l => FileSystem.ContainsSubPath(l, child.Path)))
|
||||
else if (childLocationType == LocationType.FileSystem)
|
||||
{
|
||||
return null;
|
||||
var itemCollectionFolderIds =
|
||||
LibraryManager.GetCollectionFolders(child, allUserRootChildren)
|
||||
.Select(f => f.Id).ToList();
|
||||
|
||||
if (!itemCollectionFolderIds.Any(collectionFolderIds.Contains))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1323,7 +1336,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
else { newShortcutLinks = new List<LinkedChild>(); }
|
||||
|
||||
if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer()))
|
||||
if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer(FileSystem)))
|
||||
{
|
||||
Logger.Info("Shortcut links have changed for {0}", Path);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return new[] {
|
||||
new FileSystemMetadata
|
||||
{
|
||||
FullName = System.IO.Path.GetDirectoryName(Path),
|
||||
FullName = FileSystem.GetDirectoryName(Path),
|
||||
IsDirectory = true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@@ -40,11 +41,18 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public class LinkedChildComparer : IEqualityComparer<LinkedChild>
|
||||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public LinkedChildComparer(IFileSystem fileSystem)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public bool Equals(LinkedChild x, LinkedChild y)
|
||||
{
|
||||
if (x.Type == y.Type)
|
||||
{
|
||||
return string.Equals(x.Path, y.Path, StringComparison.OrdinalIgnoreCase);
|
||||
return _fileSystem.AreEqual(x.Path, y.Path);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
return series.Path;
|
||||
}
|
||||
|
||||
return System.IO.Path.GetDirectoryName(Path);
|
||||
return FileSystem.GetDirectoryName(Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (IsStacked)
|
||||
{
|
||||
return System.IO.Path.GetDirectoryName(Path);
|
||||
return FileSystem.GetDirectoryName(Path);
|
||||
}
|
||||
|
||||
if (!IsPlaceHolder)
|
||||
|
||||
Reference in New Issue
Block a user