diff options
| author | Bond-009 <bond.009@outlook.com> | 2026-05-23 19:21:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-23 19:21:29 +0200 |
| commit | 4897cc7e2e71d5988aa14f0fe97e8b36feb3bcbc (patch) | |
| tree | 3caf933ac07d438d8a7d51879c3e506b563fa090 /Jellyfin.Api/Controllers/ItemsController.cs | |
| parent | a3849819c27d9a99d1fc537af39e2064142594c0 (diff) | |
| parent | 4361e073eddc3c01f761ef9ac6e5f319f6ad9485 (diff) | |
Merge pull request #16893 from Shadowghost/fix-playlist-filter
Add support for filtering playlists by parentId
Diffstat (limited to 'Jellyfin.Api/Controllers/ItemsController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ItemsController.cs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Jellyfin.Api/Controllers/ItemsController.cs b/Jellyfin.Api/Controllers/ItemsController.cs index 82a1bdebd7..363af9e43b 100644 --- a/Jellyfin.Api/Controllers/ItemsController.cs +++ b/Jellyfin.Api/Controllers/ItemsController.cs @@ -14,6 +14,7 @@ using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; @@ -280,15 +281,19 @@ public class ItemsController : BaseJellyfinApiController var item = _libraryManager.GetParentItem(parentId, userId); QueryResult<BaseItem> result; - Guid[] boxSetLinkedChildAncestorIds = []; + Guid[] linkedChildAncestorIds = []; if (includeItemTypes.Length == 1 - && includeItemTypes[0] == BaseItemKind.BoxSet - && item is not BoxSet) + && (includeItemTypes[0] == BaseItemKind.BoxSet || includeItemTypes[0] == BaseItemKind.Playlist) + && item is not BoxSet + && item is not Playlist) { - var isBoxSetsLibrary = item is IHasCollectionType hct && hct.CollectionType == CollectionType.boxsets; - if (parentId.HasValue && item is not UserRootFolder && !isBoxSetsLibrary) + var itemCollectionType = item is IHasCollectionType hct ? hct.CollectionType : null; + 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; @@ -412,7 +417,7 @@ public class ItemsController : BaseJellyfinApiController MaxPremiereDate = maxPremiereDate?.ToUniversalTime(), AudioLanguages = audioLanguages, SubtitleLanguages = subtitleLanguages, - LinkedChildAncestorIds = boxSetLinkedChildAncestorIds, + LinkedChildAncestorIds = linkedChildAncestorIds, }; if (ids.Length != 0 || !string.IsNullOrWhiteSpace(searchTerm)) |
