|
@@ -46,9 +46,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|
[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")]
|
|
[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; }
|
|
public string PersonTypes { get; set; }
|
|
|
|
|
|
- [ApiMember(Name = "AllGenres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, pipe 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>
|
|
@@ -56,6 +53,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|
[ApiMember(Name = "Studios", Description = "Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
[ApiMember(Name = "Studios", Description = "Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
public string Studios { get; set; }
|
|
public string Studios { get; set; }
|
|
|
|
|
|
|
|
+ [ApiMember(Name = "StudioIds", Description = "Optional. If specified, results will be filtered based on studio. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
|
|
+ public string StudioIds { get; set; }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets or sets the studios.
|
|
/// Gets or sets the studios.
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -63,6 +63,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|
[ApiMember(Name = "Artists", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
[ApiMember(Name = "Artists", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
public string Artists { get; set; }
|
|
public string Artists { get; set; }
|
|
|
|
|
|
|
|
+ [ApiMember(Name = "ArtistIds", Description = "Optional. If specified, results will be filtered based on artist. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
|
|
+ public string ArtistIds { get; set; }
|
|
|
|
+
|
|
[ApiMember(Name = "Albums", Description = "Optional. If specified, results will be filtered based on album. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
[ApiMember(Name = "Albums", Description = "Optional. If specified, results will be filtered based on album. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
|
public string Albums { get; set; }
|
|
public string Albums { get; set; }
|
|
|
|
|
|
@@ -226,14 +229,14 @@ namespace MediaBrowser.Api.UserLibrary
|
|
[ApiMember(Name = "CollapseBoxSetItems", Description = "Whether or not to hide items behind their boxsets.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
|
[ApiMember(Name = "CollapseBoxSetItems", Description = "Whether or not to hide items behind their boxsets.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
|
public bool? CollapseBoxSetItems { get; set; }
|
|
public bool? CollapseBoxSetItems { get; set; }
|
|
|
|
|
|
- public string[] GetAllGenres()
|
|
|
|
|
|
+ public string[] GetStudios()
|
|
{
|
|
{
|
|
- return (AllGenres ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
+ return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
|
}
|
|
}
|
|
|
|
|
|
- public string[] GetStudios()
|
|
|
|
|
|
+ public string[] GetStudioIds()
|
|
{
|
|
{
|
|
- return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
+ return (StudioIds ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
|
}
|
|
}
|
|
|
|
|
|
public string[] GetPersonTypes()
|
|
public string[] GetPersonTypes()
|
|
@@ -241,7 +244,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|
return (PersonTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
return (PersonTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
}
|
|
}
|
|
|
|
|
|
- public IEnumerable<VideoType> GetVideoTypes()
|
|
|
|
|
|
+ public VideoType[] GetVideoTypes()
|
|
{
|
|
{
|
|
var val = VideoTypes;
|
|
var val = VideoTypes;
|
|
|
|
|
|
@@ -250,7 +253,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|
return new VideoType[] { };
|
|
return new VideoType[] { };
|
|
}
|
|
}
|
|
|
|
|
|
- return val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(v => (VideoType)Enum.Parse(typeof(VideoType), v, true));
|
|
|
|
|
|
+ return val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(v => (VideoType)Enum.Parse(typeof(VideoType), v, true)).ToArray();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -471,8 +474,8 @@ namespace MediaBrowser.Api.UserLibrary
|
|
Tags = request.GetTags(),
|
|
Tags = request.GetTags(),
|
|
OfficialRatings = request.GetOfficialRatings(),
|
|
OfficialRatings = request.GetOfficialRatings(),
|
|
Genres = request.GetGenres(),
|
|
Genres = request.GetGenres(),
|
|
- AllGenres = request.GetAllGenres(),
|
|
|
|
Studios = request.GetStudios(),
|
|
Studios = request.GetStudios(),
|
|
|
|
+ StudioIds = request.GetStudioIds(),
|
|
Person = request.Person,
|
|
Person = request.Person,
|
|
PersonTypes = request.GetPersonTypes(),
|
|
PersonTypes = request.GetPersonTypes(),
|
|
Years = request.GetYears(),
|
|
Years = request.GetYears(),
|
|
@@ -609,6 +612,8 @@ namespace MediaBrowser.Api.UserLibrary
|
|
|
|
|
|
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, bool isPreFiltered, ILibraryManager libraryManager)
|
|
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, bool isPreFiltered, ILibraryManager libraryManager)
|
|
{
|
|
{
|
|
|
|
+ var video = i as Video;
|
|
|
|
+
|
|
if (!isPreFiltered)
|
|
if (!isPreFiltered)
|
|
{
|
|
{
|
|
var mediaTypes = request.GetMediaTypes();
|
|
var mediaTypes = request.GetMediaTypes();
|
|
@@ -656,7 +661,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|
if (request.Is3D.HasValue)
|
|
if (request.Is3D.HasValue)
|
|
{
|
|
{
|
|
var val = request.Is3D.Value;
|
|
var val = request.Is3D.Value;
|
|
- var video = i as Video;
|
|
|
|
|
|
|
|
if (video == null || val != video.Video3DFormat.HasValue)
|
|
if (video == null || val != video.Video3DFormat.HasValue)
|
|
{
|
|
{
|
|
@@ -667,7 +671,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|
if (request.IsHD.HasValue)
|
|
if (request.IsHD.HasValue)
|
|
{
|
|
{
|
|
var val = request.IsHD.Value;
|
|
var val = request.IsHD.Value;
|
|
- var video = i as Video;
|
|
|
|
|
|
|
|
if (video == null || val != video.IsHD)
|
|
if (video == null || val != video.IsHD)
|
|
{
|
|
{
|
|
@@ -809,8 +812,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|
{
|
|
{
|
|
var val = request.HasSubtitles.Value;
|
|
var val = request.HasSubtitles.Value;
|
|
|
|
|
|
- var video = i as Video;
|
|
|
|
-
|
|
|
|
if (video == null || val != video.HasSubtitles)
|
|
if (video == null || val != video.HasSubtitles)
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
@@ -930,23 +931,11 @@ namespace MediaBrowser.Api.UserLibrary
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- // Apply genre filter
|
|
|
|
- var allGenres = request.GetAllGenres();
|
|
|
|
- if (allGenres.Length > 0 && !allGenres.All(v => i.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)))
|
|
|
|
- {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// Filter by VideoType
|
|
// Filter by VideoType
|
|
- if (!string.IsNullOrEmpty(request.VideoTypes))
|
|
|
|
|
|
+ var videoTypes = request.GetVideoTypes();
|
|
|
|
+ if (videoTypes.Length > 0 && (video == null || !videoTypes.Contains(video.VideoType)))
|
|
{
|
|
{
|
|
- var types = request.VideoTypes.Split(',');
|
|
|
|
-
|
|
|
|
- var video = i as Video;
|
|
|
|
- if (video == null || !types.Contains(video.VideoType.ToString(), StringComparer.OrdinalIgnoreCase))
|
|
|
|
- {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
var imageTypes = request.GetImageTypes().ToList();
|
|
var imageTypes = request.GetImageTypes().ToList();
|
|
@@ -965,6 +954,17 @@ namespace MediaBrowser.Api.UserLibrary
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Apply studio filter
|
|
|
|
+ var studioIds = request.GetStudioIds();
|
|
|
|
+ if (studioIds.Length > 0 && !studioIds.Any(id =>
|
|
|
|
+ {
|
|
|
|
+ var studioItem = libraryManager.GetItemById(id);
|
|
|
|
+ return studioItem != null && i.Studios.Contains(studioItem.Name, StringComparer.OrdinalIgnoreCase);
|
|
|
|
+ }))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Apply year filter
|
|
// Apply year filter
|
|
var years = request.GetYears();
|
|
var years = request.GetYears();
|
|
if (years.Length > 0 && !(i.ProductionYear.HasValue && years.Contains(i.ProductionYear.Value)))
|
|
if (years.Length > 0 && !(i.ProductionYear.HasValue && years.Contains(i.ProductionYear.Value)))
|
|
@@ -1030,6 +1030,23 @@ namespace MediaBrowser.Api.UserLibrary
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Artists
|
|
|
|
+ if (!string.IsNullOrEmpty(request.ArtistIds))
|
|
|
|
+ {
|
|
|
|
+ var artistIds = request.ArtistIds.Split('|');
|
|
|
|
+
|
|
|
|
+ var audio = i as IHasArtist;
|
|
|
|
+
|
|
|
|
+ if (!(audio != null && artistIds.Any(id =>
|
|
|
|
+ {
|
|
|
|
+ var artistItem = libraryManager.GetItemById(id);
|
|
|
|
+ return artistItem != null && audio.HasAnyArtist(artistItem.Name);
|
|
|
|
+ })))
|
|
|
|
+ {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// Artists
|
|
// Artists
|
|
if (!string.IsNullOrEmpty(request.Artists))
|
|
if (!string.IsNullOrEmpty(request.Artists))
|
|
{
|
|
{
|
|
@@ -1037,7 +1054,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|
|
|
|
|
var audio = i as IHasArtist;
|
|
var audio = i as IHasArtist;
|
|
|
|
|
|
- if (!(audio != null && artists.Any(audio.HasArtist)))
|
|
|
|
|
|
+ if (!(audio != null && artists.Any(audio.HasAnyArtist)))
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|