From 4f1ce3041a643d26505a7ce85ab19a69c988b1bd Mon Sep 17 00:00:00 2001 From: rlauuzo <46294892+rlauuzo@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:10:42 +0200 Subject: [PATCH] Improve Anime Detection (#320) * Improve Anime Detection --- .../Manager/QueueManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs index 9ddbea6..684bd10 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using ConfusedPolarBear.Plugin.IntroSkipper.Data; using Jellyfin.Data.Enums; +using Jellyfin.Extensions; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; @@ -184,6 +185,11 @@ public class QueueManager(ILogger logger, ILibraryManager libraryM return; } + var isAnime = seasonEpisodes.FirstOrDefault()?.IsAnime ?? + (pluginInstance.GetItem(episode.SeriesId) is Series series && + (series.Tags.Contains("anime", StringComparison.OrdinalIgnoreCase) || + series.Genres.Contains("anime", StringComparison.OrdinalIgnoreCase))); + // Limit analysis to the first X% of the episode and at most Y minutes. // X and Y default to 25% and 10 minutes. var duration = TimeSpan.FromTicks(episode.RunTimeTicks ?? 0).TotalSeconds; @@ -200,7 +206,7 @@ public class QueueManager(ILogger logger, ILibraryManager libraryM SeriesId = episode.SeriesId, EpisodeId = episode.Id, Name = episode.Name, - IsAnime = episode.GetInheritedTags().Contains("anime", StringComparer.OrdinalIgnoreCase), + IsAnime = isAnime, Path = episode.Path, Duration = Convert.ToInt32(duration), IntroFingerprintEnd = Convert.ToInt32(fingerprintDuration),