update db querying

This commit is contained in:
Luke Pulverenti
2016-03-20 15:53:22 -04:00
parent 6807b2dd71
commit b4ea519395
11 changed files with 144 additions and 180 deletions

View File

@@ -1094,13 +1094,6 @@ namespace MediaBrowser.Controller.Entities
return true;
}
// Apply year filter
if (query.Years.Length > 0)
{
Logger.Debug("Query requires post-filtering due to Years");
return true;
}
// Apply official rating filter
if (query.OfficialRatings.Length > 0)
{
@@ -1139,12 +1132,6 @@ namespace MediaBrowser.Controller.Entities
return true;
}
if (query.Years.Length > 0)
{
Logger.Debug("Query requires post-filtering due to Years");
return true;
}
if (query.OfficialRatings.Length > 0)
{
Logger.Debug("Query requires post-filtering due to OfficialRatings");
@@ -1205,6 +1192,18 @@ namespace MediaBrowser.Controller.Entities
return true;
}
if (query.AirDays.Length > 0)
{
Logger.Debug("Query requires post-filtering due to AirDays");
return true;
}
if (query.SeriesStatuses.Length > 0)
{
Logger.Debug("Query requires post-filtering due to SeriesStatuses");
return true;
}
return false;
}

View File

@@ -103,17 +103,18 @@ namespace MediaBrowser.Controller.Entities
public string[] ChannelIds { get; set; }
internal List<Guid> ItemIdsFromPersonFilters { get; set; }
public int? ParentIndexNumber { get; set; }
public int? MaxParentalRating { get; set; }
public bool? IsCurrentSchema { get; set; }
public bool? HasDeadParentId { get; set; }
public bool? IsOffline { get; set; }
public LocationType? LocationType { get; set; }
public Guid? ParentId { get; set; }
public string[] AncestorIds { get; set; }
public string[] TopParentIds { get; set; }
public LocationType[] LocationTypes { get; set; }
public LocationType[] ExcludeLocationTypes { get; set; }
public string[] PresetViews { get; set; }
public SourceType[] SourceTypes { get; set; }
@@ -121,6 +122,9 @@ namespace MediaBrowser.Controller.Entities
public TrailerType[] TrailerTypes { get; set; }
public TrailerType[] ExcludeTrailerTypes { get; set; }
public DayOfWeek[] AirDays { get; set; }
public SeriesStatus[] SeriesStatuses { get; set; }
public InternalItemsQuery()
{
BlockUnratedItems = new UnratedItem[] { };
@@ -144,12 +148,15 @@ namespace MediaBrowser.Controller.Entities
AncestorIds = new string[] { };
TopParentIds = new string[] { };
ExcludeTags = new string[] { };
LocationTypes = new LocationType[] { };
ExcludeLocationTypes = new LocationType[] { };
PresetViews = new string[] { };
SourceTypes = new SourceType[] { };
ExcludeSourceTypes = new SourceType[] { };
TrailerTypes = new TrailerType[] { };
ExcludeTrailerTypes = new TrailerType[] { };
AirDays = new DayOfWeek[] { };
SeriesStatuses = new SeriesStatus[] { };
}
public InternalItemsQuery(User user)

View File

@@ -1709,6 +1709,34 @@ namespace MediaBrowser.Controller.Entities
}
}
if (query.ParentIndexNumber.HasValue)
{
var filterValue = query.ParentIndexNumber.Value;
if (item.ParentIndexNumber.HasValue && item.ParentIndexNumber.Value != filterValue)
{
return false;
}
}
if (query.AirDays.Length > 0)
{
var ok = new[] { item }.OfType<Series>().Any(p => p.AirDays != null && query.AirDays.Any(d => p.AirDays.Contains(d)));
if (!ok)
{
return false;
}
}
if (query.SeriesStatuses.Length > 0)
{
var ok = new[] { item }.OfType<Series>().Any(p => p.Status.HasValue && query.SeriesStatuses.Contains(p.Status.Value));
if (!ok)
{
return false;
}
}
return true;
}