diff options
| author | Niels van Velzen <nielsvanvelzen@users.noreply.github.com> | 2026-05-04 17:58:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-04 17:58:27 +0200 |
| commit | dcba6c36595e7cb74a83e1fca872274e4cabcf93 (patch) | |
| tree | 197b747a07e488d1db81573763c7c6d502195342 /Emby.Server.Implementations/Library | |
| parent | 57821e4cded8cfc4a5fdcca7c15b12d1ecccaaf3 (diff) | |
| parent | ec990be12af3856eea597ba7ebdd5dbfa5b01ace (diff) | |
Merge pull request #16616 from dkanada/fix-person-limit
fix person TotalRecordCount when limit is applied
Diffstat (limited to 'Emby.Server.Implementations/Library')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 2bcb10e9e1..5853ebf934 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -3253,7 +3253,7 @@ namespace Emby.Server.Implementations.Library public IReadOnlyList<PersonInfo> GetPeople(InternalPeopleQuery query) { - return _peopleRepository.GetPeople(query); + return _peopleRepository.GetPeople(query).Items; } public IReadOnlyList<PersonInfo> GetPeople(BaseItem item) @@ -3274,24 +3274,33 @@ namespace Emby.Server.Implementations.Library return []; } - public IReadOnlyList<Person> GetPeopleItems(InternalPeopleQuery query) + public QueryResult<BaseItem> GetPeopleItems(InternalPeopleQuery query) { - return _peopleRepository.GetPeopleNames(query) - .Select(i => - { - try + var queryResult = _peopleRepository.GetPeople(query); + var baseItems = queryResult.Items.Select(i => { - return GetPerson(i); - } - catch (Exception ex) - { - _logger.LogError(ex, "Error getting person"); - return null; - } - }) - .Where(i => i is not null) - .Where(i => query.User is null || i!.IsVisible(query.User)) - .ToList()!; // null values are filtered out + try + { + return GetPerson(i.Name); + } + catch (Exception ex) + { + _logger.LogError(ex, "error retrieving BaseItem for person: {0}", i.Name); + return null; + } + }) + .Where(i => i is not null) + .Where(i => query.User is null || i!.IsVisible(query.User)) + .OfType<BaseItem>() + .ToList() + .AsReadOnly(); + + return new QueryResult<BaseItem> + { + StartIndex = queryResult.StartIndex, + TotalRecordCount = queryResult.TotalRecordCount, + Items = baseItems, + }; } public IReadOnlyList<string> GetPeopleNames(InternalPeopleQuery query) |
