mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-12 02:30:23 +01:00
Merge pull request #16893 from Shadowghost/fix-playlist-filter
Add support for filtering playlists by parentId
This commit is contained in:
@@ -14,6 +14,7 @@ using MediaBrowser.Controller.Dto;
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
@@ -280,15 +281,19 @@ public class ItemsController : BaseJellyfinApiController
|
|||||||
var item = _libraryManager.GetParentItem(parentId, userId);
|
var item = _libraryManager.GetParentItem(parentId, userId);
|
||||||
QueryResult<BaseItem> result;
|
QueryResult<BaseItem> result;
|
||||||
|
|
||||||
Guid[] boxSetLinkedChildAncestorIds = [];
|
Guid[] linkedChildAncestorIds = [];
|
||||||
if (includeItemTypes.Length == 1
|
if (includeItemTypes.Length == 1
|
||||||
&& includeItemTypes[0] == BaseItemKind.BoxSet
|
&& (includeItemTypes[0] == BaseItemKind.BoxSet || includeItemTypes[0] == BaseItemKind.Playlist)
|
||||||
&& item is not BoxSet)
|
&& item is not BoxSet
|
||||||
|
&& item is not Playlist)
|
||||||
{
|
{
|
||||||
var isBoxSetsLibrary = item is IHasCollectionType hct && hct.CollectionType == CollectionType.boxsets;
|
var itemCollectionType = item is IHasCollectionType hct ? hct.CollectionType : null;
|
||||||
if (parentId.HasValue && item is not UserRootFolder && !isBoxSetsLibrary)
|
var targetCollectionType = includeItemTypes[0] == BaseItemKind.BoxSet
|
||||||
|
? CollectionType.boxsets
|
||||||
|
: CollectionType.playlists;
|
||||||
|
if (parentId.HasValue && item is not UserRootFolder && itemCollectionType != targetCollectionType)
|
||||||
{
|
{
|
||||||
boxSetLinkedChildAncestorIds = [parentId.Value];
|
linkedChildAncestorIds = [parentId.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
parentId = null;
|
parentId = null;
|
||||||
@@ -412,7 +417,7 @@ public class ItemsController : BaseJellyfinApiController
|
|||||||
MaxPremiereDate = maxPremiereDate?.ToUniversalTime(),
|
MaxPremiereDate = maxPremiereDate?.ToUniversalTime(),
|
||||||
AudioLanguages = audioLanguages,
|
AudioLanguages = audioLanguages,
|
||||||
SubtitleLanguages = subtitleLanguages,
|
SubtitleLanguages = subtitleLanguages,
|
||||||
LinkedChildAncestorIds = boxSetLinkedChildAncestorIds,
|
LinkedChildAncestorIds = linkedChildAncestorIds,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ids.Length != 0 || !string.IsNullOrWhiteSpace(searchTerm))
|
if (ids.Length != 0 || !string.IsNullOrWhiteSpace(searchTerm))
|
||||||
|
|||||||
Reference in New Issue
Block a user