mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Attempt at fixing a potential bug found from #466
This commit is contained in:
parent
f098e0355e
commit
a7d5378426
11 changed files with 222 additions and 133 deletions
|
@ -301,6 +301,36 @@ namespace PlexRequests.Api
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public PlexMetadata GetSeasons(string authToken, Uri plexFullHost, string ratingKey)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
Resource = "library/metadata/{ratingKey}/children"
|
||||
};
|
||||
|
||||
request.AddUrlSegment("ratingKey", ratingKey);
|
||||
AddHeaders(ref request, authToken);
|
||||
|
||||
try
|
||||
{
|
||||
var lib = RetryHandler.Execute(() => Api.ExecuteXml<PlexMetadata>(request, plexFullHost),
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetMetadata for Plex, Retrying {0}", timespan), new[] {
|
||||
TimeSpan.FromSeconds (5),
|
||||
TimeSpan.FromSeconds(10),
|
||||
TimeSpan.FromSeconds(30)
|
||||
});
|
||||
|
||||
return lib;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "There has been a API Exception when attempting to get the Plex GetMetadata");
|
||||
return new PlexMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
public PlexServer GetServer(string authToken)
|
||||
{
|
||||
var request = new RestRequest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue