mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
added IsOnTour artists filter
This commit is contained in:
parent
7ee60375a8
commit
0d15e1d631
@ -20,6 +20,11 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
[Api(Description = "Gets all artists from a given item, folder, or the entire library")]
|
[Api(Description = "Gets all artists from a given item, folder, or the entire library")]
|
||||||
public class GetArtists : GetItemsByName
|
public class GetArtists : GetItemsByName
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Filter by artists that are on tour, or not
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>null</c> if [is on tour] contains no value, <c>true</c> if [is on tour]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool? IsOnTour { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -148,6 +153,26 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filters the items.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The request.</param>
|
||||||
|
/// <param name="items">The items.</param>
|
||||||
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
|
protected override IEnumerable<BaseItem> FilterItems(GetItemsByName request, IEnumerable<BaseItem> items)
|
||||||
|
{
|
||||||
|
items = base.FilterItems(request, items);
|
||||||
|
|
||||||
|
var getArtists = (GetArtists) request;
|
||||||
|
|
||||||
|
if (getArtists.IsOnTour.HasValue)
|
||||||
|
{
|
||||||
|
items = items.OfType<Artist>().Where(i => i.IsOnTour == getArtists.IsOnTour.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all items.
|
/// Gets all items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -204,7 +204,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
/// <param name="items">The items.</param>
|
/// <param name="items">The items.</param>
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
private IEnumerable<BaseItem> FilterItems(GetItemsByName request, IEnumerable<BaseItem> items)
|
protected virtual IEnumerable<BaseItem> FilterItems(GetItemsByName request, IEnumerable<BaseItem> items)
|
||||||
{
|
{
|
||||||
// Exclude item types
|
// Exclude item types
|
||||||
if (!string.IsNullOrEmpty(request.ExcludeItemTypes))
|
if (!string.IsNullOrEmpty(request.ExcludeItemTypes))
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<Compile Include="Net\WebSocketMessage.cs" />
|
<Compile Include="Net\WebSocketMessage.cs" />
|
||||||
<Compile Include="Net\WebSocketMessageType.cs" />
|
<Compile Include="Net\WebSocketMessageType.cs" />
|
||||||
<Compile Include="Net\WebSocketState.cs" />
|
<Compile Include="Net\WebSocketState.cs" />
|
||||||
|
<Compile Include="Querying\ArtistsQuery.cs" />
|
||||||
<Compile Include="Querying\ItemsByNameQuery.cs" />
|
<Compile Include="Querying\ItemsByNameQuery.cs" />
|
||||||
<Compile Include="Entities\BaseItemInfo.cs" />
|
<Compile Include="Entities\BaseItemInfo.cs" />
|
||||||
<Compile Include="Connectivity\ClientConnectionInfo.cs" />
|
<Compile Include="Connectivity\ClientConnectionInfo.cs" />
|
||||||
@ -82,6 +83,7 @@
|
|||||||
<Compile Include="Net\HttpException.cs" />
|
<Compile Include="Net\HttpException.cs" />
|
||||||
<Compile Include="Net\NetworkShare.cs" />
|
<Compile Include="Net\NetworkShare.cs" />
|
||||||
<Compile Include="Net\NetworkShareType.cs" />
|
<Compile Include="Net\NetworkShareType.cs" />
|
||||||
|
<Compile Include="Querying\PersonsQuery.cs" />
|
||||||
<Compile Include="Serialization\IJsonSerializer.cs" />
|
<Compile Include="Serialization\IJsonSerializer.cs" />
|
||||||
<Compile Include="Serialization\IXmlSerializer.cs" />
|
<Compile Include="Serialization\IXmlSerializer.cs" />
|
||||||
<Compile Include="Updates\CheckForUpdateResult.cs" />
|
<Compile Include="Updates\CheckForUpdateResult.cs" />
|
||||||
|
15
MediaBrowser.Model/Querying/ArtistsQuery.cs
Normal file
15
MediaBrowser.Model/Querying/ArtistsQuery.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
namespace MediaBrowser.Model.Querying
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class ArtistsQuery
|
||||||
|
/// </summary>
|
||||||
|
public class ArtistsQuery : ItemsByNameQuery
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Filter by artists that are on tour, or not
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>null</c> if [is on tour] contains no value, <c>true</c> if [is on tour]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool? IsOnTour { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -38,6 +38,12 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// <value>The sort by.</value>
|
/// <value>The sort by.</value>
|
||||||
public string[] SortBy { get; set; }
|
public string[] SortBy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Filter by artists
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The artists.</value>
|
||||||
|
public string[] Artists { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sort order to return results with
|
/// The sort order to return results with
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -194,6 +200,7 @@ namespace MediaBrowser.Model.Querying
|
|||||||
Years = new int[] { };
|
Years = new int[] { };
|
||||||
PersonTypes = new string[] { };
|
PersonTypes = new string[] { };
|
||||||
Ids = new string[] { };
|
Ids = new string[] { };
|
||||||
|
Artists = new string[] { };
|
||||||
|
|
||||||
ImageTypes = new ImageType[] { };
|
ImageTypes = new ImageType[] { };
|
||||||
AirDays = new DayOfWeek[] { };
|
AirDays = new DayOfWeek[] { };
|
||||||
|
@ -42,11 +42,6 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The fields.</value>
|
/// <value>The fields.</value>
|
||||||
public ItemFields[] Fields { get; set; }
|
public ItemFields[] Fields { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the person types.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The person types.</value>
|
|
||||||
public string[] PersonTypes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ItemsByNameQuery"/> class.
|
/// Initializes a new instance of the <see cref="ItemsByNameQuery"/> class.
|
||||||
@ -54,8 +49,6 @@ namespace MediaBrowser.Model.Querying
|
|||||||
public ItemsByNameQuery()
|
public ItemsByNameQuery()
|
||||||
{
|
{
|
||||||
Fields = new ItemFields[] {};
|
Fields = new ItemFields[] {};
|
||||||
|
|
||||||
PersonTypes = new string[] {};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
MediaBrowser.Model/Querying/PersonsQuery.cs
Normal file
23
MediaBrowser.Model/Querying/PersonsQuery.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
namespace MediaBrowser.Model.Querying
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class PersonsQuery
|
||||||
|
/// </summary>
|
||||||
|
public class PersonsQuery : ItemsByNameQuery
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the person types.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The person types.</value>
|
||||||
|
public string[] PersonTypes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PersonsQuery"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public PersonsQuery()
|
||||||
|
{
|
||||||
|
PersonTypes = new string[] { };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user