mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
Updated the logic for handling specific seasons in Sonarr and Sickrage
This commit is contained in:
parent
55addbee0a
commit
15f7572cf5
13 changed files with 101 additions and 68 deletions
|
@ -26,7 +26,7 @@
|
|||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
|
||||
using PlexRequests.Api.Models.Tv;
|
||||
|
@ -79,7 +79,25 @@ namespace PlexRequests.Api
|
|||
request.AddUrlSegment("id", theTvDbId.ToString());
|
||||
request.AddHeader("Content-Type", "application/json");
|
||||
|
||||
return Api.Execute<TvMazeShow>(request, new Uri(Uri));
|
||||
var obj = Api.Execute<TvMazeShow>(request, new Uri(Uri));
|
||||
obj.seasonCount = GetSeasonCount(obj.id);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public int GetSeasonCount(int id)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Method = Method.GET,
|
||||
Resource = "shows/{id}/seasons"
|
||||
};
|
||||
request.AddUrlSegment("id", id.ToString());
|
||||
request.AddHeader("Content-Type", "application/json");
|
||||
|
||||
var obj = Api.Execute<List<TvMazeSeasons>>(request, new Uri(Uri));
|
||||
var seasons = obj.Select(x => x.number > 0);
|
||||
return seasons.Count();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue