Added IsFolder

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti 2012-08-19 20:14:12 -04:00
parent 0ec2ab5b7b
commit bbc88549ab
2 changed files with 19 additions and 3 deletions

View File

@ -131,6 +131,14 @@ namespace MediaBrowser.Model.Entities
return null; return null;
} }
public virtual bool IsFolder
{
get
{
return false;
}
}
/// <summary> /// <summary>
/// Determines if the item is considered new based on user settings /// Determines if the item is considered new based on user settings
/// </summary> /// </summary>

View File

@ -6,6 +6,14 @@ namespace MediaBrowser.Model.Entities
{ {
public class Folder : BaseItem public class Folder : BaseItem
{ {
public override bool IsFolder
{
get
{
return true;
}
}
public bool IsRoot { get; set; } public bool IsRoot { get; set; }
public BaseItem[] Children { get; set; } public BaseItem[] Children { get; set; }
@ -139,7 +147,7 @@ namespace MediaBrowser.Model.Entities
private static IEnumerable<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user) private static IEnumerable<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user)
{ {
return itemSet.Where(i => !(i is Folder) && i.IsRecentlyAdded(user)); return itemSet.Where(i => !(i.IsFolder) && i.IsRecentlyAdded(user));
} }
private static IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user) private static IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user)
@ -156,7 +164,7 @@ namespace MediaBrowser.Model.Entities
{ {
return itemSet.Where(i => return itemSet.Where(i =>
{ {
if (i is Folder) if (i.IsFolder)
{ {
return false; return false;
} }
@ -169,7 +177,7 @@ namespace MediaBrowser.Model.Entities
private static decimal GetPlayedPercentage(IEnumerable<BaseItem> itemSet, User user) private static decimal GetPlayedPercentage(IEnumerable<BaseItem> itemSet, User user)
{ {
itemSet = itemSet.Where(i => !(i is Folder)); itemSet = itemSet.Where(i => !(i.IsFolder));
if (!itemSet.Any()) if (!itemSet.Any())
{ {