|
|
@ -79,11 +79,13 @@ namespace PlexRequests.Api
|
|
|
|
var sw = new Stopwatch();
|
|
|
|
var sw = new Stopwatch();
|
|
|
|
sw.Start();
|
|
|
|
sw.Start();
|
|
|
|
|
|
|
|
|
|
|
|
// Check to see if it's been added yet.
|
|
|
|
var seasonIncrement = 0;
|
|
|
|
var seasonList = new SickRageSeasonList();
|
|
|
|
var seasonList = new SickRageSeasonList();
|
|
|
|
while (seasonList.data.Length < seasonCount)
|
|
|
|
while (seasonIncrement < seasonCount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl);
|
|
|
|
seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl);
|
|
|
|
|
|
|
|
seasonIncrement = seasonList.data?.Length ?? 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (sw.ElapsedMilliseconds > 30000) // Break out after 30 seconds, it's not going to get added
|
|
|
|
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.");
|
|
|
|
Log.Warn("Couldn't find out if the show had been added after 10 seconds. I doubt we can change the status to wanted.");
|
|
|
@ -92,7 +94,6 @@ namespace PlexRequests.Api
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sw.Stop();
|
|
|
|
sw.Stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (seasons.Length > 0)
|
|
|
|
if (seasons.Length > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//handle the seasons requested
|
|
|
|
//handle the seasons requested
|
|
|
@ -151,21 +152,5 @@ namespace PlexRequests.Api
|
|
|
|
await Task.Run(() => Thread.Sleep(2000));
|
|
|
|
await Task.Run(() => Thread.Sleep(2000));
|
|
|
|
return await Task.Run(() => Api.Execute<SickRageTvAdd>(request, baseUrl)).ConfigureAwait(false);
|
|
|
|
return await Task.Run(() => Api.Execute<SickRageTvAdd>(request, baseUrl)).ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public SickRageShowInformation CheckShowHasBeenAdded(int tvdbId, string apiKey, Uri baseUrl)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// var request = new RestRequest
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// Resource = "/api/{apiKey}/?cmd=show",
|
|
|
|
|
|
|
|
// Method = Method.GET
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// request.AddUrlSegment("apiKey", apiKey);
|
|
|
|
|
|
|
|
// request.AddQueryParameter("tvdbid", tvdbId.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var obj = Api.Execute<SickRageShowInformation>(request, baseUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// return obj;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|