From 54eb7cb85537ef6959e3f1fab7871361b9bf8243 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 22 Apr 2014 13:25:54 -0400 Subject: update dlna profiles --- .../Collections/CollectionManager.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'MediaBrowser.Server.Implementations/Collections/CollectionManager.cs') 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 CollapseItemsWithinBoxSets(IEnumerable items, User user) + { + var itemsToCollapse = new List(); + var boxsets = new List(); + + var list = items.ToList(); + + foreach (var item in list.OfType()) + { + 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()).Concat(boxsets).Distinct(); + } } } -- cgit v1.2.3