From beef6f0855956f75784be7d62de98fbd9d958f80 Mon Sep 17 00:00:00 2001 From: cvium Date: Sun, 28 Nov 2021 19:56:31 +0100 Subject: [PATCH] Don't query series twice --- MediaBrowser.Providers/TV/SeriesMetadataService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Providers/TV/SeriesMetadataService.cs b/MediaBrowser.Providers/TV/SeriesMetadataService.cs index 9d223b4b66..770dc3e003 100644 --- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs @@ -130,11 +130,12 @@ namespace MediaBrowser.Providers.TV /// The async task. private async Task FillInMissingSeasonsAsync(Series series, CancellationToken cancellationToken) { - var episodesInSeriesFolder = series.GetRecursiveChildren(i => i is Episode) - .Cast() + var seriesChildren = series.GetRecursiveChildren(i => i is Episode || i is Season); + var episodesInSeriesFolder = seriesChildren + .OfType() .Where(i => !i.IsInSeasonFolder); - List seasons = series.Children.OfType().ToList(); + List seasons = seriesChildren.OfType().ToList(); // Loop through the unique season numbers foreach (var episode in episodesInSeriesFolder)