From 568e339ae890414f45d8ecb332f5a6bf68ec7baa Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 2 May 2016 13:11:45 -0400 Subject: [PATCH] update series pooling --- MediaBrowser.Controller/Entities/Folder.cs | 28 +++++++++++++++++++ MediaBrowser.Controller/Entities/TV/Season.cs | 7 ++++- .../Dto/DtoService.cs | 3 +- .../Persistence/SqliteItemRepository.cs | 2 +- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index fca2c6e43..f57e2fa17 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1578,8 +1578,36 @@ namespace MediaBrowser.Controller.Entities return !IsPlayed(user); } + [IgnoreDataMember] + public virtual bool SupportsUserDataFromChildren + { + get + { + // These are just far too slow. + if (this is ICollectionFolder) + { + return false; + } + if (this is UserView) + { + return false; + } + if (this is UserRootFolder) + { + return false; + } + + return true; + } + } + public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, User user) { + if (!SupportsUserDataFromChildren) + { + return; + } + var recursiveItemCount = 0; var unplayed = 0; diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 1f443071c..29db5fd55 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -125,10 +125,15 @@ namespace MediaBrowser.Controller.Entities.TV get { return LocationType == LocationType.Virtual && GetEpisodes().All(i => i.IsMissingEpisode); } } + private bool GetIsUnaired() + { + return GetEpisodes().All(i => i.IsUnaired); + } + [IgnoreDataMember] public bool IsUnaired { - get { return GetEpisodes().All(i => i.IsUnaired); } + get { return GetIsUnaired(); } } [IgnoreDataMember] diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index e8af0c3cb..af4c8675c 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -499,8 +499,7 @@ namespace MediaBrowser.Server.Implementations.Dto { dto.ChildCount = GetChildCount(folder, user); - // These are just far too slow. - if (!(folder is UserRootFolder) && !(folder is UserView) && !(folder is ICollectionFolder)) + if (!folder.SupportsUserDataFromChildren) { SetSpecialCounts(folder, user, dto, fields, syncProgress); } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 6959de8e6..e26a56ec0 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -82,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.Persistence private IDbCommand _updateInheritedRatingCommand; private IDbCommand _updateInheritedTagsCommand; - public const int LatestSchemaVersion = 68; + public const int LatestSchemaVersion = 69; /// /// Initializes a new instance of the class.