diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/AnalyzerHelper.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/AnalyzerHelper.cs index 40bc67c..9b2b7f0 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/AnalyzerHelper.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/AnalyzerHelper.cs @@ -34,7 +34,7 @@ public class AnalyzerHelper /// Analysis mode. /// Modified Intro Timestamps. public Dictionary AdjustIntroTimes( - IReadOnlyCollection episodes, + IReadOnlyList episodes, IReadOnlyDictionary originalIntros, AnalysisMode mode) { @@ -76,9 +76,9 @@ public class AnalyzerHelper return adjustedIntro; } - private List GetChaptersWithVirtualEnd(QueuedEpisode episode) + private static List GetChaptersWithVirtualEnd(QueuedEpisode episode) { - var chapters = Plugin.Instance?.GetChapters(episode.EpisodeId) ?? new List(); + var chapters = Plugin.Instance?.GetChapters(episode.EpisodeId) ?? []; chapters.Add(new ChapterInfo { StartPositionTicks = TimeSpan.FromSeconds(episode.Duration).Ticks }); return chapters; } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/BlackFrameAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/BlackFrameAnalyzer.cs index 1e41211..8027450 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/BlackFrameAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/BlackFrameAnalyzer.cs @@ -39,8 +39,8 @@ public class BlackFrameAnalyzer : IMediaFileAnalyzer } /// - public IReadOnlyCollection AnalyzeMediaFiles( - IReadOnlyCollection analysisQueue, + public IReadOnlyList AnalyzeMediaFiles( + IReadOnlyList analysisQueue, AnalysisMode mode, CancellationToken cancellationToken) { diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs index 6013760..db23fbe 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs @@ -24,8 +24,8 @@ public class ChapterAnalyzer(ILogger logger) : IMediaFileAnalyz private ILogger _logger = logger; /// - public IReadOnlyCollection AnalyzeMediaFiles( - IReadOnlyCollection analysisQueue, + public IReadOnlyList AnalyzeMediaFiles( + IReadOnlyList analysisQueue, AnalysisMode mode, CancellationToken cancellationToken) { diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs index fefda71..cc4e1a9 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs @@ -49,8 +49,8 @@ public class ChromaprintAnalyzer : IMediaFileAnalyzer } /// - public IReadOnlyCollection AnalyzeMediaFiles( - IReadOnlyCollection analysisQueue, + public IReadOnlyList AnalyzeMediaFiles( + IReadOnlyList analysisQueue, AnalysisMode mode, CancellationToken cancellationToken) { diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/IMediaFileAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/IMediaFileAnalyzer.cs index 3e24134..9c97c4f 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/IMediaFileAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/IMediaFileAnalyzer.cs @@ -16,8 +16,8 @@ public interface IMediaFileAnalyzer /// Analysis mode. /// Cancellation token from scheduled task. /// Collection of media files that were **unsuccessfully analyzed**. - public IReadOnlyCollection AnalyzeMediaFiles( - IReadOnlyCollection analysisQueue, + public IReadOnlyList AnalyzeMediaFiles( + IReadOnlyList analysisQueue, AnalysisMode mode, CancellationToken cancellationToken); } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs index d1b0db8..0b20f25 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs @@ -22,8 +22,8 @@ public class SegmentAnalyzer : IMediaFileAnalyzer } /// - public IReadOnlyCollection AnalyzeMediaFiles( - IReadOnlyCollection analysisQueue, + public IReadOnlyList AnalyzeMediaFiles( + IReadOnlyList analysisQueue, AnalysisMode mode, CancellationToken cancellationToken) { diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Manager/EdlManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/EdlManager.cs index c16c1c0..c6edfc8 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Manager/EdlManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/EdlManager.cs @@ -48,7 +48,7 @@ public static class EdlManager /// If the EDL action is set to a value other than None, update EDL files for the provided episodes. /// /// Episodes to update EDL files for. - public static void UpdateEDLFiles(IReadOnlyCollection episodes) + public static void UpdateEDLFiles(IReadOnlyList episodes) { var regenerate = Plugin.Instance!.Configuration.RegenerateEdlFiles; var action = Plugin.Instance.Configuration.EdlAction; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs index 684bd10..13e981c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Manager/QueueManager.cs @@ -241,8 +241,8 @@ public class QueueManager(ILogger logger, ILibraryManager libraryM /// Queued media items. /// Analysis mode. /// Media items that have been verified to exist in Jellyfin and in storage. - public (IReadOnlyCollection VerifiedItems, IReadOnlyCollection RequiredModes) - VerifyQueue(IReadOnlyCollection candidates, IReadOnlyCollection modes) + public (IReadOnlyList VerifiedItems, IReadOnlyCollection RequiredModes) + VerifyQueue(IReadOnlyList candidates, IReadOnlyCollection modes) { var verified = new List(); var reqModes = new HashSet(); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs index 55d457d..1c3f449 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs @@ -312,10 +312,10 @@ public class Plugin : BasePlugin, IHasWebPages internal BaseItem? GetItem(Guid id) { - return _libraryManager.GetItemById(id); + return id != Guid.Empty ? _libraryManager.GetItemById(id) : null; } - internal List GetCollectionFolders(Guid id) + internal IReadOnlyList GetCollectionFolders(Guid id) { var item = GetItem(id); return item is not null ? _libraryManager.GetCollectionFolders(item) : []; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs index 8c0ff26..1e7bc57 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs @@ -112,7 +112,7 @@ public class BaseItemAnalyzerTask return; } - var first = episodes.First(); + var first = episodes[0]; if (requiredModes.Count == 0) { _logger.LogDebug( @@ -180,14 +180,14 @@ public class BaseItemAnalyzerTask /// Cancellation token. /// Number of items that were successfully analyzed. private int AnalyzeItems( - IReadOnlyCollection items, + IReadOnlyList items, AnalysisMode mode, CancellationToken cancellationToken) { var totalItems = items.Count; // Only analyze specials (season 0) if the user has opted in. - var first = items.First(); + var first = items[0]; if (first.SeasonNumber == 0 && !Plugin.Instance!.Configuration.AnalyzeSeasonZero) { return 0;