Work around the sonarr bug #254

This commit is contained in:
tidusjar 2016-07-28 13:45:57 +01:00
commit 5024178724
3 changed files with 25 additions and 1 deletions

View file

@ -300,5 +300,26 @@ namespace PlexRequests.Api
return null;
}
}
public Series UpdateSeries(Series series, string apiKey, Uri baseUrl)
{
var request = new RestRequest { Resource = "/api/Series", Method = Method.PUT };
request.AddHeader("X-Api-Key", apiKey);
request.AddJsonBody(series);
try
{
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) =>
Log.Error(exception, "Exception when calling UpdateSeries for Sonarr, Retrying {0}", timespan));
return policy.Execute(() => Api.ExecuteJson<Series>(request, baseUrl));
}
catch (Exception e)
{
Log.Error(e, "There has been an API exception when put the Sonarr UpdateSeries");
return null;
}
}
}
}