diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-11-21 12:29:18 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-21 12:29:18 -0500 |
| commit | f80cc1bbd4145a682234d4d1d286c70f562f36bd (patch) | |
| tree | 2ecc0e11aa1f394295f6269069da5ed6b9ed0667 /Emby.Server.Implementations/Library/UserViewManager.cs | |
| parent | b2ea3272e70a0f520133ee6a74d958e044d4392e (diff) | |
| parent | 1acebd992229ee9bd6e7677f68174672fae53622 (diff) | |
Merge pull request #2299 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Library/UserViewManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/UserViewManager.cs | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs index b93f565a3..f7cc8bb73 100644 --- a/Emby.Server.Implementations/Library/UserViewManager.cs +++ b/Emby.Server.Implementations/Library/UserViewManager.cs @@ -245,20 +245,26 @@ namespace Emby.Server.Implementations.Library var includeItemTypes = request.IncludeItemTypes; var limit = request.Limit ?? 10; - var parentIds = string.IsNullOrEmpty(parentId) - ? new string[] { } - : new[] { parentId }; + var parents = new List<BaseItem>(); - if (parentIds.Length == 0) + if (!string.IsNullOrWhiteSpace(parentId)) { - parentIds = user.RootFolder.GetChildren(user, true) - .OfType<Folder>() - .Select(i => i.Id.ToString("N")) - .Where(i => !user.Configuration.LatestItemsExcludes.Contains(i)) - .ToArray(); + var parent = _libraryManager.GetItemById(parentId) as Folder; + if (parent != null) + { + parents.Add(parent); + } + } + + if (parents.Count == 0) + { + parents = user.RootFolder.GetChildren(user, true) + .Where(i => i is Folder) + .Where(i => !user.Configuration.LatestItemsExcludes.Contains(i.Id.ToString("N"))) + .ToList(); } - if (parentIds.Length == 0) + if (parents.Count == 0) { return new List<BaseItem>(); } @@ -283,10 +289,10 @@ namespace Emby.Server.Implementations.Library ExcludeItemTypes = excludeItemTypes, ExcludeLocationTypes = new[] { LocationType.Virtual }, Limit = limit * 5, - SourceTypes = parentIds.Length == 0 ? new[] { SourceType.Library } : new SourceType[] { }, + SourceTypes = parents.Count == 0 ? new[] { SourceType.Library } : new SourceType[] { }, IsPlayed = request.IsPlayed - }, parentIds); + }, parents); } } } |
