aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserLibrary/ItemsService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-20 23:10:37 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-20 23:10:37 -0400
commitd4870e788ac7f65190f6c82ec766d0340533de8c (patch)
tree64ea0c60bf515d175f2e9959f6c35c7250008999 /MediaBrowser.Api/UserLibrary/ItemsService.cs
parent52a42229cd0f33954b211c5627b0e864feacbf21 (diff)
update db querying
Diffstat (limited to 'MediaBrowser.Api/UserLibrary/ItemsService.cs')
-rw-r--r--MediaBrowser.Api/UserLibrary/ItemsService.cs64
1 files changed, 12 insertions, 52 deletions
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index 92b2d6002..f32165fca 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -310,6 +310,18 @@ namespace MediaBrowser.Api.UserLibrary
{
query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray();
}
+
+ // Min official rating
+ if (!string.IsNullOrEmpty(request.MinOfficialRating))
+ {
+ query.MinParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
+ }
+
+ // Max official rating
+ if (!string.IsNullOrEmpty(request.MaxOfficialRating))
+ {
+ query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
+ }
return query;
}
@@ -384,58 +396,6 @@ namespace MediaBrowser.Api.UserLibrary
return false;
}
- // Min official rating
- if (!string.IsNullOrEmpty(request.MinOfficialRating))
- {
- var level = _localization.GetRatingLevel(request.MinOfficialRating);
-
- if (level.HasValue)
- {
- var rating = i.CustomRating;
-
- if (string.IsNullOrEmpty(rating))
- {
- rating = i.OfficialRating;
- }
-
- if (!string.IsNullOrEmpty(rating))
- {
- var itemLevel = _localization.GetRatingLevel(rating);
-
- if (!(!itemLevel.HasValue || itemLevel.Value >= level.Value))
- {
- return false;
- }
- }
- }
- }
-
- // Max official rating
- if (!string.IsNullOrEmpty(request.MaxOfficialRating))
- {
- var level = _localization.GetRatingLevel(request.MaxOfficialRating);
-
- if (level.HasValue)
- {
- var rating = i.CustomRating;
-
- if (string.IsNullOrEmpty(rating))
- {
- rating = i.OfficialRating;
- }
-
- if (!string.IsNullOrEmpty(rating))
- {
- var itemLevel = _localization.GetRatingLevel(rating);
-
- if (!(!itemLevel.HasValue || itemLevel.Value <= level.Value))
- {
- return false;
- }
- }
- }
- }
-
return true;
}
}