mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
Started on sonarr #865
This commit is contained in:
parent
3ee65f4f0c
commit
2c945ebb9b
10 changed files with 358 additions and 44 deletions
|
@ -24,18 +24,21 @@ namespace Ombi.Core.Engine
|
|||
{
|
||||
public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user,
|
||||
INotificationHelper helper, IMapper map,
|
||||
IRuleEvaluator rule, IUserIdentityManager manager) : base(user, requestService, rule)
|
||||
IRuleEvaluator rule, IUserIdentityManager manager,
|
||||
ITvSender sender) : base(user, requestService, rule)
|
||||
{
|
||||
TvApi = tvApi;
|
||||
NotificationHelper = helper;
|
||||
Mapper = map;
|
||||
UserManager = manager;
|
||||
TvSender = sender;
|
||||
}
|
||||
|
||||
private INotificationHelper NotificationHelper { get; }
|
||||
private ITvMazeApi TvApi { get; }
|
||||
private IMapper Mapper { get; }
|
||||
private IUserIdentityManager UserManager { get; }
|
||||
private ITvSender TvSender {get;}
|
||||
|
||||
public async Task<RequestEngineResult> RequestTvShow(SearchTvShowViewModel tv)
|
||||
{
|
||||
|
@ -223,7 +226,8 @@ namespace Ombi.Core.Engine
|
|||
Status = showInfo.status,
|
||||
ImdbId = showInfo.externals?.imdb ?? string.Empty,
|
||||
TvDbId = tv.Id,
|
||||
ChildRequests = new List<ChildRequests>()
|
||||
ChildRequests = new List<ChildRequests>(),
|
||||
TotalSeasons = tv.SeasonRequests.Count()
|
||||
};
|
||||
model.ChildRequests.Add(childRequest);
|
||||
return await AddRequest(model);
|
||||
|
@ -294,6 +298,12 @@ namespace Ombi.Core.Engine
|
|||
//NotificationHelper.NewRequest(model.ParentRequest);
|
||||
}
|
||||
|
||||
if(model.Approved)
|
||||
{
|
||||
// Autosend
|
||||
TvSender.SendToSonarr(model,model.ParentRequest.TotalSeasons);
|
||||
}
|
||||
|
||||
//var limit = await RequestLimitRepo.GetAllAsync();
|
||||
//var usersLimit = limit.FirstOrDefault(x => x.Username == Username && x.RequestType == model.Type);
|
||||
//if (usersLimit == null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue