From b337371a0c36d608bd442855e2aaf3be31ba1225 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Sun, 23 Jun 2024 11:40:40 -0400 Subject: [PATCH] Backport pull request #12024 from jellyfin/release-10.9.z Remove incomplete mediatype restriction from playlists Original-merge: 34a65980e31b7f2f45308a6247442c508d0d2098 Merged-by: crobibero Backported-by: Joshua M. Boniface --- Emby.Server.Implementations/Playlists/PlaylistManager.cs | 6 +++--- MediaBrowser.Controller/Playlists/Playlist.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs index 8a35b96b39..0fd9175dcc 100644 --- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs +++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs @@ -184,11 +184,11 @@ namespace Emby.Server.Implementations.Playlists return path; } - private IReadOnlyList GetPlaylistItems(IEnumerable itemIds, MediaType playlistMediaType, User user, DtoOptions options) + private IReadOnlyList GetPlaylistItems(IEnumerable itemIds, User user, DtoOptions options) { var items = itemIds.Select(_libraryManager.GetItemById).Where(i => i is not null); - return Playlist.GetPlaylistItems(playlistMediaType, items, user, options); + return Playlist.GetPlaylistItems(items, user, options); } public Task AddItemToPlaylistAsync(Guid playlistId, IReadOnlyCollection itemIds, Guid userId) @@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Playlists ?? throw new ArgumentException("No Playlist exists with Id " + playlistId); // Retrieve all the items to be added to the playlist - var newItems = GetPlaylistItems(newItemIds, playlist.MediaType, user, options) + var newItems = GetPlaylistItems(newItemIds, user, options) .Where(i => i.SupportsAddingToPlaylist); // Filter out duplicate items, if necessary diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index 6fc9a7e1bf..45aefacf6d 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -166,7 +166,7 @@ namespace MediaBrowser.Controller.Playlists return base.GetChildren(user, true, query); } - public static IReadOnlyList GetPlaylistItems(MediaType playlistMediaType, IEnumerable inputItems, User user, DtoOptions options) + public static IReadOnlyList GetPlaylistItems(IEnumerable inputItems, User user, DtoOptions options) { if (user is not null) { @@ -177,14 +177,14 @@ namespace MediaBrowser.Controller.Playlists foreach (var item in inputItems) { - var playlistItems = GetPlaylistItems(item, user, playlistMediaType, options); + var playlistItems = GetPlaylistItems(item, user, options); list.AddRange(playlistItems); } return list; } - private static IEnumerable GetPlaylistItems(BaseItem item, User user, MediaType mediaType, DtoOptions options) + private static IEnumerable GetPlaylistItems(BaseItem item, User user, DtoOptions options) { if (item is MusicGenre musicGenre) { @@ -216,7 +216,7 @@ namespace MediaBrowser.Controller.Playlists { Recursive = true, IsFolder = false, - MediaTypes = [mediaType], + MediaTypes = [MediaType.Audio, MediaType.Video], EnableTotalRecordCount = false, DtoOptions = options };