From dad7d6dd722d998c46eb4aa9eb98b327de05cd42 Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Mon, 2 May 2022 01:18:31 -0500 Subject: [PATCH] Don't analyze specials & query folder --- .../Entrypoint.cs | 2 ++ .../ScheduledTasks/FingerprinterTask.cs | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs index 85e3466..5e246de 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs @@ -87,6 +87,7 @@ public class Entrypoint : IServerEntryPoint // Get all items from this library. Since intros may change within a season, sort the items before adding them. var folder = _userViewManager.GetUserViews(query)[0]; var items = folder.GetItems(new InternalItemsQuery() { + ParentId = Guid.Parse(rawId), OrderBy = new [] { ("SortName", SortOrder.Ascending) }, IncludeItemTypes = new BaseItemKind[] { BaseItemKind.Episode }, Recursive = true, @@ -159,6 +160,7 @@ public class Entrypoint : IServerEntryPoint continue; } + _logger.LogDebug("Accessing libraries as {Username}", user.Username); return user.Id; } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs index d1b0501..454d84b 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs @@ -75,8 +75,12 @@ public class FingerprinterTask : IScheduledTask { foreach (var season in queue) { var first = season.Value[0]; - _logger.LogDebug( - "Fingerprinting {Count} episodes from {Name} season {Season}", + // Don't analyze seasons with <= 1 episode or specials + if (season.Value.Count <= 1 || first.SeasonNumber == 0) + { + continue; + } + season.Value.Count, first.SeriesName, first.SeasonNumber); @@ -89,6 +93,11 @@ public class FingerprinterTask : IScheduledTask { for (var i = 0; i < episodes.Count; i += 2) { + if (cancellationToken.IsCancellationRequested) + { + break; + } + var lhs = episodes[i]; var rhs = episodes[i+1]; @@ -120,6 +129,11 @@ public class FingerprinterTask : IScheduledTask { } Plugin.Instance!.Configuration.SaveTimestamps(); + + if (cancellationToken.IsCancellationRequested) + { + break; + } } return Task.CompletedTask; @@ -249,7 +263,7 @@ public class FingerprinterTask : IScheduledTask { Plugin.Instance!.Intros[episode] = new Intro() { EpisodeId = episode, - Valid = (introStart > 0) && (introEnd > 0), + Valid = introEnd > 0, IntroStart = introStart, IntroEnd = introEnd, ShowSkipPromptAt = Math.Max(0, introStart - 5),