diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs index 6d5ae0326..2d2cbea5a 100644 --- a/MediaBrowser.Controller/Dto/DtoBuilder.cs +++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs @@ -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) { diff --git a/MediaBrowser.Model/DTO/BaseItemDto.cs b/MediaBrowser.Model/DTO/BaseItemDto.cs index 9bb91db7f..4739590bf 100644 --- a/MediaBrowser.Model/DTO/BaseItemDto.cs +++ b/MediaBrowser.Model/DTO/BaseItemDto.cs @@ -234,6 +234,12 @@ namespace MediaBrowser.Model.Dto /// The recursive item count. public int? RecursiveItemCount { get; set; } + /// + /// Gets or sets the recursive unplayed item count. + /// + /// The recursive unplayed item count. + public int? RecursiveUnplayedItemCount { get; set; } + /// /// Gets or sets the child count. /// diff --git a/MediaBrowser.Model/DTO/ImageOptions.cs b/MediaBrowser.Model/DTO/ImageOptions.cs index a800b87d1..d6a9fd0ff 100644 --- a/MediaBrowser.Model/DTO/ImageOptions.cs +++ b/MediaBrowser.Model/DTO/ImageOptions.cs @@ -1,5 +1,4 @@ - -using System; +using System; using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Dto