Expose optimized ItemCounts for byName items

This commit is contained in:
Shadowghost
2026-09-07 10:30:01 +02:00
parent 3e7d1158da
commit 59cd5f983b
5 changed files with 287 additions and 35 deletions
@@ -759,6 +759,17 @@ namespace MediaBrowser.Controller.Library
/// <returns>The item counts grouped by type.</returns>
ItemCounts GetItemCountsForNameItem(BaseItemKind kind, Guid id, BaseItemKind[] relatedItemKinds, User? user);
/// <summary>
/// Gets item counts for several "by-name" items of the same kind in one query, instead of
/// one query per item.
/// </summary>
/// <param name="kind">The kind of the name items.</param>
/// <param name="ids">The IDs of the name items.</param>
/// <param name="relatedItemKinds">The item kinds to count.</param>
/// <param name="user">The user for access filtering.</param>
/// <returns>The item counts of each requested id.</returns>
Dictionary<Guid, ItemCounts> GetItemCountsForNameItems(BaseItemKind kind, IReadOnlyList<Guid> ids, BaseItemKind[] relatedItemKinds, User? user);
/// <summary>
/// Batch-fetches child counts for multiple parent folders.
/// Returns the count of immediate children (non-recursive) for each parent.
@@ -36,6 +36,16 @@ public interface IItemCountService
/// <returns>The item counts grouped by type.</returns>
ItemCounts GetItemCountsForNameItem(BaseItemKind kind, Guid id, BaseItemKind[] relatedItemKinds, InternalItemsQuery accessFilter);
/// <summary>
/// Gets item counts for several "by-name" items of the same kind in one query.
/// </summary>
/// <param name="kind">The kind of the name items.</param>
/// <param name="ids">The IDs of the name items.</param>
/// <param name="relatedItemKinds">The item kinds to count.</param>
/// <param name="accessFilter">A pre-configured query with user access filtering settings.</param>
/// <returns>The item counts of each requested id.</returns>
Dictionary<Guid, ItemCounts> GetItemCountsForNameItems(BaseItemKind kind, IReadOnlyList<Guid> ids, BaseItemKind[] relatedItemKinds, InternalItemsQuery accessFilter);
/// <summary>
/// Gets the count of played items that are descendants of the specified ancestor.
/// </summary>