added realtime monitor setting

pull/702/head
Luke Pulverenti 11 years ago
parent eced7ed068
commit 2353dc1aee

@ -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;
}
}

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

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

Loading…
Cancel
Save