From 7f1fdbf223f95dfc1435a8ff1b82fd635cc9b1d9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Apr 2013 19:43:41 -0400 Subject: add GuestStar distinction --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs') 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 /// /// The type of the person. - [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; } /// /// 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; -- cgit v1.2.3