From 0d15e1d631a220f2d1288ad9632e3cfaa8ede479 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 24 Apr 2013 10:30:12 -0400 Subject: added IsOnTour artists filter --- MediaBrowser.Api/UserLibrary/ArtistsService.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'MediaBrowser.Api/UserLibrary/ArtistsService.cs') diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index c5f7f492a..ad1007a31 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -20,6 +20,11 @@ namespace MediaBrowser.Api.UserLibrary [Api(Description = "Gets all artists from a given item, folder, or the entire library")] public class GetArtists : GetItemsByName { + /// + /// Filter by artists that are on tour, or not + /// + /// null if [is on tour] contains no value, true if [is on tour]; otherwise, false. + public bool? IsOnTour { get; set; } } /// @@ -148,6 +153,26 @@ namespace MediaBrowser.Api.UserLibrary return ToOptimizedResult(result); } + /// + /// Filters the items. + /// + /// The request. + /// The items. + /// IEnumerable{BaseItem}. + protected override IEnumerable FilterItems(GetItemsByName request, IEnumerable items) + { + items = base.FilterItems(request, items); + + var getArtists = (GetArtists) request; + + if (getArtists.IsOnTour.HasValue) + { + items = items.OfType().Where(i => i.IsOnTour == getArtists.IsOnTour.Value); + } + + return items; + } + /// /// Gets all items. /// -- cgit v1.2.3