mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
support querying more fields
This commit is contained in:
parent
e1f562e16f
commit
669af87014
@ -793,11 +793,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.Metascore");
|
||||
return true;
|
||||
}
|
||||
if (query.SortBy.Contains(ItemSortBy.OfficialRating, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.OfficialRating");
|
||||
return true;
|
||||
}
|
||||
if (query.SortBy.Contains(ItemSortBy.Players, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.Players");
|
||||
@ -813,11 +808,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.SeriesSortName");
|
||||
return true;
|
||||
}
|
||||
if (query.SortBy.Contains(ItemSortBy.Studio, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.Studio");
|
||||
return true;
|
||||
}
|
||||
if (query.SortBy.Contains(ItemSortBy.VideoBitRate, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.VideoBitRate");
|
||||
@ -962,12 +952,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return true;
|
||||
}
|
||||
|
||||
if (query.OfficialRatings.Length > 0)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to OfficialRatings");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (query.IsMissing.HasValue)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to IsMissing");
|
||||
|
@ -1913,6 +1913,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
{
|
||||
return new Tuple<string, bool>("(select value from itemvalues where ItemId=Guid and Type=1 LIMIT 1)", false);
|
||||
}
|
||||
if (string.Equals(name, ItemSortBy.OfficialRating, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new Tuple<string, bool>("ParentalRatingValue", false);
|
||||
}
|
||||
if (string.Equals(name, ItemSortBy.Studio, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new Tuple<string, bool>("(select value from itemvalues where ItemId=Guid and Type=3 LIMIT 1)", false);
|
||||
}
|
||||
|
||||
return new Tuple<string, bool>(name, false);
|
||||
}
|
||||
@ -2573,6 +2581,20 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
|
||||
if (query.OfficialRatings.Length > 0)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
var index = 0;
|
||||
foreach (var item in query.OfficialRatings)
|
||||
{
|
||||
clauses.Add("OfficialRating=@OfficialRating" + index);
|
||||
cmd.Parameters.Add(cmd, "@OfficialRating" + index, DbType.String).Value = item;
|
||||
index++;
|
||||
}
|
||||
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
|
||||
if (query.MinParentalRating.HasValue)
|
||||
{
|
||||
whereClauses.Add("InheritedParentalRatingValue<=@MinParentalRating");
|
||||
|
Loading…
Reference in New Issue
Block a user