diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 923c5ab74..4e981fa3e 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -227,6 +227,8 @@ namespace MediaBrowser.Model.Configuration
public TvFileOrganizationOptions TvFileOrganizationOptions { get; set; }
public LiveTvOptions LiveTvOptions { get; set; }
+ public bool EnableRealtimeMonitor { get; set; }
+
///
/// Initializes a new instance of the class.
///
@@ -294,6 +296,8 @@ namespace MediaBrowser.Model.Configuration
LiveTvOptions = new LiveTvOptions();
TvFileOrganizationOptions = new TvFileOrganizationOptions();
+
+ EnableRealtimeMonitor = true;
}
}
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
index 24f21e339..85b45cf2c 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs
@@ -79,9 +79,15 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
foreach (var path in watchLocations)
{
- if (options.LeftOverFileExtensionsToDelete.Length > 0)
+ var deleteExtensions = options.LeftOverFileExtensionsToDelete
+ .Select(i => i.Trim().TrimStart('.'))
+ .Where(i => !string.IsNullOrEmpty(i))
+ .Select(i => "." + i)
+ .ToList();
+
+ if (deleteExtensions.Count > 0)
{
- DeleteLeftOverFiles(path, options.LeftOverFileExtensionsToDelete);
+ DeleteLeftOverFiles(path, deleteExtensions);
}
if (options.DeleteEmptyFolders)
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