mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 19:14:48 +02:00
added AllGenres filter
This commit is contained in:
parent
6146b57e7c
commit
5d837309e4
5 changed files with 32 additions and 24 deletions
|
@ -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)]
|
[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; }
|
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>
|
/// <summary>
|
||||||
/// Limit results to items containing specific studios
|
/// Limit results to items containing specific studios
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -608,43 +611,42 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
items = items.Where(item => imageTypes.Any(imageType => HasImage(item, imageType)));
|
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
|
// Apply genre filter
|
||||||
if (!string.IsNullOrEmpty(genres))
|
if (!string.IsNullOrEmpty(request.AllGenres))
|
||||||
{
|
{
|
||||||
var vals = genres.Split(',');
|
var vals = request.AllGenres.Split(',');
|
||||||
items = items.Where(f => f.Genres != null && vals.Any(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)));
|
items = items.Where(f => vals.All(v => f.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)));
|
||||||
}
|
}
|
||||||
|
|
||||||
var studios = request.Studios;
|
|
||||||
|
|
||||||
// Apply studio filter
|
// Apply studio filter
|
||||||
if (!string.IsNullOrEmpty(studios))
|
if (!string.IsNullOrEmpty(request.Studios))
|
||||||
{
|
{
|
||||||
var vals = studios.Split(',');
|
var vals = request.Studios.Split(',');
|
||||||
items = items.Where(f => f.Studios != null && vals.Any(v => f.Studios.Contains(v, StringComparer.OrdinalIgnoreCase)));
|
items = items.Where(f => vals.Any(v => f.Studios.Contains(v, StringComparer.OrdinalIgnoreCase)));
|
||||||
}
|
}
|
||||||
|
|
||||||
var years = request.Years;
|
|
||||||
|
|
||||||
// Apply year filter
|
// 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));
|
items = items.Where(f => f.ProductionYear.HasValue && vals.Contains(f.ProductionYear.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
var personName = request.Person;
|
|
||||||
|
|
||||||
// Apply person filter
|
// Apply person filter
|
||||||
if (!string.IsNullOrEmpty(personName))
|
if (!string.IsNullOrEmpty(request.Person))
|
||||||
{
|
{
|
||||||
var personTypes = request.PersonTypes;
|
var personTypes = request.PersonTypes;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(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
|
else
|
||||||
{
|
{
|
||||||
|
@ -653,7 +655,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
items = items.Where(item =>
|
items = items.Where(item =>
|
||||||
item.People != null &&
|
item.People != null &&
|
||||||
item.People.Any(p =>
|
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))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,12 @@ namespace MediaBrowser.Model.Querying
|
||||||
/// <value>The genres.</value>
|
/// <value>The genres.</value>
|
||||||
public string[] Genres { get; set; }
|
public string[] Genres { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Limit results to items containing specific genres
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The genres.</value>
|
||||||
|
public string[] AllGenres { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Limit results to items containing specific studios
|
/// Limit results to items containing specific studios
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.205</version>
|
<version>3.0.206</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<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>
|
<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>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<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="NLog" version="2.0.1.2" />
|
||||||
<dependency id="ServiceStack.Text" version="3.9.58" />
|
<dependency id="ServiceStack.Text" version="3.9.58" />
|
||||||
<dependency id="SimpleInjector" version="2.3.2" />
|
<dependency id="SimpleInjector" version="2.3.2" />
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.205</version>
|
<version>3.0.206</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.205</version>
|
<version>3.0.206</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.205" />
|
<dependency id="MediaBrowser.Common" version="3.0.206" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Reference in a new issue