|
|
@ -121,7 +121,7 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<BoxSet> GetCollections(User user)
|
|
|
|
private IEnumerable<BoxSet> GetCollections(User user)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var folder = GetCollectionsFolder(false).Result;
|
|
|
|
var folder = GetCollectionsFolder(false).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
|
|
return folder == null
|
|
|
|
return folder == null
|
|
|
|
? Enumerable.Empty<BoxSet>()
|
|
|
|
? Enumerable.Empty<BoxSet>()
|
|
|
@ -316,11 +316,11 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var results = new Dictionary<Guid, BaseItem>();
|
|
|
|
var results = new Dictionary<Guid, BaseItem>();
|
|
|
|
|
|
|
|
|
|
|
|
var allBoxsets = GetCollections(user).ToList();
|
|
|
|
var allBoxSets = GetCollections(user).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in items)
|
|
|
|
foreach (var item in items)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!(item is ISupportsBoxSetGrouping))
|
|
|
|
if (item is not ISupportsBoxSetGrouping)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
results[item.Id] = item;
|
|
|
|
results[item.Id] = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -328,34 +328,45 @@ namespace Emby.Server.Implementations.Collections
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var itemId = item.Id;
|
|
|
|
var itemId = item.Id;
|
|
|
|
|
|
|
|
|
|
|
|
var currentBoxSets = allBoxsets
|
|
|
|
var itemIsInBoxSet = false;
|
|
|
|
.Where(i => i.ContainsLinkedChildByItemId(itemId))
|
|
|
|
foreach (var boxSet in allBoxSets)
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentBoxSets.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var boxset in currentBoxSets)
|
|
|
|
if (!boxSet.ContainsLinkedChildByItemId(itemId))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
results[boxset.Id] = boxset;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
itemIsInBoxSet = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results.TryAdd(boxSet.Id, boxSet);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// skip any item that is in a box set
|
|
|
|
|
|
|
|
if (itemIsInBoxSet)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
var alreadyInResults = false;
|
|
|
|
|
|
|
|
// this is kind of a performance hack because only Video has alternate versions that should be in a box set?
|
|
|
|
|
|
|
|
if (item is Video video)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var alreadyInResults = false;
|
|
|
|
foreach (var childId in video.GetLocalAlternateVersionIds())
|
|
|
|
foreach (var child in item.GetMediaSources(true))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Guid.TryParse(child.Id, out var id) && results.ContainsKey(id))
|
|
|
|
if (!results.ContainsKey(childId))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
alreadyInResults = true;
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!alreadyInResults)
|
|
|
|
alreadyInResults = true;
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
results[item.Id] = item;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!alreadyInResults)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
results[itemId] = item;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|