Also share sub setbox

Cette révision appartient à :
2026-09-19 16:58:31 +02:00
Parent 4450906da9
révision 4ee9365b44
+31 -5
Voir le fichier
@@ -8,6 +8,7 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MediaBrowser.Controller.Entities.Movies;
namespace Jellyfin.Plugin.ShareLinks.Services; namespace Jellyfin.Plugin.ShareLinks.Services;
@@ -147,13 +148,38 @@ public sealed class ItemTagService
private static List<BaseItem> BuildTagTreeTargets(BaseItem item) private static List<BaseItem> BuildTagTreeTargets(BaseItem item)
{ {
var targets = new List<BaseItem> { item }; var targets = new List<BaseItem> { item };
CollectDescendants(item, targets, new HashSet<Guid> { item.Id });
if (item is Folder folder) return targets;
{
targets.AddRange(folder.GetRecursiveChildren());
} }
return targets; private static void CollectDescendants(BaseItem item, List<BaseItem> targets, HashSet<Guid> seen)
{
IEnumerable<BaseItem> children = item switch
{
// A BoxSet's members are logical links, not real ParentId children -
// GetRecursiveChildren() does not follow LinkedChildren of a nested
// BoxSet, so each level has to be resolved and recursed into by hand.
BoxSet boxSet => boxSet.GetLinkedChildren(),
Folder folder => folder.GetRecursiveChildren(),
_ => Enumerable.Empty<BaseItem>()
};
foreach (var child in children)
{
if (!seen.Add(child.Id))
{
continue;
}
targets.Add(child);
// GetRecursiveChildren() already walks a physical folder tree fully,
// so only a BoxSet child (nested collection) needs an extra pass.
if (child is BoxSet)
{
CollectDescendants(child, targets, seen);
}
}
} }
/// <summary> /// <summary>