diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2022-12-20 09:19:45 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2022-12-20 09:19:45 +0100 |
| commit | ef085483b2ef54195e16f282330a3c204e3227b6 (patch) | |
| tree | 643b41f915fede76716cd0c615a0472989993e76 /Emby.Server.Implementations/Library/LibraryManager.cs | |
| parent | b725fbe51af22ca270912eeb4929a8ee2a3b37a4 (diff) | |
| parent | b0156792678b37563423c8fc0b10434a18a2a38a (diff) | |
Merge branch 'master' into network-rewrite
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 70439d258..a3c66dc79 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1154,7 +1154,7 @@ namespace Emby.Server.Implementations.Library .ToList(); } - private VirtualFolderInfo GetVirtualFolderInfo(string dir, List<BaseItem> allCollectionFolders, Dictionary<Guid, Guid> refreshQueue) + private VirtualFolderInfo GetVirtualFolderInfo(string dir, List<BaseItem> allCollectionFolders, HashSet<Guid> refreshQueue) { var info = new VirtualFolderInfo { @@ -1175,29 +1175,29 @@ namespace Emby.Server.Implementations.Library } }) .Where(i => i is not null) - .OrderBy(i => i) + .Order() .ToArray(), CollectionType = GetCollectionType(dir) }; var libraryFolder = allCollectionFolders.FirstOrDefault(i => string.Equals(i.Path, dir, StringComparison.OrdinalIgnoreCase)); - - if (libraryFolder is not null && libraryFolder.HasImage(ImageType.Primary)) - { - info.PrimaryImageItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture); - } - if (libraryFolder is not null) { - info.ItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture); + var libraryFolderId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture); + info.ItemId = libraryFolderId; + if (libraryFolder.HasImage(ImageType.Primary)) + { + info.PrimaryImageItemId = libraryFolderId; + } + info.LibraryOptions = GetLibraryOptions(libraryFolder); if (refreshQueue is not null) { info.RefreshProgress = libraryFolder.GetRefreshProgress(); - info.RefreshStatus = info.RefreshProgress.HasValue ? "Active" : refreshQueue.ContainsKey(libraryFolder.Id) ? "Queued" : "Idle"; + info.RefreshStatus = info.RefreshProgress.HasValue ? "Active" : refreshQueue.Contains(libraryFolder.Id) ? "Queued" : "Idle"; } } @@ -1999,38 +1999,35 @@ namespace Emby.Server.Implementations.Library public List<Folder> GetCollectionFolders(BaseItem item) { + return GetCollectionFolders(item, GetUserRootFolder().Children.OfType<Folder>()); + } + + public List<Folder> GetCollectionFolders(BaseItem item, IEnumerable<Folder> allUserRootChildren) + { while (item is not null) { var parent = item.GetParent(); - if (parent is null || parent is AggregateFolder) + if (parent is AggregateFolder) { break; } - item = parent; - } - - if (item is null) - { - return new List<Folder>(); - } - - return GetCollectionFoldersInternal(item, GetUserRootFolder().Children.OfType<Folder>()); - } + if (parent is null) + { + var owner = item.GetOwner(); - public List<Folder> GetCollectionFolders(BaseItem item, List<Folder> allUserRootChildren) - { - while (item is not null) - { - var parent = item.GetParent(); + if (owner is null) + { + break; + } - if (parent is null || parent is AggregateFolder) + item = owner; + } + else { - break; + item = parent; } - - item = parent; } if (item is null) |
