diff options
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs')
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/ItemsService.cs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index c907dfe9b..cd6bd7854 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -38,8 +38,8 @@ namespace MediaBrowser.Api.UserLibrary /// If the Person filter is used, this can also be used to restrict to a specific person type /// </summary> /// <value>The type of the person.</value> - [ApiMember(Name = "PersonType", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public string PersonType { get; set; } + [ApiMember(Name = "PersonTypes", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string PersonTypes { get; set; } /// <summary> /// Search characters used to find items @@ -448,11 +448,21 @@ namespace MediaBrowser.Api.UserLibrary // Apply person filter if (!string.IsNullOrEmpty(personName)) { - var personType = request.PersonType; + var personTypes = request.PersonTypes; - items = !string.IsNullOrEmpty(personType) - ? items.Where(item => item.People != null && item.People.Any(p => p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(personType, StringComparison.OrdinalIgnoreCase))) - : items.Where(item => item.People != null && item.People.Any(p => p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase))); + if (string.IsNullOrEmpty(personTypes)) + { + items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, personName, StringComparison.OrdinalIgnoreCase))); + } + else + { + var types = personTypes.Split(','); + + items = items.Where(item => + item.People != null && + item.People.Any(p => + p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && types.Contains(p.Type, StringComparer.OrdinalIgnoreCase))); + } } return items; |
