aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserLibrary/ItemsService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-03-18 12:40:16 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-03-18 12:40:16 -0400
commit1fb24df504fbb8e9208de13250cb09e5971f753f (patch)
tree727ffb0df714865d85567abf7147af4dd2e9707b /MediaBrowser.Api/UserLibrary/ItemsService.cs
parent79d2f7efd78c027e8c0bd7006591bc48b660a21a (diff)
add query by PersonId
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs')
-rw-r--r--MediaBrowser.Api/UserLibrary/ItemsService.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index bdaad49e6..4d222c9bb 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -39,6 +39,9 @@ namespace MediaBrowser.Api.UserLibrary
[ApiMember(Name = "Person", Description = "Optional. If specified, results will be filtered to include only those containing the specified person.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Person { get; set; }
+ [ApiMember(Name = "PersonIds", Description = "Optional. If specified, results will be filtered to include only those containing the specified person.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string PersonIds { get; set; }
+
/// <summary>
/// If the Person filter is used, this can also be used to restrict to a specific person type
/// </summary>
@@ -244,6 +247,11 @@ namespace MediaBrowser.Api.UserLibrary
return (PersonTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}
+ public string[] GetPersonIds()
+ {
+ return (PersonIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ }
+
public VideoType[] GetVideoTypes()
{
var val = VideoTypes;
@@ -477,6 +485,7 @@ namespace MediaBrowser.Api.UserLibrary
Studios = request.GetStudios(),
StudioIds = request.GetStudioIds(),
Person = request.Person,
+ PersonIds = request.GetPersonIds(),
PersonTypes = request.GetPersonTypes(),
Years = request.GetYears(),
ImageTypes = request.GetImageTypes().ToArray(),
@@ -970,6 +979,13 @@ namespace MediaBrowser.Api.UserLibrary
if (years.Length > 0 && !(i.ProductionYear.HasValue && years.Contains(i.ProductionYear.Value)))
{
return false;
+ }
+
+ // Apply person filter
+ var personIds = request.GetPersonIds();
+ if (personIds.Length > 0 && !(personIds.Any(v => i.People.Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
+ {
+ return false;
}
// Apply person filter