diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-10-06 10:47:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-06 10:47:40 +0200 |
| commit | a1246ba3a080cc20ff1c8e64b39a501065cc39b0 (patch) | |
| tree | cec616f27606c5ab0e217f5192eb3e2a5e582a20 /Emby.Server.Implementations/Playlists/PlaylistsFolder.cs | |
| parent | d245e45254057c62d058cfad3e56484a77093718 (diff) | |
| parent | e0db541381a669ff5ba618e618e162ba0d0ef1c9 (diff) | |
Merge pull request #6649 from barronpm/implementations-warn2
Diffstat (limited to 'Emby.Server.Implementations/Playlists/PlaylistsFolder.cs')
| -rw-r--r-- | Emby.Server.Implementations/Playlists/PlaylistsFolder.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/PlaylistsFolder.cs new file mode 100644 index 0000000000..8b1cee89d1 --- /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<BaseItem> GetEligibleChildrenForRecursiveChildren(User user) + { + return base.GetEligibleChildrenForRecursiveChildren(user).OfType<Playlist>(); + } + + protected override QueryResult<BaseItem> 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"; + } + } +} |
