aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-02 10:16:13 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-02 10:16:13 -0400
commitdcc057f3242fb44a15006e5b13a2c7a2662dd2cd (patch)
treef8db84118964bb4e2093c282aba78c8ca1e8ea39
parentc957f202cc1fefb174377b99495b329a6cb9ee72 (diff)
GetById fixes
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 84055cea7..5cbe8ae18 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -267,10 +267,22 @@ namespace MediaBrowser.Server.Implementations.Library
items.AddRange(specialFeatures);
items.AddRange(localTrailers);
- // Can't add these right now because there could be separate instances with the same id.
- //items.AddRange(_userManager.Users.Select(i => i.RootFolder).Distinct().ToList());
+ // Need to use DistinctBy Id because there could be multiple instances with the same id
+ // due to sharing the default library
+ var userRootFolders = _userManager.Users.Select(i => i.RootFolder)
+ .DistinctBy(i => i.Id)
+ .ToList();
+
+ items.AddRange(userRootFolders);
+
+ // Get all user collection folders
+ var userFolders =
+ _userManager.Users.SelectMany(i => i.RootFolder.Children)
+ .Where(i => !(i is BasePluginFolder))
+ .DistinctBy(i => i.Id)
+ .ToList();
- items.AddRange(_userManager.Users.SelectMany(i => i.RootFolder.Children).Where(i => !(i is BasePluginFolder)).Distinct().ToList());
+ items.AddRange(userFolders);
return new ConcurrentDictionary<Guid,BaseItem>(items.ToDictionary(i => i.Id));
}