improve smb support

This commit is contained in:
Luke Pulverenti
2017-05-04 14:14:45 -04:00
parent 53024bd149
commit 696a6b34ea
80 changed files with 256 additions and 151 deletions

View File

@@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Library
{
if (parent == null)
{
var parentFolderName = Path.GetFileName(Path.GetDirectoryName(path));
var parentFolderName = Path.GetFileName(_fileSystem.GetDirectoryName(path));
if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
{

View File

@@ -1962,8 +1962,34 @@ namespace Emby.Server.Implementations.Library
return new List<Folder>();
}
return GetUserRootFolder().Children
.OfType<Folder>()
return GetCollectionFoldersInternal(item, GetUserRootFolder().Children.OfType<Folder>().ToList());
}
public List<Folder> GetCollectionFolders(BaseItem item, List<Folder> allUserRootChildren)
{
while (item != null)
{
var parent = item.GetParent();
if (parent == null || parent is AggregateFolder)
{
break;
}
item = parent;
}
if (item == null)
{
return new List<Folder>();
}
return GetCollectionFoldersInternal(item, allUserRootChildren);
}
private List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
{
return allUserRootChildren
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path, StringComparer.OrdinalIgnoreCase))
.ToList();
}

View File

@@ -6,6 +6,7 @@ using System;
using System.IO;
using System.Linq;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.Library.Resolvers
{
@@ -13,11 +14,13 @@ namespace Emby.Server.Implementations.Library.Resolvers
{
private readonly IImageProcessor _imageProcessor;
private readonly ILibraryManager _libraryManager;
private readonly IFileSystem _fileSystem;
public PhotoResolver(IImageProcessor imageProcessor, ILibraryManager libraryManager)
public PhotoResolver(IImageProcessor imageProcessor, ILibraryManager libraryManager, IFileSystem fileSystem)
{
_imageProcessor = imageProcessor;
_libraryManager = libraryManager;
_fileSystem = fileSystem;
}
/// <summary>
@@ -41,7 +44,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
var filename = Path.GetFileNameWithoutExtension(args.Path);
// Make sure the image doesn't belong to a video file
if (args.DirectoryService.GetFilePaths(Path.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename)))
if (args.DirectoryService.GetFilePaths(_fileSystem.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename)))
{
return null;
}

View File

@@ -965,7 +965,7 @@ namespace Emby.Server.Implementations.Library
var path = GetPolifyFilePath(user);
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
lock (_policySyncLock)
{
@@ -1052,7 +1052,7 @@ namespace Emby.Server.Implementations.Library
config = _jsonSerializer.DeserializeFromString<UserConfiguration>(json);
}
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
lock (_configSyncLock)
{