Renamed watched to played (since we support audio)

pull/15/head
LukePulverenti Luke Pulverenti luke pulverenti 12 years ago
parent 31625fef36
commit 67d80b6f84

@ -38,6 +38,7 @@ namespace MediaBrowser.Api
dto.HasPrimaryImage = !string.IsNullOrEmpty(item.LogoImagePath);
dto.HasThumb = !string.IsNullOrEmpty(item.ThumbnailImagePath);
dto.Id = item.Id;
dto.IsRecentlyAdded = item.IsRecentlyAdded(user);
dto.IndexNumber = item.IndexNumber;
dto.IsFolder = item is Folder;
dto.LocalTrailerCount = item.LocalTrailers == null ? 0 : item.LocalTrailers.Count();

@ -96,5 +96,7 @@ namespace MediaBrowser.Model.DTO
{
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
}
public bool IsRecentlyAdded { get; set; }
}
}

@ -130,5 +130,13 @@ namespace MediaBrowser.Model.Entities
return null;
}
/// <summary>
/// Determines if the item is considered new based on user settings
/// </summary>
public bool IsRecentlyAdded(User user)
{
return (DateTime.Now - DateCreated).TotalDays < user.RecentItemDays;
}
}
}

@ -51,7 +51,7 @@ namespace MediaBrowser.Model.Entities
counts.RecentlyAddedItemCount = GetRecentlyAddedItems(recursiveChildren, user).Count();
counts.RecentlyAddedUnPlayedItemCount = GetRecentlyAddedUnplayedItems(recursiveChildren, user).Count();
counts.InProgressItemCount = GetInProgressItems(recursiveChildren, user).Count();
counts.WatchedPercentage = GetWatchedPercentage(recursiveChildren, user);
counts.PlayedPercentage = GetPlayedPercentage(recursiveChildren, user);
return counts;
}
@ -139,9 +139,7 @@ namespace MediaBrowser.Model.Entities
private static IEnumerable<BaseItem> GetRecentlyAddedItems(IEnumerable<BaseItem> itemSet, User user)
{
DateTime now = DateTime.Now;
return itemSet.Where(i => !(i is Folder) && (now - i.DateCreated).TotalDays < user.RecentItemDays);
return itemSet.Where(i => !(i is Folder) && i.IsRecentlyAdded(user));
}
private static IEnumerable<BaseItem> GetRecentlyAddedUnplayedItems(IEnumerable<BaseItem> itemSet, User user)
@ -169,7 +167,7 @@ namespace MediaBrowser.Model.Entities
});
}
private static decimal GetWatchedPercentage(IEnumerable<BaseItem> itemSet, User user)
private static decimal GetPlayedPercentage(IEnumerable<BaseItem> itemSet, User user)
{
itemSet = itemSet.Where(i => !(i is Folder));
@ -203,7 +201,7 @@ namespace MediaBrowser.Model.Entities
return totalPercent / itemSet.Count();
}
/// <summary>
/// Finds an item by ID, recursively
/// </summary>

@ -9,6 +9,6 @@ namespace MediaBrowser.Model.Entities
public int RecentlyAddedItemCount { get; set; }
public int RecentlyAddedUnPlayedItemCount { get; set; }
public int InProgressItemCount { get; set; }
public decimal WatchedPercentage { get; set; }
public decimal PlayedPercentage { get; set; }
}
}

Loading…
Cancel
Save