From 462eb0c9f28227db6ea62782a4476a0eb36ed352 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 7 Apr 2016 22:33:46 +0100 Subject: [PATCH] I think i've fixed an issue where SickRage reports Show not found. --- PlexRequests.Api/SickrageApi.cs | 31 +++++++++++++++++++-------- PlexRequests.Helpers/LoggingHelper.cs | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/PlexRequests.Api/SickrageApi.cs b/PlexRequests.Api/SickrageApi.cs index 4967875b9..223d3115d 100644 --- a/PlexRequests.Api/SickrageApi.cs +++ b/PlexRequests.Api/SickrageApi.cs @@ -92,19 +92,32 @@ namespace PlexRequests.Api var seasonIncrement = 0; var seasonList = new SickRageSeasonList(); Log.Trace("while (seasonIncrement < seasonCount) where seasonCount = {0}", seasonCount); - while (seasonIncrement < seasonCount) + try { - seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl); - seasonIncrement = seasonList.Data?.Length ?? 0; - Log.Trace("New seasonIncrement -> {0}", seasonIncrement); - - if (sw.ElapsedMilliseconds > 30000) // Break out after 30 seconds, it's not going to get added + while (seasonIncrement < seasonCount) { - Log.Warn("Couldn't find out if the show had been added after 10 seconds. I doubt we can change the status to wanted."); - break; + seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl); + if (seasonList.result.Equals("failure")) + { + Thread.Sleep(3000); + continue; + } + seasonIncrement = seasonList.Data?.Length ?? 0; + Log.Trace("New seasonIncrement -> {0}", seasonIncrement); + + if (sw.ElapsedMilliseconds > 30000) // Break out after 30 seconds, it's not going to get added + { + Log.Warn("Couldn't find out if the show had been added after 10 seconds. I doubt we can change the status to wanted."); + break; + } } + sw.Stop(); + } + catch (Exception e) + { + Log.Error("Exception thrown when getting the seasonList"); + Log.Error(e); } - sw.Stop(); } Log.Trace("seasons.Length > 0 where seasons.Len -> {0}", seasons.Length); try diff --git a/PlexRequests.Helpers/LoggingHelper.cs b/PlexRequests.Helpers/LoggingHelper.cs index 03a80d3db..49eb9d0f7 100644 --- a/PlexRequests.Helpers/LoggingHelper.cs +++ b/PlexRequests.Helpers/LoggingHelper.cs @@ -106,7 +106,7 @@ namespace PlexRequests.Helpers CreateDirs = true }; config.AddTarget(fileTarget); - var rule2 = new LoggingRule("*", LogLevel.Info, fileTarget); + var rule2 = new LoggingRule("*", LogLevel.Trace, fileTarget); config.LoggingRules.Add(rule2); // Step 5. Activate the configuration