From 2e7d52f3a19bd41e0c042787138228f0d4856ab1 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Thu, 4 Jun 2026 02:58:20 +0200 Subject: [PATCH] Surface extras for all versions --- MediaBrowser.Controller/Entities/BaseItem.cs | 13 +++++++++++-- MediaBrowser.Controller/Entities/Video.cs | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 69f7966bb5..0534239af6 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -2854,6 +2854,15 @@ namespace MediaBrowser.Controller.Entities return LibraryManager.Sort(GetExtras().Where(e => e.ExtraType == Model.Entities.ExtraType.ThemeVideo), user, orderBy).ToArray(); } + /// + /// Gets the ids of the items whose owned extras belong to this item. + /// + /// An array containing the owner ids. + protected virtual Guid[] GetExtraOwnerIds() + { + return [Id]; + } + /// /// Get all extras associated with this item, sorted by . /// @@ -2862,7 +2871,7 @@ namespace MediaBrowser.Controller.Entities { return LibraryManager.GetItemList(new InternalItemsQuery() { - OwnerIds = [Id], + OwnerIds = GetExtraOwnerIds(), OrderBy = [(ItemSortBy.SortName, SortOrder.Ascending)] }); } @@ -2876,7 +2885,7 @@ namespace MediaBrowser.Controller.Entities { return LibraryManager.GetItemList(new InternalItemsQuery() { - OwnerIds = [Id], + OwnerIds = GetExtraOwnerIds(), ExtraTypes = extraTypes.ToArray(), OrderBy = [(ItemSortBy.SortName, SortOrder.Ascending)] }); diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index b851e028b7..ecda0c9897 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -738,6 +738,19 @@ namespace MediaBrowser.Controller.Entities }).FirstOrDefault(); } + /// + /// Gets the ids of the items whose owned extras belong to this item. + /// Extras are linked to a single version but need tp be surfaced for all versions. + /// + /// An array containing the owner ids. + protected override Guid[] GetExtraOwnerIds() + { + return GetAllItemsForMediaSources() + .Select(i => i.Item.Id) + .Distinct() + .ToArray(); + } + protected override IEnumerable<(BaseItem Item, MediaSourceType MediaSourceType)> GetAllItemsForMediaSources() { var primary = PrimaryVersionId.HasValue