aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-04-22 13:25:54 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-04-22 13:25:54 -0400
commit54eb7cb85537ef6959e3f1fab7871361b9bf8243 (patch)
tree581c3f120c09c0acc2856c5fc684d00c467e5aa8 /MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
parent4331700747440cfa2c2df0cea1abcace9ed60019 (diff)
update dlna profiles
Diffstat (limited to 'MediaBrowser.Server.Implementations/Collections/CollectionManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Collections/CollectionManager.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
index c18856293..bbf692536 100644
--- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
+++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
@@ -227,5 +227,29 @@ namespace MediaBrowser.Server.Implementations.Collections
await collection.RefreshMetadata(CancellationToken.None).ConfigureAwait(false);
}
+
+ public IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, User user)
+ {
+ var itemsToCollapse = new List<ISupportsBoxSetGrouping>();
+ var boxsets = new List<BaseItem>();
+
+ var list = items.ToList();
+
+ foreach (var item in list.OfType<ISupportsBoxSetGrouping>())
+ {
+ var currentBoxSets = item.BoxSetIdList
+ .Select(i => _libraryManager.GetItemById(i))
+ .Where(i => i != null && i.IsVisible(user))
+ .ToList();
+
+ if (currentBoxSets.Count > 0)
+ {
+ itemsToCollapse.Add(item);
+ boxsets.AddRange(currentBoxSets);
+ }
+ }
+
+ return list.Except(itemsToCollapse.Cast<BaseItem>()).Concat(boxsets).Distinct();
+ }
}
}