From 2353dc1aeedd13e1b604d4308b7ff551726bc455 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 29 Jan 2014 15:30:26 -0500 Subject: added realtime monitor setting --- .../IO/LibraryMonitor.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Server.Implementations/IO') diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 0716a3d83..58141902e 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -129,15 +129,28 @@ namespace MediaBrowser.Server.Implementations.IO /// The source of the event. /// The instance containing the event data. void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) + { + Restart(); + } + + private void Restart() { Stop(); Start(); } + public void Start() + { + if (ConfigurationManager.Configuration.EnableRealtimeMonitor) + { + StartInternal(); + } + } + /// /// Starts this instance. /// - public void Start() + private void StartInternal() { LibraryManager.ItemAdded += LibraryManager_ItemAdded; LibraryManager.ItemRemoved += LibraryManager_ItemRemoved; @@ -359,7 +372,7 @@ namespace MediaBrowser.Server.Implementations.IO { throw new ArgumentNullException("path"); } - + var filename = Path.GetFileName(path); // Ignore certain files -- cgit v1.2.3