mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Added the support for TV Series integrating with Sonarr
This commit is contained in:
parent
31615ff69c
commit
5dd9885885
15 changed files with 250 additions and 10 deletions
|
@ -45,7 +45,7 @@ namespace PlexRequests.Api
|
|||
|
||||
public List<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest { Resource = "/api/profile", Method = Method.GET};
|
||||
var request = new RestRequest { Resource = "/api/profile", Method = Method.GET };
|
||||
|
||||
request.AddHeader("X-Api-Key", apiKey);
|
||||
|
||||
|
@ -53,5 +53,50 @@ namespace PlexRequests.Api
|
|||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, bool episodes, string apiKey, Uri baseUrl)
|
||||
{
|
||||
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "/api/Series?",
|
||||
Method = Method.POST
|
||||
};
|
||||
|
||||
var options = new SonarrAddSeries();
|
||||
if (episodes == true)
|
||||
{
|
||||
options.addOptions = new AddOptions
|
||||
{
|
||||
ignoreEpisodesWithFiles = true,
|
||||
ignoreEpisodesWithoutFiles = true,
|
||||
searchForMissingEpisodes = false
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
options.addOptions = new AddOptions
|
||||
{
|
||||
ignoreEpisodesWithFiles = false,
|
||||
searchForMissingEpisodes = true,
|
||||
ignoreEpisodesWithoutFiles = false
|
||||
};
|
||||
}
|
||||
options.seasonFolder = seasonFolders;
|
||||
options.title = title;
|
||||
options.qualityProfileId = qualityId;
|
||||
options.tvdbId = tvdbId;
|
||||
options.titleSlug = title;
|
||||
options.seasons = new List<Season>();
|
||||
options.rootFolderPath = rootPath;
|
||||
|
||||
|
||||
request.AddHeader("X-Api-Key", apiKey);
|
||||
request.AddJsonBody(options);
|
||||
|
||||
var obj = Api.ExecuteJson<SonarrAddSeries>(request, baseUrl);
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue