diff options
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/Dto/DtoService.cs | 32 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 12 |
2 files changed, 13 insertions, 31 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 626f4ed0cd..07938d172f 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -418,37 +418,7 @@ namespace Emby.Server.Implementations.Dto return; } - var query = new InternalItemsQuery(user) - { - Recursive = true, - DtoOptions = new DtoOptions(false) { EnableImages = false }, - IncludeItemTypes = relatedItemKinds - }; - - switch (dto.Type) - { - case BaseItemKind.Genre: - case BaseItemKind.MusicGenre: - query.GenreIds = [dto.Id]; - break; - case BaseItemKind.MusicArtist: - query.ArtistIds = [dto.Id]; - break; - case BaseItemKind.Person: - query.PersonIds = [dto.Id]; - break; - case BaseItemKind.Studio: - query.StudioIds = [dto.Id]; - break; - case BaseItemKind.Year - when int.TryParse(dto.Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year): - query.Years = [year]; - break; - default: - return; - } - - var counts = _libraryManager.GetItemCounts(query); + var counts = _libraryManager.GetItemCountsForNameItem(dto.Type, dto.Id, relatedItemKinds, user); dto.AlbumCount = counts.AlbumCount; dto.ArtistCount = counts.ArtistCount; diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 9a5bd41914..60ac15ca97 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1561,6 +1561,18 @@ namespace Emby.Server.Implementations.Library return _itemRepository.GetItemCounts(query); } + /// <inheritdoc/> + public ItemCounts GetItemCountsForNameItem(BaseItemKind kind, Guid id, BaseItemKind[] relatedItemKinds, User? user) + { + var query = new InternalItemsQuery(user); + if (user is not null) + { + AddUserToQuery(query, user); + } + + return _itemRepository.GetItemCountsForNameItem(kind, id, relatedItemKinds, query); + } + public Dictionary<Guid, int> GetChildCountBatch(IReadOnlyList<Guid> parentIds, Guid? userId) { return _itemRepository.GetChildCountBatch(parentIds, userId); |
