From b307b19feff4f6e2fcdbe2acafdbc8faf9dd1fd5 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Thu, 10 Nov 2016 14:45:16 +0000 Subject: [PATCH] convert the for to foreach for better readability. Still need to rework this area --- .../Jobs/PlexAvailabilityChecker.cs | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/PlexRequests.Services/Jobs/PlexAvailabilityChecker.cs b/PlexRequests.Services/Jobs/PlexAvailabilityChecker.cs index a0d3ed85a..7ba84cb79 100644 --- a/PlexRequests.Services/Jobs/PlexAvailabilityChecker.cs +++ b/PlexRequests.Services/Jobs/PlexAvailabilityChecker.cs @@ -419,11 +419,11 @@ namespace PlexRequests.Services.Jobs results = GetLibraries(plexSettings); if (plexSettings.AdvancedSearch) { - for (var i = 0; i < results.Count; i++) + foreach (PlexSearch t in results) { - for (var j = 0; j < results[i].Directory.Count; j++) + foreach (Directory1 t1 in t.Directory) { - var currentItem = results[i].Directory[j]; + var currentItem = t1; var metaData = PlexApi.GetMetadata(plexSettings.PlexAuthToken, plexSettings.FullUri, currentItem.RatingKey); @@ -434,25 +434,21 @@ namespace PlexRequests.Services.Jobs currentItem.RatingKey); // We do not want "all episodes" this as a season - var filtered = - seasons.Directory.Where( - x => - !x.Title.Equals("All episodes", - StringComparison.CurrentCultureIgnoreCase)); + var filtered = seasons.Directory.Where( x => !x.Title.Equals("All episodes", StringComparison.CurrentCultureIgnoreCase)); - results[i].Directory[j].Seasons.AddRange(filtered); + t1.Seasons.AddRange(filtered); } var providerId = PlexHelper.GetProviderIdFromPlexGuid(metaData.Directory.Guid); - results[i].Directory[j].ProviderId = providerId; + t1.ProviderId = providerId; } - for (var j = 0; j < results[i].Video.Count; j++) + foreach (Video t1 in t.Video) { - var currentItem = results[i].Video[j]; + var currentItem = t1; var metaData = PlexApi.GetMetadata(plexSettings.PlexAuthToken, plexSettings.FullUri, currentItem.RatingKey); var providerId = PlexHelper.GetProviderIdFromPlexGuid(metaData.Video.Guid); - results[i].Video[j].ProviderId = providerId; + t1.ProviderId = providerId; } } }