aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/UserViewBuilder.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-11-09 23:20:11 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-11-09 23:20:11 -0500
commit95eaf88abd6a979b19f4ee998936ba6f2f4eef4b (patch)
tree566ce2f3c96bc231143df128264c5b9a0047ead7 /MediaBrowser.Controller/Entities/UserViewBuilder.cs
parent1a80362a0f04c3cc571456af64f9de19c0c30d2a (diff)
fixes #943 - Add web client filtering by genres, parental ratings, tags and years
Diffstat (limited to 'MediaBrowser.Controller/Entities/UserViewBuilder.cs')
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index ff3b5920e..cd579f7ad 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -870,6 +870,16 @@ namespace MediaBrowser.Controller.Entities
return false;
}
+ if (request.Tags.Length > 0)
+ {
+ return false;
+ }
+
+ if (request.OfficialRatings.Length > 0)
+ {
+ return false;
+ }
+
return true;
}
@@ -1405,6 +1415,12 @@ namespace MediaBrowser.Controller.Entities
}
}
+ // Apply official rating filter
+ if (query.OfficialRatings.Length > 0 && !query.OfficialRatings.Contains(item.OfficialRating ?? string.Empty))
+ {
+ return false;
+ }
+
// Apply person filter
if (!string.IsNullOrEmpty(query.Person))
{
@@ -1431,6 +1447,21 @@ namespace MediaBrowser.Controller.Entities
return false;
}
}
+ }
+
+ // Apply tag filter
+ var tags = query.Tags;
+ if (tags.Length > 0)
+ {
+ var hasTags = item as IHasTags;
+ if (hasTags == null)
+ {
+ return false;
+ }
+ if (!(tags.Any(v => hasTags.Tags.Contains(v, StringComparer.OrdinalIgnoreCase))))
+ {
+ return false;
+ }
}
return true;