diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 6868418d3b..b2788abe06 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1413,59 +1413,33 @@ namespace MediaBrowser.Controller.Entities return; } - var recursiveItemCount = 0; - var unplayed = 0; - - double totalPercentPlayed = 0; - - var itemsResult = GetItems(new InternalItemsQuery(user) + var playedQueryResult = GetItems(new InternalItemsQuery(user) { Recursive = true, IsFolder = false, - ExcludeLocationTypes = new[] { LocationType.Virtual }, - EnableTotalRecordCount = false + IsVirtualItem = false, + EnableTotalRecordCount = true, + Limit = 0, + IsPlayed = true }).Result; - var children = itemsResult.Items; - - // Loop through each recursive child - foreach (var child in children) + var allItemsQueryResult = GetItems(new InternalItemsQuery(user) { - recursiveItemCount++; - - var isUnplayed = true; - - var itemUserData = UserDataManager.GetUserData(user, child); - - // Incrememt totalPercentPlayed - if (itemUserData != null) - { - if (itemUserData.Played) - { - totalPercentPlayed += 100; - - isUnplayed = false; - } - else if (itemUserData.PlaybackPositionTicks > 0 && child.RunTimeTicks.HasValue && child.RunTimeTicks.Value > 0) - { - double itemPercent = itemUserData.PlaybackPositionTicks; - itemPercent /= child.RunTimeTicks.Value; - totalPercentPlayed += itemPercent; - } - } + Recursive = true, + IsFolder = false, + IsVirtualItem = false, + EnableTotalRecordCount = true, + Limit = 0 - if (isUnplayed) - { - unplayed++; - } - } + }).Result; - dto.UnplayedItemCount = unplayed; + double recursiveItemCount = allItemsQueryResult.TotalRecordCount; + double playedCount = playedQueryResult.TotalRecordCount; if (recursiveItemCount > 0) { - dto.PlayedPercentage = totalPercentPlayed / recursiveItemCount; + dto.PlayedPercentage = (playedCount / recursiveItemCount) * 100; dto.Played = dto.PlayedPercentage.Value >= 100; } } diff --git a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs index c2606dc4b2..3dad7e7fce 100644 --- a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs @@ -208,7 +208,6 @@ namespace MediaBrowser.Server.Implementations.Library var dto = GetUserItemDataDto(userData); item.FillUserDataDtoValues(dto, userData, user); - return dto; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index d00112d07c..d536d3004f 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -66,7 +66,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings { CancellationToken = cancellationToken, Url = path, - Progress = new Progress() + Progress = new Progress(), + EnableHttpCompression = false }).ConfigureAwait(false); diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index cc78656be3..066a8c3ca6 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -46,7 +46,7 @@ ..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll - ..\packages\Emby.XmlTv.1.0.0.51\lib\net45\Emby.XmlTv.dll + ..\packages\Emby.XmlTv.1.0.0.53\lib\net45\Emby.XmlTv.dll True diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index badc3f2c1f..42fc51a631 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -1,7 +1,7 @@  - +