added recursive unplayed count

This commit is contained in:
Luke Pulverenti 2013-06-08 13:04:17 -04:00
parent f7fd995f57
commit 8e19906043
3 changed files with 18 additions and 2 deletions

View File

@ -527,6 +527,7 @@ namespace MediaBrowser.Controller.Dto
{
var rcentlyAddedItemCount = 0;
var recursiveItemCount = 0;
var unplayed = 0;
double totalPercentPlayed = 0;
@ -543,12 +544,16 @@ namespace MediaBrowser.Controller.Dto
rcentlyAddedItemCount++;
}
var isUnplayed = true;
// Incrememt totalPercentPlayed
if (userdata != null)
{
if (userdata.Played)
{
totalPercentPlayed += 100;
isUnplayed = false;
}
else if (userdata.PlaybackPositionTicks > 0 && child.RunTimeTicks.HasValue && child.RunTimeTicks.Value > 0)
{
@ -557,10 +562,16 @@ namespace MediaBrowser.Controller.Dto
totalPercentPlayed += itemPercent;
}
}
if (isUnplayed)
{
unplayed++;
}
}
dto.RecursiveItemCount = recursiveItemCount;
dto.RecentlyAddedItemCount = rcentlyAddedItemCount;
dto.RecursiveUnplayedItemCount = unplayed;
if (recursiveItemCount > 0)
{

View File

@ -234,6 +234,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The recursive item count.</value>
public int? RecursiveItemCount { get; set; }
/// <summary>
/// Gets or sets the recursive unplayed item count.
/// </summary>
/// <value>The recursive unplayed item count.</value>
public int? RecursiveUnplayedItemCount { get; set; }
/// <summary>
/// Gets or sets the child count.
/// </summary>

View File

@ -1,5 +1,4 @@

using System;
using System;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto