mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 14:33:06 +03:00
update db querying
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user