Limit the scope of automatic scanning (#116)

* Add temporary scope limit for auto

* Fix a missing credits variable rename

* Add some extra padding to notes

* Only use path limits when filled in
This commit is contained in:
TwistedUmbrellaX 2024-04-14 01:13:43 -04:00 committed by TwistedUmbrellaX
parent 26d9c76d2f
commit 6cc69fc0ee
4 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
@ -27,6 +28,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary> /// </summary>
public string SelectedLibraries { get; set; } = string.Empty; public string SelectedLibraries { get; set; } = string.Empty;
/// <summary>
/// Gets a temporary limitation on file paths to be analyzed. Should be empty when automatic scan is idle.
/// </summary>
public IList<string> PathRestrictions { get; } = new List<string>();
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to scan for intros during a scheduled task. /// Gets or sets a value indicating whether to scan for intros during a scheduled task.
/// </summary> /// </summary>

View File

@ -46,8 +46,8 @@
<div class="fieldDescription"> <div class="fieldDescription">
If enabled, credits will be automatically analyzed for new media If enabled, credits will be automatically analyzed for new media
</div> <br />
<div class="fieldDescription"> <br />
Note: Not selecting at least one automatic detection type will disable automatic scans. To configure the scheduled task, see <a is="emby-linkbutton" class="button-link" href="scheduledtasks.html">scheduled tasks</a>. Note: Not selecting at least one automatic detection type will disable automatic scans. To configure the scheduled task, see <a is="emby-linkbutton" class="button-link" href="scheduledtasks.html">scheduled tasks</a>.
</div> </div>
</div> </div>
@ -61,6 +61,7 @@
<div class="fieldDescription"> <div class="fieldDescription">
If checked, season 0 (specials / extras) will be included in analysis. If checked, season 0 (specials / extras) will be included in analysis.
<br /> <br />
<br />
Note: Shows containing both a specials and extra folder will identify extras as season 0 Note: Shows containing both a specials and extra folder will identify extras as season 0
and ignore specials, regardless of this setting. and ignore specials, regardless of this setting.
</div> </div>

View File

@ -148,6 +148,8 @@ public class Entrypoint : IHostedService, IDisposable
return; return;
} }
Plugin.Instance!.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
StartTimer(); StartTimer();
} }
@ -175,6 +177,8 @@ public class Entrypoint : IHostedService, IDisposable
return; return;
} }
Plugin.Instance!.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
StartTimer(); StartTimer();
} }
@ -291,6 +295,7 @@ public class Entrypoint : IHostedService, IDisposable
} }
} }
Plugin.Instance!.Configuration.PathRestrictions.Clear();
_autoTaskCompletEvent.Set(); _autoTaskCompletEvent.Set();
_cancellationTokenSource = null; _cancellationTokenSource = null;

View File

@ -157,6 +157,14 @@ public class QueueManager
continue; continue;
} }
if (Plugin.Instance!.Configuration.PathRestrictions.Count > 0)
{
if (!Plugin.Instance!.Configuration.PathRestrictions.Contains(item.ContainingFolderPath))
{
continue;
}
}
QueueEpisode(episode); QueueEpisode(episode);
} }