added realtime monitor setting

This commit is contained in:
Luke Pulverenti 2014-01-29 15:30:26 -05:00
parent eced7ed068
commit 2353dc1aee
3 changed files with 27 additions and 4 deletions

View file

@ -227,6 +227,8 @@ namespace MediaBrowser.Model.Configuration
public TvFileOrganizationOptions TvFileOrganizationOptions { get; set; }
public LiveTvOptions LiveTvOptions { get; set; }
public bool EnableRealtimeMonitor { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@ -294,6 +296,8 @@ namespace MediaBrowser.Model.Configuration
LiveTvOptions = new LiveTvOptions();
TvFileOrganizationOptions = new TvFileOrganizationOptions();
EnableRealtimeMonitor = true;
}
}

View file

@ -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)

View file

@ -129,15 +129,28 @@ namespace MediaBrowser.Server.Implementations.IO
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="PowerModeChangedEventArgs"/> instance containing the event data.</param>
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
Restart();
}
private void Restart()
{
Stop();
Start();
}
public void Start()
{
if (ConfigurationManager.Configuration.EnableRealtimeMonitor)
{
StartInternal();
}
}
/// <summary>
/// Starts this instance.
/// </summary>
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