added realtime monitor setting
This commit is contained in:
parent
eced7ed068
commit
2353dc1aee
|
@ -227,6 +227,8 @@ namespace MediaBrowser.Model.Configuration
|
||||||
public TvFileOrganizationOptions TvFileOrganizationOptions { get; set; }
|
public TvFileOrganizationOptions TvFileOrganizationOptions { get; set; }
|
||||||
public LiveTvOptions LiveTvOptions { get; set; }
|
public LiveTvOptions LiveTvOptions { get; set; }
|
||||||
|
|
||||||
|
public bool EnableRealtimeMonitor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -294,6 +296,8 @@ namespace MediaBrowser.Model.Configuration
|
||||||
LiveTvOptions = new LiveTvOptions();
|
LiveTvOptions = new LiveTvOptions();
|
||||||
|
|
||||||
TvFileOrganizationOptions = new TvFileOrganizationOptions();
|
TvFileOrganizationOptions = new TvFileOrganizationOptions();
|
||||||
|
|
||||||
|
EnableRealtimeMonitor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,15 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
|
|
||||||
foreach (var path in watchLocations)
|
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)
|
if (options.DeleteEmptyFolders)
|
||||||
|
|
|
@ -129,15 +129,28 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||||
/// <param name="sender">The source of the event.</param>
|
/// <param name="sender">The source of the event.</param>
|
||||||
/// <param name="e">The <see cref="PowerModeChangedEventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="PowerModeChangedEventArgs"/> instance containing the event data.</param>
|
||||||
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Restart()
|
||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
if (ConfigurationManager.Configuration.EnableRealtimeMonitor)
|
||||||
|
{
|
||||||
|
StartInternal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starts this instance.
|
/// Starts this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Start()
|
private void StartInternal()
|
||||||
{
|
{
|
||||||
LibraryManager.ItemAdded += LibraryManager_ItemAdded;
|
LibraryManager.ItemAdded += LibraryManager_ItemAdded;
|
||||||
LibraryManager.ItemRemoved += LibraryManager_ItemRemoved;
|
LibraryManager.ItemRemoved += LibraryManager_ItemRemoved;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user