From 1941c794ad3bdfd19ef76e07b91cc76cc88f3db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Van=C3=AD=C4=8Dek?= Date: Mon, 16 Dec 2024 01:18:50 +0100 Subject: [PATCH] Root folder hiding/showing --- CinemaJellyfin/CinemaRootFolder.cs | 32 +++--------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/CinemaJellyfin/CinemaRootFolder.cs b/CinemaJellyfin/CinemaRootFolder.cs index 2b60f08..2f5a31d 100644 --- a/CinemaJellyfin/CinemaRootFolder.cs +++ b/CinemaJellyfin/CinemaRootFolder.cs @@ -10,6 +10,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using Microsoft.Extensions.Logging; using CinemaLib.API; +using Jellyfin.Data.Entities; namespace Jellyfin.Plugin.Cinema; @@ -27,41 +28,14 @@ public abstract class CinemaRootFolder : CinemaFilterFolder, ICollectionFolder public abstract CollectionType? CollectionType { get; } public override bool IsHidden => _hidden; + public override bool IsVisible(User user) => !_hidden; internal bool Hide { get => _hidden; - set - { - var a = CinemaHost.LibraryManager.RootFolder.VirtualChildren; - if (a.Contains(this) == (!value)) - return; - - this._hidden = value; - - if (value) - { - // Remove ourselves - var temp = new List(); - while (!a.IsEmpty) - { - if (!a.TryTake(out BaseItem? b)) - continue; - - if (b == this) - break; - temp.Add(b); - } - foreach (var i in temp) - a.Add(i); - } - else - // Add ourselves - a.Add(this); - } + set => _hidden = value; } - /* public Task GetChannelImage(ImageType type, CancellationToken cancellationToken)