|
|
@ -1171,18 +1171,34 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
/// <returns>IEnumerable{VirtualFolderInfo}.</returns>
|
|
|
|
/// <returns>IEnumerable{VirtualFolderInfo}.</returns>
|
|
|
|
private IEnumerable<VirtualFolderInfo> GetView(string path)
|
|
|
|
private IEnumerable<VirtualFolderInfo> GetView(string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var topLibraryFolders = GetUserRootFolder().Children.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
return _fileSystem.GetDirectoryPaths(path)
|
|
|
|
return _fileSystem.GetDirectoryPaths(path)
|
|
|
|
.Select(dir => new VirtualFolderInfo
|
|
|
|
.Select(dir => GetVirtualFolderInfo(dir, topLibraryFolders));
|
|
|
|
{
|
|
|
|
}
|
|
|
|
Name = Path.GetFileName(dir),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Locations = Directory.EnumerateFiles(dir, "*.mblink", SearchOption.TopDirectoryOnly)
|
|
|
|
private VirtualFolderInfo GetVirtualFolderInfo(string dir, List<BaseItem> collectionFolders)
|
|
|
|
.Select(_fileSystem.ResolveShortcut)
|
|
|
|
{
|
|
|
|
.OrderBy(i => i)
|
|
|
|
var info = new VirtualFolderInfo
|
|
|
|
.ToList(),
|
|
|
|
{
|
|
|
|
|
|
|
|
Name = Path.GetFileName(dir),
|
|
|
|
|
|
|
|
|
|
|
|
CollectionType = GetCollectionType(dir)
|
|
|
|
Locations = Directory.EnumerateFiles(dir, "*.mblink", SearchOption.TopDirectoryOnly)
|
|
|
|
});
|
|
|
|
.Select(_fileSystem.ResolveShortcut)
|
|
|
|
|
|
|
|
.OrderBy(i => i)
|
|
|
|
|
|
|
|
.ToList(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CollectionType = GetCollectionType(dir)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var libraryFolder = collectionFolders.FirstOrDefault(i => string.Equals(i.Path, dir, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (libraryFolder != null && libraryFolder.HasImage(ImageType.Primary))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
info.PrimaryImageItemId = libraryFolder.Id.ToString("N");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string GetCollectionType(string path)
|
|
|
|
private string GetCollectionType(string path)
|
|
|
|