From 0ee844dd46f98a009c656afb3ca8618902a725d8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 3 Oct 2015 14:13:53 -0400 Subject: [PATCH] hide library monitor from certain operating systems --- MediaBrowser.Controller/IServerApplicationHost.cs | 6 ++++++ MediaBrowser.Model/System/SystemInfo.cs | 8 ++++---- MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | 7 +++++++ MediaBrowser.Server.Mono/Native/BaseMonoApp.cs | 5 +++++ MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 7 ++++++- MediaBrowser.Server.Startup.Common/INativeApp.cs | 6 ++++++ MediaBrowser.ServerApplication/Native/WindowsApp.cs | 5 +++++ 7 files changed, 39 insertions(+), 5 deletions(-) diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index d202e221e0..1b842a5f62 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -23,6 +23,12 @@ namespace MediaBrowser.Controller /// true if [supports automatic run at startup]; otherwise, false. bool SupportsAutoRunAtStartup { get; } + /// + /// Gets a value indicating whether [supports library monitor]. + /// + /// true if [supports library monitor]; otherwise, false. + bool SupportsLibraryMonitor { get; } + /// /// Gets the HTTP server port. /// diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index c8209baa85..e3e8c7be23 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -39,11 +39,11 @@ namespace MediaBrowser.Model.System public bool HasPendingRestart { get; set; } /// - /// Gets or sets a value indicating whether [supports synchronize]. + /// Gets or sets a value indicating whether [supports library monitor]. /// - /// true if [supports synchronize]; otherwise, false. - public bool SupportsSync { get; set; } - + /// true if [supports library monitor]; otherwise, false. + public bool SupportsLibraryMonitor { get; set; } + /// /// Gets or sets a value indicating whether this instance is network deployed. /// diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index cb9d5a09fa..1f545916a4 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/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; /// /// Initializes a new instance of the class. @@ -153,6 +155,11 @@ namespace MediaBrowser.Server.Implementations.IO { get { + if (!_appHost.SupportsLibraryMonitor) + { + return false; + } + switch (ConfigurationManager.Configuration.EnableLibraryMonitor) { case AutoOnOff.Auto: diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index 3b2d145881..d0ceb9e09b 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/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) { } diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index e63adaebd1..aa4f5a040e 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/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; } + } + /// /// Gets the name. /// @@ -1072,7 +1077,7 @@ namespace MediaBrowser.Server.Startup.Common SupportsRunningAsService = SupportsRunningAsService, ServerName = FriendlyName, LocalAddress = LocalApiUrl, - SupportsSync = true + SupportsLibraryMonitor = SupportsLibraryMonitor }; } diff --git a/MediaBrowser.Server.Startup.Common/INativeApp.cs b/MediaBrowser.Server.Startup.Common/INativeApp.cs index 01bc069a77..597caf34cc 100644 --- a/MediaBrowser.Server.Startup.Common/INativeApp.cs +++ b/MediaBrowser.Server.Startup.Common/INativeApp.cs @@ -52,6 +52,12 @@ namespace MediaBrowser.Server.Startup.Common /// true if [supports autorun at startup]; otherwise, false. bool SupportsAutoRunAtStartup { get; } + /// + /// Gets a value indicating whether [supports library monitor]. + /// + /// true if [supports library monitor]; otherwise, false. + bool SupportsLibraryMonitor { get; } + /// /// Gets a value indicating whether this instance can self update. /// diff --git a/MediaBrowser.ServerApplication/Native/WindowsApp.cs b/MediaBrowser.ServerApplication/Native/WindowsApp.cs index bad1aaf35e..956ba52768 100644 --- a/MediaBrowser.ServerApplication/Native/WindowsApp.cs +++ b/MediaBrowser.ServerApplication/Native/WindowsApp.cs @@ -47,6 +47,11 @@ namespace MediaBrowser.ServerApplication.Native } } + public bool SupportsLibraryMonitor + { + get { return true; } + } + public bool SupportsRunningAsService { get