From f3539686bd7ff6c748a0a9441086538081fa8903 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 11 Oct 2014 16:38:13 -0400 Subject: add device upload options --- .../Library/UserViewManager.cs | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library/UserViewManager.cs') diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs index 4beb34e4f..b12ae32a8 100644 --- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs @@ -60,41 +60,45 @@ namespace MediaBrowser.Server.Implementations.Library var standaloneFolders = folders.Where(i => UserView.IsExcludedFromGrouping(i) || excludeFolderIds.Contains(i.Id)).ToList(); - list.AddRange(standaloneFolders); - - var recursiveChildren = folders + var foldersWithViewTypes = folders .Except(standaloneFolders) - .SelectMany(i => i.GetRecursiveChildren(user, false)) + .OfType() .ToList(); - if (recursiveChildren.OfType().Any()) + list.AddRange(standaloneFolders); + + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) || + foldersWithViewTypes.Any(i => string.IsNullOrWhiteSpace(i.CollectionType))) { list.Add(await GetUserView(CollectionType.TvShows, user, string.Empty, cancellationToken).ConfigureAwait(false)); } - if (recursiveChildren.OfType().Any() || - recursiveChildren.OfType().Any()) + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase)) || + foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))) { list.Add(await GetUserView(CollectionType.Music, user, string.Empty, cancellationToken).ConfigureAwait(false)); } - if (recursiveChildren.OfType().Any()) + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase)) || + foldersWithViewTypes.Any(i => string.IsNullOrWhiteSpace(i.CollectionType))) { list.Add(await GetUserView(CollectionType.Movies, user, string.Empty, cancellationToken).ConfigureAwait(false)); } - if (recursiveChildren.OfType().Any()) + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase))) { list.Add(await GetUserView(CollectionType.Games, user, string.Empty, cancellationToken).ConfigureAwait(false)); } if (user.Configuration.DisplayCollectionsView && - recursiveChildren.OfType().Any()) + folders + .Except(standaloneFolders) + .SelectMany(i => i.GetRecursiveChildren(user, false)).OfType().Any()) { list.Add(await GetUserView(CollectionType.BoxSets, user, string.Empty, cancellationToken).ConfigureAwait(false)); } - if (recursiveChildren.OfType().Any()) + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase))) { list.Add(_playlists.GetPlaylistsFolder(user.Id.ToString("N"))); } -- cgit v1.2.3