diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index 764eb7c68..0559e08ea 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -78,6 +78,12 @@ namespace MediaBrowser.Server.Implementations.IO TemporarilyIgnore(path); } + public bool IsPathLocked(string path) + { + var lockedPaths = _tempIgnoredPaths.Keys.ToList(); + return lockedPaths.Any(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase) || _fileSystem.ContainsSubPath(i, path)); + } + public async void ReportFileSystemChangeComplete(string path, bool refreshPath) { if (string.IsNullOrEmpty(path)) @@ -658,7 +664,7 @@ namespace MediaBrowser.Server.Implementations.IO while (item == null && !string.IsNullOrEmpty(path)) { - item = LibraryManager.RootFolder.FindByPath(path); + item = LibraryManager.FindByPath(path); path = Path.GetDirectoryName(path); } @@ -690,8 +696,21 @@ namespace MediaBrowser.Server.Implementations.IO foreach (var watcher in _fileSystemWatchers.Values.ToList()) { + watcher.Created -= watcher_Changed; + watcher.Deleted -= watcher_Changed; + watcher.Renamed -= watcher_Changed; watcher.Changed -= watcher_Changed; - watcher.EnableRaisingEvents = false; + + try + { + watcher.EnableRaisingEvents = false; + } + catch (InvalidOperationException) + { + // Seeing this under mono on linux sometimes + // Collection was modified; enumeration operation may not execute. + } + watcher.Dispose(); } |
