mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
Fixes issue #62
This commit is contained in:
parent
b100fbe678
commit
c9d2b8fc13
10 changed files with 73 additions and 17 deletions
|
@ -31,6 +31,7 @@ using System;
|
|||
using NLog;
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.SickRage;
|
||||
using PlexRequests.Helpers;
|
||||
using RestSharp;
|
||||
|
||||
namespace PlexRequests.Api
|
||||
|
@ -47,13 +48,13 @@ namespace PlexRequests.Api
|
|||
private ApiRequest Api { get; }
|
||||
|
||||
|
||||
public SickRageTvAdd AddSeries(int tvdbId, bool latest, string quality, string apiKey,
|
||||
public SickRageTvAdd AddSeries(int tvdbId, bool latest, int[] seasons, string quality, string apiKey,
|
||||
Uri baseUrl)
|
||||
{
|
||||
string status;
|
||||
var futureStatus = SickRageStatus.Wanted;
|
||||
|
||||
status = latest ? SickRageStatus.Skipped : SickRageStatus.Wanted;
|
||||
status = latest || seasons.Length > 0 ? SickRageStatus.Skipped : SickRageStatus.Wanted;
|
||||
|
||||
var request = new RestRequest
|
||||
{
|
||||
|
@ -71,6 +72,17 @@ namespace PlexRequests.Api
|
|||
|
||||
var obj = Api.Execute<SickRageTvAdd>(request, baseUrl);
|
||||
|
||||
if (!latest && seasons.Length > 0 && obj.result != "failure")
|
||||
{
|
||||
//handle the seasons requested
|
||||
foreach (int s in seasons)
|
||||
{
|
||||
var result = AddSeason(tvdbId, s, apiKey, baseUrl);
|
||||
Log.Trace("SickRage adding season results: ");
|
||||
Log.Trace(result.DumpJson());
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -87,5 +99,22 @@ namespace PlexRequests.Api
|
|||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public SickRageTvAdd AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api/{apiKey}/?cmd=episode.setstatus",
|
||||
Method = Method.GET
|
||||
};
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
request.AddQueryParameter("tvdbid", tvdbId.ToString());
|
||||
request.AddQueryParameter("season", season.ToString());
|
||||
request.AddQueryParameter("status", SickRageStatus.Wanted);
|
||||
|
||||
var obj = Api.Execute<SickRageTvAdd>(request, baseUrl);
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue