mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-03 04:13:38 +02:00
added Artists filter
This commit is contained in:
parent
7f0b662b51
commit
7ee60375a8
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
|
@ -76,6 +77,13 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
[ApiMember(Name = "Studios", Description = "Optional. If specified, results will be filtered based on studio. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string Studios { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the studios.
|
||||
/// </summary>
|
||||
/// <value>The studios.</value>
|
||||
[ApiMember(Name = "Artists", 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 Artists { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Limit results to items containing specific years
|
||||
/// </summary>
|
||||
|
@ -87,21 +95,21 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// Gets or sets the image types.
|
||||
/// </summary>
|
||||
/// <value>The image types.</value>
|
||||
[ApiMember(Name = "ImageTypes", Description = "Optional. If specified, results will be filtered based on those containing image types. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
[ApiMember(Name = "ImageTypes", Description = "Optional. If specified, results will be filtered based on those containing image types. This allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string ImageTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the item ids.
|
||||
/// </summary>
|
||||
/// <value>The item ids.</value>
|
||||
[ApiMember(Name = "Ids", Description = "Optional. If specific items are needed, specify a list of item id's to retrieve. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
[ApiMember(Name = "Ids", Description = "Optional. If specific items are needed, specify a list of item id's to retrieve. This allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string Ids { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the media types.
|
||||
/// </summary>
|
||||
/// <value>The media types.</value>
|
||||
[ApiMember(Name = "MediaTypes", Description = "Optional filter by MediaType. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
[ApiMember(Name = "MediaTypes", Description = "Optional filter by MediaType. Allows multiple, comma delimited.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||
public string MediaTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -379,6 +387,31 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
internal static IEnumerable<BaseItem> ApplyAdditionalFilters(GetItems request, IEnumerable<BaseItem> items)
|
||||
{
|
||||
// Artists
|
||||
if (!string.IsNullOrEmpty(request.Artists))
|
||||
{
|
||||
var artists = request.Artists.Split('|');
|
||||
|
||||
items = items.Where(i =>
|
||||
{
|
||||
var audio = i as Audio;
|
||||
|
||||
if (audio != null)
|
||||
{
|
||||
return artists.Any(audio.HasArtist);
|
||||
}
|
||||
|
||||
var album = i as MusicAlbum;
|
||||
|
||||
if (album != null)
|
||||
{
|
||||
return artists.Any(album.HasArtist);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// Min official rating
|
||||
if (!string.IsNullOrEmpty(request.MinOfficalRating))
|
||||
{
|
||||
|
|
|
@ -14,5 +14,11 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
{
|
||||
return "Artist-" + Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is on tour.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is on tour; otherwise, <c>false</c>.</value>
|
||||
public bool IsOnTour { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,5 +139,15 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
base.Images = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified artist has artist.
|
||||
/// </summary>
|
||||
/// <param name="artist">The artist.</param>
|
||||
/// <returns><c>true</c> if the specified artist has artist; otherwise, <c>false</c>.</returns>
|
||||
public bool HasArtist(string artist)
|
||||
{
|
||||
return Children.OfType<Audio>().Any(i => i.HasArtist(artist));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
|
@ -31,6 +32,13 @@ namespace MediaBrowser.Controller.Providers.Music
|
|||
{
|
||||
AddGenres(artist, data.tags);
|
||||
}
|
||||
|
||||
var entity = artist as Artist;
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
entity.IsOnTour = string.Equals(data.ontour, "1");
|
||||
}
|
||||
}
|
||||
|
||||
public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)
|
||||
|
|
Loading…
Reference in a new issue