#254 MOSTLY DONE! At last, this took a while.

So currently if a series exists then we will correctly monitor the episodes selected.

TODO: When the series doesn't exist in sonarr we need to add the series and then wait for the episode metadata to be populated.

Also need to add in all of the regular checks  and notification e.g. whitelist etc.
This commit is contained in:
tidusjar 2016-07-24 18:02:43 +01:00
parent 8b46925f08
commit b14fd36ecd
21 changed files with 1380 additions and 861 deletions

View file

@ -35,25 +35,29 @@ namespace PlexRequests.Api
{
private static readonly TimeSpan[] DefaultTime = { TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10) };
public static T Execute<T>(Func<T> action, TimeSpan[] timeSpan)
{
var policy = RetryAndWaitPolicy(timeSpan);
return policy.Execute(action);
}
public static T Execute<T>(Func<T> func, TimeSpan[] timeSpan, Action<Exception, TimeSpan> action)
public static T Execute<T>(Func<T> action, TimeSpan[] timeSpan = null)
{
if (timeSpan == null)
{
timeSpan = DefaultTime;
}
var policy = RetryAndWaitPolicy(timeSpan, action);
var policy = RetryAndWaitPolicy(timeSpan);
return policy.Execute(action);
}
public static T Execute<T>(Func<T> func, Action<Exception, TimeSpan> action, TimeSpan[] timeSpan = null)
{
if (timeSpan == null)
{
timeSpan = DefaultTime;
}
var policy = RetryAndWaitPolicy(action, timeSpan);
return policy.Execute(func);
}
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] timeSpan, Action action)
public static RetryPolicy RetryAndWaitPolicy(Action action, TimeSpan[] timeSpan = null)
{
if (timeSpan == null)
{
@ -75,7 +79,7 @@ namespace PlexRequests.Api
return policy;
}
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] timeSpan, Action<Exception, TimeSpan> action)
public static RetryPolicy RetryAndWaitPolicy(Action<Exception, TimeSpan> action, TimeSpan[] timeSpan = null)
{
if (timeSpan == null)
{