aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/BaseItem.cs
diff options
context:
space:
mode:
authorItsAllAboutTheCode <52703+ItsAllAboutTheCode@users.noreply.github.com>2024-07-21 14:16:31 +0000
committerGitHub <noreply@github.com>2024-07-21 16:16:31 +0200
commit24f355a7790ff81359b0cb3bbe98329b6c516866 (patch)
tree4dc706e825426d441e19a75a696241f09ff28ce7 /MediaBrowser.Controller/Entities/BaseItem.cs
parentd5cf0ad2c87f4bb7a5c0295b053695f623cae56b (diff)
Changed `GetThemeMedia` to support SortBy/Order options (#12167)
* Changed `GetThemeMedia` to support SortBy/Order options The `GetThemeMedia, `GetThemeVideos` and `GetThemeSongs` functions can optionally sort the results based based on passing an ItemSortBy type and a SortOrder. This is intended to be used by jellyfin-web in order to allow users to control the order of theme playback. See PR: https://github.com/jellyfin/jellyfin-web/pull/5714 * Update MediaBrowser.Controller/Entities/BaseItem.cs Fix the `GetThemeVideos` two argument overload having both parameters defaulted. For the two argument overload, both parameters are required.
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 68ae67d05..7b6f364f7 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -2544,14 +2544,24 @@ namespace MediaBrowser.Controller.Entities
StringComparison.OrdinalIgnoreCase);
}
- public IReadOnlyList<BaseItem> GetThemeSongs()
+ public IReadOnlyList<BaseItem> GetThemeSongs(User user = null)
{
- return GetExtras().Where(e => e.ExtraType == Model.Entities.ExtraType.ThemeSong).ToArray();
+ return GetThemeSongs(user, Array.Empty<(ItemSortBy, SortOrder)>());
}
- public IReadOnlyList<BaseItem> GetThemeVideos()
+ public IReadOnlyList<BaseItem> GetThemeSongs(User user, IEnumerable<(ItemSortBy SortBy, SortOrder SortOrder)> orderBy)
{
- return GetExtras().Where(e => e.ExtraType == Model.Entities.ExtraType.ThemeVideo).ToArray();
+ return LibraryManager.Sort(GetExtras().Where(e => e.ExtraType == Model.Entities.ExtraType.ThemeSong), user, orderBy).ToArray();
+ }
+
+ public IReadOnlyList<BaseItem> GetThemeVideos(User user = null)
+ {
+ return GetThemeVideos(user, Array.Empty<(ItemSortBy, SortOrder)>());
+ }
+
+ public IReadOnlyList<BaseItem> GetThemeVideos(User user, IEnumerable<(ItemSortBy SortBy, SortOrder SortOrder)> orderBy)
+ {
+ return LibraryManager.Sort(GetExtras().Where(e => e.ExtraType == Model.Entities.ExtraType.ThemeVideo), user, orderBy).ToArray();
}
/// <summary>