|
@@ -172,27 +172,29 @@ namespace MediaBrowser.Server.Implementations.IO
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void Start()
|
|
|
|
|
|
+ private bool IsLibraryMonitorEnabaled(BaseItem item)
|
|
{
|
|
{
|
|
- if (EnableLibraryMonitor)
|
|
|
|
|
|
+ var options = LibraryManager.GetLibraryOptions(item);
|
|
|
|
+
|
|
|
|
+ if (options != null && options.SchemaVersion >= 1)
|
|
{
|
|
{
|
|
- StartInternal();
|
|
|
|
|
|
+ return options.EnableRealtimeMonitor;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return EnableLibraryMonitor;
|
|
}
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// Starts this instance.
|
|
|
|
- /// </summary>
|
|
|
|
- private void StartInternal()
|
|
|
|
|
|
+ public void Start()
|
|
{
|
|
{
|
|
LibraryManager.ItemAdded += LibraryManager_ItemAdded;
|
|
LibraryManager.ItemAdded += LibraryManager_ItemAdded;
|
|
LibraryManager.ItemRemoved += LibraryManager_ItemRemoved;
|
|
LibraryManager.ItemRemoved += LibraryManager_ItemRemoved;
|
|
|
|
|
|
- var pathsToWatch = new List<string> { LibraryManager.RootFolder.Path };
|
|
|
|
|
|
+ var pathsToWatch = new List<string> { };
|
|
|
|
|
|
var paths = LibraryManager
|
|
var paths = LibraryManager
|
|
.RootFolder
|
|
.RootFolder
|
|
.Children
|
|
.Children
|
|
|
|
+ .Where(IsLibraryMonitorEnabaled)
|
|
.OfType<Folder>()
|
|
.OfType<Folder>()
|
|
.SelectMany(f => f.PhysicalLocations)
|
|
.SelectMany(f => f.PhysicalLocations)
|
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
|
@@ -213,6 +215,14 @@ namespace MediaBrowser.Server.Implementations.IO
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void StartWatching(BaseItem item)
|
|
|
|
+ {
|
|
|
|
+ if (IsLibraryMonitorEnabaled(item))
|
|
|
|
+ {
|
|
|
|
+ StartWatchingPath(item.Path);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Handles the ItemRemoved event of the LibraryManager control.
|
|
/// Handles the ItemRemoved event of the LibraryManager control.
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -235,7 +245,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
|
{
|
|
{
|
|
if (e.Item.GetParent() is AggregateFolder)
|
|
if (e.Item.GetParent() is AggregateFolder)
|
|
{
|
|
{
|
|
- StartWatchingPath(e.Item.Path);
|
|
|
|
|
|
+ StartWatching(e.Item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -382,14 +392,6 @@ namespace MediaBrowser.Server.Implementations.IO
|
|
Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);
|
|
Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);
|
|
|
|
|
|
DisposeWatcher(dw);
|
|
DisposeWatcher(dw);
|
|
-
|
|
|
|
- if (ConfigurationManager.Configuration.EnableLibraryMonitor == AutoOnOff.Auto)
|
|
|
|
- {
|
|
|
|
- Logger.Info("Disabling realtime monitor to prevent future instability");
|
|
|
|
-
|
|
|
|
- ConfigurationManager.Configuration.EnableLibraryMonitor = AutoOnOff.Disabled;
|
|
|
|
- Stop();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -420,8 +422,8 @@ namespace MediaBrowser.Server.Implementations.IO
|
|
|
|
|
|
var filename = Path.GetFileName(path);
|
|
var filename = Path.GetFileName(path);
|
|
|
|
|
|
- var monitorPath = !string.IsNullOrEmpty(filename) &&
|
|
|
|
- !_alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) &&
|
|
|
|
|
|
+ var monitorPath = !string.IsNullOrEmpty(filename) &&
|
|
|
|
+ !_alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) &&
|
|
!_alwaysIgnoreExtensions.Contains(Path.GetExtension(path) ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
|
!_alwaysIgnoreExtensions.Contains(Path.GetExtension(path) ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
// Ignore certain files
|
|
// Ignore certain files
|