aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Dto/DtoService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Dto/DtoService.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs33
1 files changed, 10 insertions, 23 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index 0aec3230d..32610a6ad 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -499,6 +499,16 @@ namespace MediaBrowser.Server.Implementations.Dto
}
}
+ if (fields.Contains(ItemFields.CumulativeRunTimeTicks))
+ {
+ dto.CumulativeRunTimeTicks = dto.RunTimeTicks;
+ }
+
+ if (fields.Contains(ItemFields.DateLastMediaAdded))
+ {
+ dto.DateLastMediaAdded = folder.DateLastMediaAdded;
+ }
+
dto.UserData.Played = dto.UserData.PlayedPercentage.HasValue && dto.UserData.PlayedPercentage.Value >= 100;
}
@@ -1613,9 +1623,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{
var recursiveItemCount = 0;
var unplayed = 0;
- long runtime = 0;
- DateTime? dateLastMediaAdded = null;
double totalPercentPlayed = 0;
double totalSyncPercent = 0;
var addSyncInfo = fields.Contains(ItemFields.SyncInfo);
@@ -1632,15 +1640,6 @@ namespace MediaBrowser.Server.Implementations.Dto
// Loop through each recursive child
foreach (var child in children)
{
- if (!dateLastMediaAdded.HasValue)
- {
- dateLastMediaAdded = child.DateCreated;
- }
- else
- {
- dateLastMediaAdded = new[] { dateLastMediaAdded.Value, child.DateCreated }.Max();
- }
-
var userdata = _userDataRepository.GetUserData(user, child);
recursiveItemCount++;
@@ -1669,8 +1668,6 @@ namespace MediaBrowser.Server.Implementations.Dto
unplayed++;
}
- runtime += child.RunTimeTicks ?? 0;
-
if (addSyncInfo)
{
double percent = 0;
@@ -1709,16 +1706,6 @@ namespace MediaBrowser.Server.Implementations.Dto
}
}
}
-
- if (runtime > 0 && fields.Contains(ItemFields.CumulativeRunTimeTicks))
- {
- dto.CumulativeRunTimeTicks = runtime;
- }
-
- if (fields.Contains(ItemFields.DateLastMediaAdded))
- {
- dto.DateLastMediaAdded = dateLastMediaAdded;
- }
}
/// <summary>