mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-09 17:28:48 +01:00
Surface extras for all versions
This commit is contained in:
@@ -2854,6 +2854,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
return LibraryManager.Sort(GetExtras().Where(e => e.ExtraType == Model.Entities.ExtraType.ThemeVideo), user, orderBy).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ids of the items whose owned extras belong to this item.
|
||||
/// </summary>
|
||||
/// <returns>An array containing the owner ids.</returns>
|
||||
protected virtual Guid[] GetExtraOwnerIds()
|
||||
{
|
||||
return [Id];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all extras associated with this item, sorted by <see cref="SortName"/>.
|
||||
/// </summary>
|
||||
@@ -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)]
|
||||
});
|
||||
|
||||
@@ -738,6 +738,19 @@ namespace MediaBrowser.Controller.Entities
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns>An array containing the owner ids.</returns>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user