Backport pull request #12024 from jellyfin/release-10.9.z

Remove incomplete mediatype restriction from playlists

Original-merge: 34a65980e3

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Shadowghost 2024-06-23 11:40:40 -04:00 committed by Joshua M. Boniface
parent a1b9f90d7d
commit b337371a0c
2 changed files with 7 additions and 7 deletions

View File

@ -184,11 +184,11 @@ namespace Emby.Server.Implementations.Playlists
return path; return path;
} }
private IReadOnlyList<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, MediaType playlistMediaType, User user, DtoOptions options) private IReadOnlyList<BaseItem> GetPlaylistItems(IEnumerable<Guid> itemIds, User user, DtoOptions options)
{ {
var items = itemIds.Select(_libraryManager.GetItemById).Where(i => i is not null); 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<Guid> itemIds, Guid userId) public Task AddItemToPlaylistAsync(Guid playlistId, IReadOnlyCollection<Guid> itemIds, Guid userId)
@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Playlists
?? throw new ArgumentException("No Playlist exists with Id " + playlistId); ?? throw new ArgumentException("No Playlist exists with Id " + playlistId);
// Retrieve all the items to be added to the playlist // 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); .Where(i => i.SupportsAddingToPlaylist);
// Filter out duplicate items, if necessary // Filter out duplicate items, if necessary

View File

@ -166,7 +166,7 @@ namespace MediaBrowser.Controller.Playlists
return base.GetChildren(user, true, query); return base.GetChildren(user, true, query);
} }
public static IReadOnlyList<BaseItem> GetPlaylistItems(MediaType playlistMediaType, IEnumerable<BaseItem> inputItems, User user, DtoOptions options) public static IReadOnlyList<BaseItem> GetPlaylistItems(IEnumerable<BaseItem> inputItems, User user, DtoOptions options)
{ {
if (user is not null) if (user is not null)
{ {
@ -177,14 +177,14 @@ namespace MediaBrowser.Controller.Playlists
foreach (var item in inputItems) foreach (var item in inputItems)
{ {
var playlistItems = GetPlaylistItems(item, user, playlistMediaType, options); var playlistItems = GetPlaylistItems(item, user, options);
list.AddRange(playlistItems); list.AddRange(playlistItems);
} }
return list; return list;
} }
private static IEnumerable<BaseItem> GetPlaylistItems(BaseItem item, User user, MediaType mediaType, DtoOptions options) private static IEnumerable<BaseItem> GetPlaylistItems(BaseItem item, User user, DtoOptions options)
{ {
if (item is MusicGenre musicGenre) if (item is MusicGenre musicGenre)
{ {
@ -216,7 +216,7 @@ namespace MediaBrowser.Controller.Playlists
{ {
Recursive = true, Recursive = true,
IsFolder = false, IsFolder = false,
MediaTypes = [mediaType], MediaTypes = [MediaType.Audio, MediaType.Video],
EnableTotalRecordCount = false, EnableTotalRecordCount = false,
DtoOptions = options DtoOptions = options
}; };