query for content by studio id
This commit is contained in:
parent
9606a1c267
commit
1735300bcf
|
@ -53,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>
|
||||||
|
@ -231,6 +234,11 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] GetStudioIds()
|
||||||
|
{
|
||||||
|
return (StudioIds ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
|
|
||||||
public string[] GetPersonTypes()
|
public string[] GetPersonTypes()
|
||||||
{
|
{
|
||||||
return (PersonTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
return (PersonTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
@ -467,6 +475,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
OfficialRatings = request.GetOfficialRatings(),
|
OfficialRatings = request.GetOfficialRatings(),
|
||||||
Genres = request.GetGenres(),
|
Genres = request.GetGenres(),
|
||||||
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(),
|
||||||
|
@ -945,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)))
|
||||||
|
@ -1019,14 +1039,8 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
if (!(audio != null && artistIds.Any(id =>
|
if (!(audio != null && artistIds.Any(id =>
|
||||||
{
|
{
|
||||||
try
|
var artistItem = libraryManager.GetItemById(id);
|
||||||
{
|
return artistItem != null && audio.HasAnyArtist(artistItem.Name);
|
||||||
return audio.HasAnyArtist(libraryManager.GetItemById(id).Name);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})))
|
})))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -65,6 +65,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
public bool? HasParentalRating { get; set; }
|
public bool? HasParentalRating { get; set; }
|
||||||
|
|
||||||
public string[] Studios { get; set; }
|
public string[] Studios { get; set; }
|
||||||
|
public string[] StudioIds { get; set; }
|
||||||
public ImageType[] ImageTypes { get; set; }
|
public ImageType[] ImageTypes { get; set; }
|
||||||
public VideoType[] VideoTypes { get; set; }
|
public VideoType[] VideoTypes { get; set; }
|
||||||
public int[] Years { get; set; }
|
public int[] Years { get; set; }
|
||||||
|
@ -81,6 +82,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
ExcludeItemTypes = new string[] { };
|
ExcludeItemTypes = new string[] { };
|
||||||
Genres = new string[] { };
|
Genres = new string[] { };
|
||||||
Studios = new string[] { };
|
Studios = new string[] { };
|
||||||
|
StudioIds = new string[] { };
|
||||||
ImageTypes = new ImageType[] { };
|
ImageTypes = new ImageType[] { };
|
||||||
VideoTypes = new VideoType[] { };
|
VideoTypes = new VideoType[] { };
|
||||||
Years = new int[] { };
|
Years = new int[] { };
|
||||||
|
|
|
@ -1045,6 +1045,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.StudioIds.Length > 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (request.VideoTypes.Length > 0)
|
if (request.VideoTypes.Length > 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1585,6 +1590,16 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply studio filter
|
||||||
|
if (query.StudioIds.Length > 0 && !query.StudioIds.Any(id =>
|
||||||
|
{
|
||||||
|
var studioItem = libraryManager.GetItemById(id);
|
||||||
|
return studioItem != null && item.Studios.Contains(studioItem.Name, StringComparer.OrdinalIgnoreCase);
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Apply year filter
|
// Apply year filter
|
||||||
if (query.Years.Length > 0)
|
if (query.Years.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,10 +93,10 @@ namespace MediaBrowser.Model.Querying
|
||||||
public string[] Genres { get; set; }
|
public string[] Genres { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Limit results to items containing specific studios
|
/// Gets or sets the studio ids.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The studios.</value>
|
/// <value>The studio ids.</value>
|
||||||
public string[] Studios { get; set; }
|
public string[] StudioIds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the exclude item types.
|
/// Gets or sets the exclude item types.
|
||||||
|
@ -300,7 +300,7 @@ namespace MediaBrowser.Model.Querying
|
||||||
VideoTypes = new VideoType[] { };
|
VideoTypes = new VideoType[] { };
|
||||||
|
|
||||||
Genres = new string[] { };
|
Genres = new string[] { };
|
||||||
Studios = new string[] { };
|
StudioIds = new string[] { };
|
||||||
IncludeItemTypes = new string[] { };
|
IncludeItemTypes = new string[] { };
|
||||||
ExcludeItemTypes = new string[] { };
|
ExcludeItemTypes = new string[] { };
|
||||||
Years = new int[] { };
|
Years = new int[] { };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user