aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs57
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)