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 GitHub
parent 445459afbb
commit d35c337c28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Diagnostics;
using MediaBrowser.Model.Plugins;
@ -27,6 +28,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
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>
/// Gets or sets a value indicating whether to scan for intros during a scheduled task.
/// </summary>

View File

@ -46,8 +46,8 @@
<div class="fieldDescription">
If enabled, credits will be automatically analyzed for new media
</div>
<div class="fieldDescription">
<br />
<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>.
</div>
</div>
@ -61,6 +61,7 @@
<div class="fieldDescription">
If checked, season 0 (specials / extras) will be included in analysis.
<br />
<br />
Note: Shows containing both a specials and extra folder will identify extras as season 0
and ignore specials, regardless of this setting.
</div>
@ -147,10 +148,10 @@
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="MaximumEpisodeCreditsDuration">
<label class="inputLabel inputLabelUnfocused" for="MaximumCreditsDuration">
Maximum credits duration (in seconds)
</label>
<input id="MaximumEpisodeCreditsDuration" type="number" is="emby-input" min="1" />
<input id="MaximumCreditsDuration" type="number" is="emby-input" min="1" />
<div class="fieldDescription">
Similar sounding audio which is longer than this duration will not be considered credits.
</div>

View File

@ -131,6 +131,8 @@ public class Entrypoint : IServerEntryPoint
return;
}
Plugin.Instance!.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
StartTimer();
}
@ -158,6 +160,8 @@ public class Entrypoint : IServerEntryPoint
return;
}
Plugin.Instance!.Configuration.PathRestrictions.Add(itemChangeEventArgs.Item.ContainingFolderPath);
StartTimer();
}
@ -275,6 +279,7 @@ public class Entrypoint : IServerEntryPoint
}
Plugin.Instance!.AnalyzerTaskIsRunning = false;
Plugin.Instance!.Configuration.PathRestrictions.Clear();
_autoTaskCompletEvent.Set();
// New item detected, start timer again
@ -293,6 +298,7 @@ public class Entrypoint : IServerEntryPoint
{
if (_cancellationTokenSource != null)
{
Plugin.Instance!.Configuration.PathRestrictions.Clear();
_cancellationTokenSource.Cancel();
_autoTaskCompletEvent.Wait(); // Wait for the signal

View File

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