From 18231fedef3da98d303f9d2a979f3440306893b2 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 11 Feb 2019 19:14:24 +0100 Subject: [PATCH] Add braces to if's and other minor style changes --- .../TV/MissingEpisodeProvider.cs | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index c54a3fa4a..495260848 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -129,8 +129,7 @@ namespace MediaBrowser.Providers.TV IReadOnlyCollection<(int SeasonNumber, int Episodenumber, DateTime FirstAired)> episodeLookup, CancellationToken cancellationToken) { - var existingEpisodes = allItems.OfType() - .ToList(); + var existingEpisodes = allItems.OfType().ToList(); var seasonCounts = episodeLookup.GroupBy(e => e.SeasonNumber).ToDictionary(g => g.Key, g => g.Count()); @@ -280,15 +279,7 @@ namespace MediaBrowser.Providers.TV } // If the season no longer exists in the remote lookup, delete it, but only if an existing episode doesn't require it - if (episodeLookup.All(e => e.SeasonNumber != seasonNumber)) - { - if (allEpisodes.All(s => s.ParentIndexNumber != seasonNumber || s.IsInSeasonFolder)) - { - return true; - } - } - - return false; + return episodeLookup.All(e => e.SeasonNumber != seasonNumber) && allEpisodes.All(s => s.ParentIndexNumber != seasonNumber || s.IsInSeasonFolder); } // Season does not have a number @@ -354,9 +345,9 @@ namespace MediaBrowser.Providers.TV /// /// The existing episodes. /// - /// The tuple. + /// /// Episode. - private Episode GetExistingEpisode(IList existingEpisodes, Dictionary seasonCounts, (int SeasonNumber, int EpisodeNumber, DateTime FirstAired) episodeTuple) + private Episode GetExistingEpisode(IList existingEpisodes, IReadOnlyDictionary seasonCounts, (int SeasonNumber, int EpisodeNumber, DateTime FirstAired) episodeTuple) { var seasonNumber = episodeTuple.SeasonNumber; var episodeNumber = episodeTuple.EpisodeNumber; @@ -365,14 +356,20 @@ namespace MediaBrowser.Providers.TV { var episode = GetExistingEpisode(existingEpisodes, seasonNumber, episodeNumber); if (episode != null) + { return episode; + } seasonNumber--; if (seasonCounts.ContainsKey(seasonNumber)) + { episodeNumber += seasonCounts[seasonNumber]; + } else + { break; + } } return null;