update season filters

This commit is contained in:
Luke Pulverenti 2016-05-20 17:18:48 -04:00
parent 06a25a2557
commit 432c52f934
5 changed files with 8 additions and 50 deletions

View File

@ -415,17 +415,6 @@ namespace MediaBrowser.Api
private IEnumerable<Season> FilterVirtualSeasons(GetSeasons request, IEnumerable<Season> items) private IEnumerable<Season> FilterVirtualSeasons(GetSeasons request, IEnumerable<Season> items)
{ {
if (request.IsMissing.HasValue && request.IsVirtualUnaired.HasValue)
{
var isMissing = request.IsMissing.Value;
var isVirtualUnaired = request.IsVirtualUnaired.Value;
if (!isMissing && !isVirtualUnaired)
{
return items.Where(i => !i.IsMissingOrVirtualUnaired);
}
}
if (request.IsMissing.HasValue) if (request.IsMissing.HasValue)
{ {
var val = request.IsMissing.Value; var val = request.IsMissing.Value;

View File

@ -772,7 +772,7 @@ namespace MediaBrowser.Controller.Entities
return true; return true;
} }
} }
var supportsUserDataQueries = ConfigurationManager.Configuration.SchemaVersion >= 76; var supportsUserDataQueries = ConfigurationManager.Configuration.SchemaVersion >= 76;
if (query.SortBy != null && query.SortBy.Length > 0) if (query.SortBy != null && query.SortBy.Length > 0)
@ -1294,7 +1294,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Adds the children to list. /// Adds the children to list.
/// </summary> /// </summary>
private void AddChildrenToList(Dictionary<Guid,BaseItem> result, bool includeLinkedChildren, bool recursive, Func<BaseItem, bool> filter) private void AddChildrenToList(Dictionary<Guid, BaseItem> result, bool includeLinkedChildren, bool recursive, Func<BaseItem, bool> filter)
{ {
foreach (var child in Children) foreach (var child in Children)
{ {
@ -1525,14 +1525,12 @@ namespace MediaBrowser.Controller.Entities
User = user, User = user,
Recursive = true, Recursive = true,
IsFolder = false, IsFolder = false,
IsUnaired = false,
EnableTotalRecordCount = false EnableTotalRecordCount = false
}; };
if (!user.Configuration.DisplayMissingEpisodes) if (!user.Configuration.DisplayMissingEpisodes || !user.Configuration.DisplayUnairedEpisodes)
{ {
query.IsMissing = false; query.ExcludeLocationTypes = new[] { LocationType.Virtual };
} }
var itemsResult = await GetItems(query).ConfigureAwait(false); var itemsResult = await GetItems(query).ConfigureAwait(false);

View File

@ -152,12 +152,6 @@ namespace MediaBrowser.Controller.Entities.TV
get { return LocationType == LocationType.Virtual && IsUnaired; } get { return LocationType == LocationType.Virtual && IsUnaired; }
} }
[IgnoreDataMember]
public bool IsMissingOrVirtualUnaired
{
get { return (IsMissingSeason ?? false) || (LocationType == LocationType.Virtual && IsUnaired); }
}
[IgnoreDataMember] [IgnoreDataMember]
public bool IsSpecialSeason public bool IsSpecialSeason
{ {

View File

@ -238,20 +238,13 @@ namespace MediaBrowser.Controller.Entities.TV
seasons = LibraryManager.Sort(base.GetChildren(user, true), user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).OfType<Season>(); seasons = LibraryManager.Sort(base.GetChildren(user, true), user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).OfType<Season>();
} }
if (!includeMissingSeasons && !includeVirtualUnaired) if (!includeMissingSeasons)
{ {
seasons = seasons.Where(i => !i.IsMissingOrVirtualUnaired); seasons = seasons.Where(i => !(i.IsMissingSeason ?? false));
} }
else if (!includeVirtualUnaired)
{ {
if (!includeMissingSeasons) seasons = seasons.Where(i => !i.IsVirtualUnaired);
{
seasons = seasons.Where(i => !(i.IsMissingSeason ?? false));
}
if (!includeVirtualUnaired)
{
seasons = seasons.Where(i => !i.IsVirtualUnaired);
}
} }
return seasons; return seasons;

View File

@ -1134,22 +1134,6 @@ namespace MediaBrowser.Controller.Entities
bool? isVirtualUnaired, bool? isVirtualUnaired,
bool? isUnaired) bool? isUnaired)
{ {
if (isMissing.HasValue && isVirtualUnaired.HasValue)
{
if (!isMissing.Value && !isVirtualUnaired.Value)
{
return items.Where(i =>
{
var e = i as Season;
if (e != null)
{
return !e.IsMissingOrVirtualUnaired;
}
return true;
});
}
}
if (isMissing.HasValue) if (isMissing.HasValue)
{ {
var val = isMissing.Value; var val = isMissing.Value;