@@ -180,7 +180,6 @@ private void CreateEpisodes(List<ResponseEpisode> rawEpisodeList, SVR_AniDB_Anim
180180 {
181181 // Load the titles for the episode now, since we might need to check
182182 // them even if we don't update the episode itself.
183- var skipCounting = false ;
184183 if ( ! currentAniDBEpisodeTitles . TryGetValue ( rawEpisode . EpisodeID , out var currentTitles ) )
185184 currentTitles = new ( ) ;
186185
@@ -194,11 +193,11 @@ private void CreateEpisodes(List<ResponseEpisode> rawEpisodeList, SVR_AniDB_Anim
194193 // If the episode does not belong to the anime being
195194 // processed, or if none of the titles changed since last
196195 // time, then also skip updating the episode titles.
197- if ( episode . AnimeID != rawEpisode . AnimeID ||
198- currentTitles . Count == rawEpisode . Titles . Count &&
199- currentTitles . All ( t1 => rawEpisode . Titles . Any ( t2 => string . Equals ( t1 . Title , t2 . Title ) ) ) )
196+ if ( episode . AnimeID != rawEpisode . AnimeID )
200197 continue ;
201- skipCounting = true ;
198+ if ( currentTitles . Count == rawEpisode . Titles . Count &&
199+ currentTitles . All ( t1 => rawEpisode . Titles . Any ( t2 => string . Equals ( t1 . Title , t2 . Title ) ) ) )
200+ goto count ;
202201 }
203202 // Update the existing record.
204203 else
@@ -252,21 +251,16 @@ private void CreateEpisodes(List<ResponseEpisode> rawEpisodeList, SVR_AniDB_Anim
252251 if ( currentTitles . Count > 0 )
253252 titlesToRemove . AddRange ( currentTitles . Where ( a => ! newTitles . Any ( b => b . Equals ( a ) ) ) ) ;
254253
255- // Skip counting the episode if we only needed to update the titles
256- // for it.
257- if ( skipCounting )
258- continue ;
259-
260254 // Since the HTTP API doesn't return a count of the number of normal
261255 // episodes and/or specials, then we will calculate it now.
262- switch ( episode . GetEpisodeTypeEnum ( ) )
256+ count : switch ( episode . GetEpisodeTypeEnum ( ) )
263257 {
264258 case Shoko . Models . Enums . EpisodeType . Episode :
265259 episodeCountNormal ++ ;
266260 break ;
267261
268262 case Shoko . Models . Enums . EpisodeType . Special :
269- episodeCountNormal ++ ;
263+ episodeCountSpecial ++ ;
270264 break ;
271265 }
272266 }
0 commit comments