diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b69dbaa67c..3437cdd5ab 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -63,6 +63,9 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "Genres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Genres { get; set; } + [ApiMember(Name = "AllGenres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string AllGenres { get; set; } + /// /// Limit results to items containing specific studios /// @@ -608,43 +611,42 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(item => imageTypes.Any(imageType => HasImage(item, imageType))); } - var genres = request.Genres; + // Apply genre filter + if (!string.IsNullOrEmpty(request.Genres)) + { + var vals = request.Genres.Split(','); + items = items.Where(f => vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); + } // Apply genre filter - if (!string.IsNullOrEmpty(genres)) + if (!string.IsNullOrEmpty(request.AllGenres)) { - var vals = genres.Split(','); - items = items.Where(f => f.Genres != null && vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); + var vals = request.AllGenres.Split(','); + items = items.Where(f => vals.All(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); } - - var studios = request.Studios; - + // Apply studio filter - if (!string.IsNullOrEmpty(studios)) + if (!string.IsNullOrEmpty(request.Studios)) { - var vals = studios.Split(','); - items = items.Where(f => f.Studios != null && vals.Any(v => f.Studios.Contains(v, StringComparer.OrdinalIgnoreCase))); + var vals = request.Studios.Split(','); + items = items.Where(f => vals.Any(v => f.Studios.Contains(v, StringComparer.OrdinalIgnoreCase))); } - var years = request.Years; - // Apply year filter - if (!string.IsNullOrEmpty(years)) + if (!string.IsNullOrEmpty(request.Years)) { - var vals = years.Split(',').Select(int.Parse); + var vals = request.Years.Split(',').Select(int.Parse).ToList(); items = items.Where(f => f.ProductionYear.HasValue && vals.Contains(f.ProductionYear.Value)); } - var personName = request.Person; - // Apply person filter - if (!string.IsNullOrEmpty(personName)) + if (!string.IsNullOrEmpty(request.Person)) { var personTypes = request.PersonTypes; if (string.IsNullOrEmpty(personTypes)) { - items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, personName, StringComparison.OrdinalIgnoreCase))); + items = items.Where(item => item.People != null && item.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))); } else { @@ -653,7 +655,7 @@ namespace MediaBrowser.Api.UserLibrary items = items.Where(item => item.People != null && item.People.Any(p => - p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase)))); + p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase)))); } } diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs index 45af17b0f2..69c79104a4 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -92,6 +92,12 @@ namespace MediaBrowser.Model.Querying /// The genres. public string[] Genres { get; set; } + /// + /// Limit results to items containing specific genres + /// + /// The genres. + public string[] AllGenres { get; set; } + /// /// Limit results to items containing specific studios /// diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index fc0650d5ef..1d104c45bc 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.205 + 3.0.206 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 64342cef9a..0670bcacf4 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.205 + 3.0.206 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 40919486ce..f5aa2d4609 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.205 + 3.0.206 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +