mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 18:47:15 -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
37
PlexRequests.Api/MockApiData.Designer.cs
generated
37
PlexRequests.Api/MockApiData.Designer.cs
generated
|
@ -60,6 +60,43 @@ namespace PlexRequests.Api {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {
|
||||
/// "title": "Archer (2009)",
|
||||
/// "seasons": [
|
||||
/// {
|
||||
/// "seasonNumber": 5,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 4,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 3,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 2,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 1,
|
||||
/// "monitored": true
|
||||
/// },
|
||||
/// {
|
||||
/// "seasonNumber": 0,
|
||||
/// "monitored": false
|
||||
/// }
|
||||
/// ],
|
||||
/// "pat [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string Sonarr_AddSeriesResult {
|
||||
get {
|
||||
return ResourceManager.GetString("Sonarr_AddSeriesResult", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to [
|
||||
/// {
|
||||
|
|
|
@ -117,6 +117,47 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Sonarr_AddSeriesResult" xml:space="preserve">
|
||||
<value>{
|
||||
"title": "Archer (2009)",
|
||||
"seasons": [
|
||||
{
|
||||
"seasonNumber": 5,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 4,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 3,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 2,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 1,
|
||||
"monitored": true
|
||||
},
|
||||
{
|
||||
"seasonNumber": 0,
|
||||
"monitored": false
|
||||
}
|
||||
],
|
||||
"path": "T:\\Archer (2009)",
|
||||
"qualityProfileId": 1,
|
||||
"seasonFolder": true,
|
||||
"monitored": true,
|
||||
"tvdbId": 110381,
|
||||
"tvRageId": 23354,
|
||||
"cleanTitle": "archer2009",
|
||||
"imdbId": "tt1486217",
|
||||
"titleSlug": "archer-2009",
|
||||
"id": 1
|
||||
}</value>
|
||||
</data>
|
||||
<data name="Sonarr_Profiles" xml:space="preserve">
|
||||
<value>[
|
||||
{
|
||||
|
|
|
@ -42,5 +42,13 @@ namespace PlexRequests.Api.Mocks
|
|||
var obj = JsonConvert.DeserializeObject<List<SonarrProfile>>(json);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, bool episodes,
|
||||
string apiKey, Uri baseUrl)
|
||||
{
|
||||
var json = MockApiData.Sonarr_AddSeriesResult;
|
||||
var obj = JsonConvert.DeserializeObject<SonarrAddSeries>(json);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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