From aa3c33060d775c8d050bd3975cd692c80081ea66 Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Sat, 2 Oct 2021 13:46:25 -0400 Subject: Fix warnings in Playlists --- .../Playlists/PlaylistsFolder.cs | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Emby.Server.Implementations/Playlists/PlaylistsFolder.cs (limited to 'Emby.Server.Implementations/Playlists/PlaylistsFolder.cs') diff --git a/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs new file mode 100644 index 000000000..8b1cee89d --- /dev/null +++ b/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs @@ -0,0 +1,58 @@ +#pragma warning disable CS1591 + +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; +using Jellyfin.Data.Entities; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Playlists; +using MediaBrowser.Model.Querying; + +namespace Emby.Server.Implementations.Playlists +{ + public class PlaylistsFolder : BasePluginFolder + { + public PlaylistsFolder() + { + Name = "Playlists"; + } + + [JsonIgnore] + public override bool IsHidden => true; + + [JsonIgnore] + public override bool SupportsInheritedParentImages => false; + + [JsonIgnore] + public override string CollectionType => MediaBrowser.Model.Entities.CollectionType.Playlists; + + public override bool IsVisible(User user) + { + return base.IsVisible(user) && GetChildren(user, true).Any(); + } + + protected override IEnumerable GetEligibleChildrenForRecursiveChildren(User user) + { + return base.GetEligibleChildrenForRecursiveChildren(user).OfType(); + } + + protected override QueryResult GetItemsInternal(InternalItemsQuery query) + { + if (query.User == null) + { + query.Recursive = false; + return base.GetItemsInternal(query); + } + + query.Recursive = true; + query.IncludeItemTypes = new[] { "Playlist" }; + query.Parent = null; + return LibraryManager.GetItemsResult(query); + } + + public override string GetClientTypeName() + { + return "ManualPlaylistsFolder"; + } + } +} -- cgit v1.2.3