aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserLibrary/ArtistsService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-24 10:30:12 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-24 10:30:12 -0400
commit0d15e1d631a220f2d1288ad9632e3cfaa8ede479 (patch)
tree1df09d68210a887e9386edad1c80760268179829 /MediaBrowser.Api/UserLibrary/ArtistsService.cs
parent7ee60375a88277ec3f09f349baead317db101d1f (diff)
added IsOnTour artists filter
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ArtistsService.cs')
-rw-r--r--MediaBrowser.Api/UserLibrary/ArtistsService.cs25
1 files changed, 25 insertions, 0 deletions
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
{
+ /// <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>
@@ -149,6 +154,26 @@ namespace MediaBrowser.Api.UserLibrary
}
/// <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>
/// Gets all items.
/// </summary>
/// <param name="request">The request.</param>