From 44ff7167f073c220289a864b100c5bdd46aee7f0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Apr 2013 15:47:41 -0400 Subject: [PATCH] fix include/exclude item type queries --- MediaBrowser.Api/UserLibrary/ItemsService.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 675ac0cd55..c907dfe9b8 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -357,6 +357,20 @@ namespace MediaBrowser.Api.UserLibrary /// IEnumerable{BaseItem}. internal static IEnumerable ApplyAdditionalFilters(GetItems request, IEnumerable items) { + // Exclude item types + if (!string.IsNullOrEmpty(request.ExcludeItemTypes)) + { + var vals = request.ExcludeItemTypes.Split(','); + items = items.Where(f => !vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase)); + } + + // Include item types + if (!string.IsNullOrEmpty(request.IncludeItemTypes)) + { + var vals = request.IncludeItemTypes.Split(','); + items = items.Where(f => vals.Contains(f.GetType().Name, StringComparer.OrdinalIgnoreCase)); + } + // Filter by Series Status if (!string.IsNullOrEmpty(request.SeriesStatus)) {