Added CumulativeRunTimeTicks

pull/702/head
Luke Pulverenti 12 years ago
parent 4c19b9382f
commit bb721f610b

@ -277,12 +277,16 @@ namespace MediaBrowser.Controller.Dto
if (item.IsFolder) if (item.IsFolder)
{ {
if (fields.Contains(ItemFields.ItemCounts)) var hasItemCounts = fields.Contains(ItemFields.ItemCounts);
if (hasItemCounts || fields.Contains(ItemFields.CumulativeRunTimeTicks))
{ {
var folder = (Folder)item; var folder = (Folder)item;
// Skip sorting since all we want is a count if (hasItemCounts)
dto.ChildCount = folder.GetChildren(user, true).Count(); {
dto.ChildCount = folder.GetChildren(user, true).Count();
}
SetSpecialCounts(folder, user, dto, _userDataRepository); SetSpecialCounts(folder, user, dto, _userDataRepository);
} }
@ -749,6 +753,7 @@ namespace MediaBrowser.Controller.Dto
var rcentlyAddedItemCount = 0; var rcentlyAddedItemCount = 0;
var recursiveItemCount = 0; var recursiveItemCount = 0;
var unplayed = 0; var unplayed = 0;
long runtime = 0;
double totalPercentPlayed = 0; double totalPercentPlayed = 0;
@ -788,6 +793,8 @@ namespace MediaBrowser.Controller.Dto
{ {
unplayed++; unplayed++;
} }
runtime += child.RunTimeTicks ?? 0;
} }
dto.RecursiveItemCount = recursiveItemCount; dto.RecursiveItemCount = recursiveItemCount;
@ -798,6 +805,11 @@ namespace MediaBrowser.Controller.Dto
{ {
dto.PlayedPercentage = totalPercentPlayed / recursiveItemCount; dto.PlayedPercentage = totalPercentPlayed / recursiveItemCount;
} }
if (runtime > 0)
{
dto.CumulativeRunTimeTicks = runtime;
}
} }
/// <summary> /// <summary>
@ -833,7 +845,9 @@ namespace MediaBrowser.Controller.Dto
)).ConfigureAwait(false); )).ConfigureAwait(false);
var dictionary = entities.Where(i => i != null).ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase); var dictionary = entities.Where(i => i != null)
.Distinct()
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
for (var i = 0; i < people.Count; i++) for (var i = 0; i < people.Count; i++)
{ {

@ -24,6 +24,7 @@ namespace MediaBrowser.Controller.Resolvers
".m2ts", ".m2ts",
".img", ".img",
".iso", ".iso",
".mk3d",
".ts", ".ts",
".rmvb", ".rmvb",
".mov", ".mov",

@ -113,6 +113,12 @@ namespace MediaBrowser.Model.Dto
/// </summary> /// </summary>
/// <value>The original run time ticks.</value> /// <value>The original run time ticks.</value>
public long? OriginalRunTimeTicks { get; set; } public long? OriginalRunTimeTicks { get; set; }
/// <summary>
/// Gets or sets the cumulative run time ticks.
/// </summary>
/// <value>The cumulative run time ticks.</value>
public long? CumulativeRunTimeTicks { get; set; }
/// <summary> /// <summary>
/// Gets or sets the run time ticks. /// Gets or sets the run time ticks.

@ -21,6 +21,11 @@ namespace MediaBrowser.Model.Querying
/// </summary> /// </summary>
CriticRatingSummary, CriticRatingSummary,
/// <summary>
/// The cumulative run time ticks
/// </summary>
CumulativeRunTimeTicks,
/// <summary> /// <summary>
/// The custom rating /// The custom rating
/// </summary> /// </summary>

Loading…
Cancel
Save