From 59cd5f983bc30a468481543e2cc52575cfe3d818 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Mon, 7 Sep 2026 10:30:01 +0200 Subject: Expose optimized ItemCounts for byName items --- MediaBrowser.Controller/Library/ILibraryManager.cs | 11 +++++++++++ MediaBrowser.Controller/Persistence/IItemCountService.cs | 10 ++++++++++ 2 files changed, 21 insertions(+) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 9028b0d6b8..382559384a 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -759,6 +759,17 @@ namespace MediaBrowser.Controller.Library /// The item counts grouped by type. ItemCounts GetItemCountsForNameItem(BaseItemKind kind, Guid id, BaseItemKind[] relatedItemKinds, User? user); + /// + /// Gets item counts for several "by-name" items of the same kind in one query, instead of + /// one query per item. + /// + /// The kind of the name items. + /// The IDs of the name items. + /// The item kinds to count. + /// The user for access filtering. + /// The item counts of each requested id. + Dictionary GetItemCountsForNameItems(BaseItemKind kind, IReadOnlyList ids, BaseItemKind[] relatedItemKinds, User? user); + /// /// Batch-fetches child counts for multiple parent folders. /// Returns the count of immediate children (non-recursive) for each parent. diff --git a/MediaBrowser.Controller/Persistence/IItemCountService.cs b/MediaBrowser.Controller/Persistence/IItemCountService.cs index 8ddf93e3e0..20b5cbe603 100644 --- a/MediaBrowser.Controller/Persistence/IItemCountService.cs +++ b/MediaBrowser.Controller/Persistence/IItemCountService.cs @@ -36,6 +36,16 @@ public interface IItemCountService /// The item counts grouped by type. ItemCounts GetItemCountsForNameItem(BaseItemKind kind, Guid id, BaseItemKind[] relatedItemKinds, InternalItemsQuery accessFilter); + /// + /// Gets item counts for several "by-name" items of the same kind in one query. + /// + /// The kind of the name items. + /// The IDs of the name items. + /// The item kinds to count. + /// A pre-configured query with user access filtering settings. + /// The item counts of each requested id. + Dictionary GetItemCountsForNameItems(BaseItemKind kind, IReadOnlyList ids, BaseItemKind[] relatedItemKinds, InternalItemsQuery accessFilter); + /// /// Gets the count of played items that are descendants of the specified ancestor. /// -- cgit v1.2.3