Browse Source

hide library monitor from certain operating systems

Luke Pulverenti 9 years ago
parent
commit
0ee844dd46

+ 6 - 0
MediaBrowser.Controller/IServerApplicationHost.cs

@@ -23,6 +23,12 @@ namespace MediaBrowser.Controller
         /// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
         bool SupportsAutoRunAtStartup { get; }
 
+        /// <summary>
+        /// Gets a value indicating whether [supports library monitor].
+        /// </summary>
+        /// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
+        bool SupportsLibraryMonitor { get; }
+        
         /// <summary>
         /// Gets the HTTP server port.
         /// </summary>

+ 4 - 4
MediaBrowser.Model/System/SystemInfo.cs

@@ -39,11 +39,11 @@ namespace MediaBrowser.Model.System
         public bool HasPendingRestart { get; set; }
 
         /// <summary>
-        /// Gets or sets a value indicating whether [supports synchronize].
+        /// Gets or sets a value indicating whether [supports library monitor].
         /// </summary>
-        /// <value><c>true</c> if [supports synchronize]; otherwise, <c>false</c>.</value>
-        public bool SupportsSync { get; set; }
-
+        /// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
+        public bool SupportsLibraryMonitor { get; set; }
+        
         /// <summary>
         /// Gets or sets a value indicating whether this instance is network deployed.
         /// </summary>

+ 7 - 0
MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs

@@ -15,6 +15,7 @@ using System.IO;
 using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
+using MediaBrowser.Controller;
 
 namespace MediaBrowser.Server.Implementations.IO
 {
@@ -113,6 +114,7 @@ namespace MediaBrowser.Server.Implementations.IO
         private IServerConfigurationManager ConfigurationManager { get; set; }
 
         private readonly IFileSystem _fileSystem;
+        private IServerApplicationHost _appHost;
 
         /// <summary>
         /// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
@@ -153,6 +155,11 @@ namespace MediaBrowser.Server.Implementations.IO
         {
             get
             {
+                if (!_appHost.SupportsLibraryMonitor)
+                {
+                    return false;
+                }
+
                 switch (ConfigurationManager.Configuration.EnableLibraryMonitor)
                 {
                     case AutoOnOff.Auto:

+ 5 - 0
MediaBrowser.Server.Mono/Native/BaseMonoApp.cs

@@ -109,6 +109,11 @@ namespace MediaBrowser.Server.Mono.Native
             }
         }
 
+        public bool SupportsLibraryMonitor
+        {
+            get { return false; }
+        }
+
         public void ConfigureAutoRun(bool autorun)
         {
         }

+ 6 - 1
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -260,6 +260,11 @@ namespace MediaBrowser.Server.Startup.Common
             get { return NativeApp.SupportsRunningAsService; }
         }
 
+        public bool SupportsLibraryMonitor
+        {
+            get { return NativeApp.SupportsLibraryMonitor; }
+        }
+
         /// <summary>
         /// Gets the name.
         /// </summary>
@@ -1072,7 +1077,7 @@ namespace MediaBrowser.Server.Startup.Common
                 SupportsRunningAsService = SupportsRunningAsService,
                 ServerName = FriendlyName,
                 LocalAddress = LocalApiUrl,
-                SupportsSync = true
+                SupportsLibraryMonitor = SupportsLibraryMonitor
             };
         }
 

+ 6 - 0
MediaBrowser.Server.Startup.Common/INativeApp.cs

@@ -52,6 +52,12 @@ namespace MediaBrowser.Server.Startup.Common
         /// <value><c>true</c> if [supports autorun at startup]; otherwise, <c>false</c>.</value>
         bool SupportsAutoRunAtStartup { get; }
 
+        /// <summary>
+        /// Gets a value indicating whether [supports library monitor].
+        /// </summary>
+        /// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
+        bool SupportsLibraryMonitor { get; }
+        
         /// <summary>
         /// Gets a value indicating whether this instance can self update.
         /// </summary>

+ 5 - 0
MediaBrowser.ServerApplication/Native/WindowsApp.cs

@@ -47,6 +47,11 @@ namespace MediaBrowser.ServerApplication.Native
             }
         }
 
+        public bool SupportsLibraryMonitor
+        {
+            get { return true; }
+        }
+
         public bool SupportsRunningAsService
         {
             get