aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-10-26 18:50:19 -0400
committerLuke <luke.pulverenti@gmail.com>2015-10-26 18:50:19 -0400
commit35778ebc02e5931142a1fe31a256b7488a07c5c2 (patch)
treeced0290be8820f5e507b51ca4c5165212b1879d1 /MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
parentc0dc8d055bfd4d2f58591083beb9e9128357aad6 (diff)
parent8d77308593c3b16b733b0109323770d9dfe7e166 (diff)
Merge pull request #1222 from MediaBrowser/dev
3.0.5768.7
Diffstat (limited to 'MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs')
-rw-r--r--MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
index 5bd26ce18..e107ea9f1 100644
--- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
+++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs
@@ -15,6 +15,8 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using CommonIO;
+using MediaBrowser.Controller;
namespace MediaBrowser.Server.Implementations.IO
{
@@ -86,7 +88,7 @@ namespace MediaBrowser.Server.Implementations.IO
// This is an arbitraty amount of time, but delay it because file system writes often trigger events long after the file was actually written to.
// Seeing long delays in some situations, especially over the network, sometimes up to 45 seconds
// But if we make this delay too high, we risk missing legitimate changes, such as user adding a new file, or hand-editing metadata
- await Task.Delay(20000).ConfigureAwait(false);
+ await Task.Delay(25000).ConfigureAwait(false);
string val;
_tempIgnoredPaths.TryRemove(path, out val);
@@ -113,11 +115,12 @@ namespace MediaBrowser.Server.Implementations.IO
private IServerConfigurationManager ConfigurationManager { get; set; }
private readonly IFileSystem _fileSystem;
+ private readonly IServerApplicationHost _appHost;
/// <summary>
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
/// </summary>
- public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem)
+ public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, IServerApplicationHost appHost)
{
if (taskManager == null)
{
@@ -129,6 +132,7 @@ namespace MediaBrowser.Server.Implementations.IO
Logger = logManager.GetLogger(GetType().Name);
ConfigurationManager = configurationManager;
_fileSystem = fileSystem;
+ _appHost = appHost;
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
}
@@ -156,7 +160,7 @@ namespace MediaBrowser.Server.Implementations.IO
switch (ConfigurationManager.Configuration.EnableLibraryMonitor)
{
case AutoOnOff.Auto:
- return Environment.OSVersion.Platform == PlatformID.Win32NT;
+ return _appHost.SupportsLibraryMonitor;
case AutoOnOff.Enabled:
return true;
default:
@@ -645,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.IO
if (item != null)
{
// If the item has been deleted find the first valid parent that still exists
- while (!Directory.Exists(item.Path) && !File.Exists(item.Path))
+ while (!_fileSystem.DirectoryExists(item.Path) && !_fileSystem.FileExists(item.Path))
{
item = item.Parent;