diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-22 13:00:42 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-22 13:00:42 -0400 |
| commit | 5d837309e43e288fce513d0217c4e62f4ef6c2b4 (patch) | |
| tree | f483cc4d3c7c2353c4050d29bc25a6be3178e42f | |
| parent | 6146b57e7c908d301f5aee3a8cdd996b395db363 (diff) | |
added AllGenres filter
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/ItemsService.cs | 40 | ||||
| -rw-r--r-- | MediaBrowser.Model/Querying/ItemQuery.cs | 6 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.Internal.nuspec | 4 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.nuspec | 2 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Server.Core.nuspec | 4 |
5 files changed, 32 insertions, 24 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index b69dbaa67..3437cdd5a 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; } + /// <summary> /// Limit results to items containing specific studios /// </summary> @@ -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(genres)) + if (!string.IsNullOrEmpty(request.Genres)) { - var vals = genres.Split(','); - items = items.Where(f => f.Genres != null && vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); + var vals = request.Genres.Split(','); + items = items.Where(f => vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); } - var studios = request.Studios; - + // Apply genre filter + if (!string.IsNullOrEmpty(request.AllGenres)) + { + var vals = request.AllGenres.Split(','); + items = items.Where(f => vals.All(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))); + } + // 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 45af17b0f..69c79104a 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -93,6 +93,12 @@ namespace MediaBrowser.Model.Querying public string[] Genres { get; set; } /// <summary> + /// Limit results to items containing specific genres + /// </summary> + /// <value>The genres.</value> + public string[] AllGenres { get; set; } + + /// <summary> /// Limit results to items containing specific studios /// </summary> /// <value>The studios.</value> diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index fc0650d5e..1d104c45b 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.205</version> + <version>3.0.206</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.205" /> + <dependency id="MediaBrowser.Common" version="3.0.206" /> <dependency id="NLog" version="2.0.1.2" /> <dependency id="ServiceStack.Text" version="3.9.58" /> <dependency id="SimpleInjector" version="2.3.2" /> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 64342cef9..0670bcacf 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.205</version> + <version>3.0.206</version> <title>MediaBrowser.Common</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 40919486c..f5aa2d460 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.205</version> + <version>3.0.206</version> <title>Media Browser.Server.Core</title> <authors>Media Browser Team</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains core components required to build plugins for Media Browser Server.</description> <copyright>Copyright © Media Browser 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.205" /> + <dependency id="MediaBrowser.Common" version="3.0.206" /> </dependencies> </metadata> <files> |
