Auto-Detection Configuration (#106)
* Update Entrypoint.cs * Update Entrypoint.cs * Update Entrypoint.cs * Update Entrypoint.cs
This commit is contained in:
parent
6c30244b53
commit
d5ac3aba8c
@ -61,13 +61,10 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public Task RunAsync()
|
public Task RunAsync()
|
||||||
{
|
|
||||||
if (Plugin.Instance!.Configuration.AutoDetectIntros || Plugin.Instance!.Configuration.AutoDetectCredits)
|
|
||||||
{
|
{
|
||||||
_libraryManager.ItemAdded += OnItemAdded;
|
_libraryManager.ItemAdded += OnItemAdded;
|
||||||
_libraryManager.ItemUpdated += OnItemModified;
|
_libraryManager.ItemUpdated += OnItemModified;
|
||||||
_taskManager.TaskCompleted += OnLibraryRefresh;
|
_taskManager.TaskCompleted += OnLibraryRefresh;
|
||||||
}
|
|
||||||
|
|
||||||
FFmpegWrapper.Logger = _logger;
|
FFmpegWrapper.Logger = _logger;
|
||||||
|
|
||||||
@ -97,6 +94,12 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
/// <param name="itemChangeEventArgs">The <see cref="ItemChangeEventArgs"/>.</param>
|
/// <param name="itemChangeEventArgs">The <see cref="ItemChangeEventArgs"/>.</param>
|
||||||
private void OnItemAdded(object? sender, ItemChangeEventArgs itemChangeEventArgs)
|
private void OnItemAdded(object? sender, ItemChangeEventArgs itemChangeEventArgs)
|
||||||
{
|
{
|
||||||
|
// Don't do anything if auto detection is disabled
|
||||||
|
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't do anything if it's not a supported media type
|
// Don't do anything if it's not a supported media type
|
||||||
if (itemChangeEventArgs.Item is not Episode)
|
if (itemChangeEventArgs.Item is not Episode)
|
||||||
{
|
{
|
||||||
@ -118,6 +121,12 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
/// <param name="itemChangeEventArgs">The <see cref="ItemChangeEventArgs"/>.</param>
|
/// <param name="itemChangeEventArgs">The <see cref="ItemChangeEventArgs"/>.</param>
|
||||||
private void OnItemModified(object? sender, ItemChangeEventArgs itemChangeEventArgs)
|
private void OnItemModified(object? sender, ItemChangeEventArgs itemChangeEventArgs)
|
||||||
{
|
{
|
||||||
|
// Don't do anything if auto detection is disabled
|
||||||
|
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't do anything if it's not a supported media type
|
// Don't do anything if it's not a supported media type
|
||||||
if (itemChangeEventArgs.Item is not Episode)
|
if (itemChangeEventArgs.Item is not Episode)
|
||||||
{
|
{
|
||||||
@ -139,6 +148,12 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
/// <param name="eventArgs">The <see cref="TaskCompletionEventArgs"/>.</param>
|
/// <param name="eventArgs">The <see cref="TaskCompletionEventArgs"/>.</param>
|
||||||
private void OnLibraryRefresh(object? sender, TaskCompletionEventArgs eventArgs)
|
private void OnLibraryRefresh(object? sender, TaskCompletionEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
// Don't do anything if auto detection is disabled
|
||||||
|
if (!Plugin.Instance!.Configuration.AutoDetectIntros && !Plugin.Instance!.Configuration.AutoDetectCredits)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var result = eventArgs.Result;
|
var result = eventArgs.Result;
|
||||||
|
|
||||||
if (result.Key != "RefreshLibrary")
|
if (result.Key != "RefreshLibrary")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user