瀏覽代碼

Add ability to enable/disable libraries (#11037)

Co-authored-by: Bond-009 <bond.009@outlook.com>
Co-authored-by: Cody Robibero <cody@robibe.ro>
btopherjohnson 1 年之前
父節點
當前提交
9a40a67c60

+ 1 - 0
CONTRIBUTORS.md

@@ -180,6 +180,7 @@
  _ [Barasingha](https://github.com/MaVdbussche)
  - [Gauvino](https://github.com/Gauvino)
  - [felix920506](https://github.com/felix920506)
+ - [btopherjohnson](https://github.com/btopherjohnson)
 
 # Emby Contributors
 

+ 11 - 0
MediaBrowser.Controller/Entities/CollectionFolder.cs

@@ -11,6 +11,7 @@ using System.Text.Json;
 using System.Text.Json.Serialization;
 using System.Threading;
 using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
 using Jellyfin.Data.Enums;
 using Jellyfin.Extensions.Json;
 using MediaBrowser.Controller.IO;
@@ -95,6 +96,16 @@ namespace MediaBrowser.Controller.Entities
             return GetLibraryOptions(Path);
         }
 
+        public override bool IsVisible(User user)
+        {
+            if (GetLibraryOptions().Enabled)
+            {
+                return base.IsVisible(user);
+            }
+
+            return false;
+        }
+
         private static LibraryOptions LoadLibraryOptions(string path)
         {
             try

+ 2 - 0
MediaBrowser.Model/Configuration/LibraryOptions.cs

@@ -27,6 +27,8 @@ namespace MediaBrowser.Model.Configuration
             SeasonZeroDisplayName = "Specials";
         }
 
+        public bool Enabled { get; set; } = true;
+
         public bool EnablePhotos { get; set; }
 
         public bool EnableRealtimeMonitor { get; set; }