Got mostly everything working for #254 Ready for testing

This commit is contained in:
tidusjar 2016-08-07 18:54:49 +01:00
commit 0699d777d6
7 changed files with 84 additions and 40 deletions

View file

@ -64,7 +64,7 @@ namespace PlexRequests.Api
return obj;
}
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons, string apiKey, Uri baseUrl, bool monitor = true)
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons, string apiKey, Uri baseUrl, bool monitor = true, bool searchForMissingEpisodes = false)
{
Log.Debug("Adding series {0}", title);
Log.Debug("Seasons = {0}, out of {1} seasons", seasons.DumpJson(), seasonCount);
@ -86,6 +86,16 @@ namespace PlexRequests.Api
monitored = monitor
};
if (!searchForMissingEpisodes)
{
options.addOptions = new AddOptions
{
searchForMissingEpisodes = false,
ignoreEpisodesWithFiles = true,
ignoreEpisodesWithoutFiles = true
};
}
for (var i = 1; i <= seasonCount; i++)
{
var season = new Season
@ -107,9 +117,8 @@ namespace PlexRequests.Api
try
{
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling AddSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
TimeSpan.FromSeconds (2),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(10)
TimeSpan.FromSeconds (1),
TimeSpan.FromSeconds(2),
});
result = policy.Execute(() => Api.ExecuteJson<SonarrAddSeries>(request, baseUrl));