diff options
| author | Cody Robibero <cody@robibe.ro> | 2025-08-11 21:03:55 -0600 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2025-08-11 21:06:04 -0600 |
| commit | beca405ad4c771f9cfdd5b410b4a4ba9f1c2d6c8 (patch) | |
| tree | bef93d4b121c21877663c8ae7373df601b0cfb9a /Emby.Server.Implementations/Library/LibraryManager.cs | |
| parent | 5eef85f027194491796ceb693057239858ac017c (diff) | |
Refactor to pull item counts in a single query
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index df71868b6..3aaaaba5a 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1389,6 +1389,25 @@ namespace Emby.Server.Implementations.Library return _itemRepository.GetCount(query); } + public ItemCounts GetItemCounts(InternalItemsQuery query) + { + if (query.Recursive && !query.ParentId.IsEmpty()) + { + var parent = GetItemById(query.ParentId); + if (parent is not null) + { + SetTopParentIdsOrAncestors(query, [parent]); + } + } + + if (query.User is not null) + { + AddUserToQuery(query, query.User); + } + + return _itemRepository.GetItemCounts(query); + } + public IReadOnlyList<BaseItem> GetItemList(InternalItemsQuery query, List<BaseItem> parents) { SetTopParentIdsOrAncestors(query, parents); |
