mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 16:22:55 -07:00
Fixed #244
This commit is contained in:
parent
573ad84fd8
commit
25714f03f7
2 changed files with 53 additions and 21 deletions
|
@ -50,7 +50,7 @@ namespace PlexRequests.UI.Modules
|
||||||
ISettingsService<SonarrSettings> sonarrSettings, ISickRageApi srApi, ISettingsService<SickRageSettings> srSettings,
|
ISettingsService<SonarrSettings> sonarrSettings, ISickRageApi srApi, ISettingsService<SickRageSettings> srSettings,
|
||||||
ISettingsService<HeadphonesSettings> hpSettings, IHeadphonesApi hpApi, ISettingsService<PlexRequestSettings> pr) : base("approval", pr)
|
ISettingsService<HeadphonesSettings> hpSettings, IHeadphonesApi hpApi, ISettingsService<PlexRequestSettings> pr) : base("approval", pr)
|
||||||
{
|
{
|
||||||
this.RequiresClaims(UserClaims.Admin);
|
this.RequiresClaims(UserClaims.Admin);
|
||||||
|
|
||||||
Service = service;
|
Service = service;
|
||||||
CpService = cpService;
|
CpService = cpService;
|
||||||
|
@ -130,7 +130,7 @@ namespace PlexRequests.UI.Modules
|
||||||
Log.Trace("Approval result: {0}", requestResult);
|
Log.Trace("Approval result: {0}", requestResult);
|
||||||
if (requestResult)
|
if (requestResult)
|
||||||
{
|
{
|
||||||
return Response.AsJson(new JsonResponseModel {Result = true});
|
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
Response.AsJson(new JsonResponseModel
|
Response.AsJson(new JsonResponseModel
|
||||||
|
@ -156,11 +156,9 @@ namespace PlexRequests.UI.Modules
|
||||||
request.Approved = true;
|
request.Approved = true;
|
||||||
var requestResult = Service.UpdateRequest(request);
|
var requestResult = Service.UpdateRequest(request);
|
||||||
Log.Trace("Approval result: {0}", requestResult);
|
Log.Trace("Approval result: {0}", requestResult);
|
||||||
if (requestResult)
|
return Response.AsJson(requestResult
|
||||||
{
|
? new JsonResponseModel { Result = true }
|
||||||
return Response.AsJson(new JsonResponseModel { Result = true });
|
: new JsonResponseModel { Result = false, Message = "Updated SickRage but could not approve it in PlexRequests :(" });
|
||||||
}
|
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Updated SickRage but could not approve it in PlexRequests :(" });
|
|
||||||
}
|
}
|
||||||
return Response.AsJson(new JsonResponseModel
|
return Response.AsJson(new JsonResponseModel
|
||||||
{
|
{
|
||||||
|
@ -168,11 +166,13 @@ namespace PlexRequests.UI.Modules
|
||||||
Message = result?.message != null ? "<b>Message From SickRage: </b>" + result.message : "Could not add the series to SickRage"
|
Message = result?.message != null ? "<b>Message From SickRage: </b>" + result.message : "Could not add the series to SickRage"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Response.AsJson(new JsonResponseModel
|
|
||||||
{
|
|
||||||
Result = false,
|
request.Approved = true;
|
||||||
Message = "SickRage or Sonarr are not set up!"
|
var res = Service.UpdateRequest(request);
|
||||||
});
|
return Response.AsJson(res
|
||||||
|
? new JsonResponseModel { Result = true, Message = "This has been approved, but It has not been sent to Sonarr/SickRage because it has not been configured" }
|
||||||
|
: new JsonResponseModel { Result = false, Message = "Updated SickRage but could not approve it in PlexRequests :(" });
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response RequestMovieAndUpdateStatus(RequestedModel request, string qualityId)
|
private Response RequestMovieAndUpdateStatus(RequestedModel request, string qualityId)
|
||||||
|
@ -248,9 +248,9 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
var sender = new HeadphonesSender(HeadphoneApi, hpSettings, Service);
|
var sender = new HeadphonesSender(HeadphoneApi, hpSettings, Service);
|
||||||
var result = sender.AddAlbum(request);
|
var result = sender.AddAlbum(request);
|
||||||
|
|
||||||
|
|
||||||
return Response.AsJson( new JsonResponseModel { Result = true, Message = "We have sent the approval to Headphones for processing, This can take a few minutes."} );
|
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = "We have sent the approval to Headphones for processing, This can take a few minutes." });
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response ApproveAllMovies()
|
private Response ApproveAllMovies()
|
||||||
|
@ -327,15 +327,23 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
if (r.Type == RequestType.Movie)
|
if (r.Type == RequestType.Movie)
|
||||||
{
|
{
|
||||||
var res = SendMovie(cpSettings, r, CpApi);
|
if (cpSettings.Enabled)
|
||||||
if (res)
|
|
||||||
{
|
{
|
||||||
r.Approved = true;
|
var res = SendMovie(cpSettings, r, CpApi);
|
||||||
updatedRequests.Add(r);
|
if (res)
|
||||||
|
{
|
||||||
|
r.Approved = true;
|
||||||
|
updatedRequests.Add(r);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Error("Could not approve and send the movie {0} to couch potato!", r.Title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Error("Could not approve and send the movie {0} to couch potato!", r.Title);
|
r.Approved = true;
|
||||||
|
updatedRequests.Add(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r.Type == RequestType.TvShow)
|
if (r.Type == RequestType.TvShow)
|
||||||
|
@ -358,7 +366,7 @@ namespace PlexRequests.UI.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sonarr.Enabled)
|
else if (sonarr.Enabled)
|
||||||
{
|
{
|
||||||
var res = sender.SendToSonarr(sonarr, r);
|
var res = sender.SendToSonarr(sonarr, r);
|
||||||
if (!string.IsNullOrEmpty(res?.title))
|
if (!string.IsNullOrEmpty(res?.title))
|
||||||
|
@ -372,6 +380,11 @@ namespace PlexRequests.UI.Modules
|
||||||
res?.ErrorMessages.ForEach(x => Log.Error("Error messages: {0}", x));
|
res?.ErrorMessages.ForEach(x => Log.Error("Error messages: {0}", x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r.Approved = true;
|
||||||
|
updatedRequests.Add(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
|
|
@ -606,7 +606,7 @@ namespace PlexRequests.UI.Modules
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"{fullShowName} is already in Plex!" });
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"{fullShowName} is already in Plex!" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ApplicationSettingsException)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"We could not check if {fullShowName} is in Plex, are you sure it's correctly setup?" });
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = $"We could not check if {fullShowName} is in Plex, are you sure it's correctly setup?" });
|
||||||
}
|
}
|
||||||
|
@ -718,6 +718,25 @@ namespace PlexRequests.UI.Modules
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = result?.message != null ? "<b>Message From SickRage: </b>" + result.message : "Something went wrong adding the movie to SickRage! Please check your settings." });
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = result?.message != null ? "<b>Message From SickRage: </b>" + result.message : "Something went wrong adding the movie to SickRage! Please check your settings." });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!srSettings.Enabled && !sonarrSettings.Enabled)
|
||||||
|
{
|
||||||
|
model.Approved = true;
|
||||||
|
Log.Debug("Adding tv to database requests (No approval required) and Sonarr/Sickrage not setup");
|
||||||
|
RequestService.AddRequest(model);
|
||||||
|
if (ShouldSendNotification())
|
||||||
|
{
|
||||||
|
var notify2 = new NotificationModel
|
||||||
|
{
|
||||||
|
Title = model.Title,
|
||||||
|
User = Username,
|
||||||
|
DateTime = DateTime.Now,
|
||||||
|
NotificationType = NotificationType.NewRequest
|
||||||
|
};
|
||||||
|
NotificationService.Publish(notify2);
|
||||||
|
}
|
||||||
|
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullShowName} was successfully added!" });
|
||||||
|
}
|
||||||
|
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "The request of TV Shows is not correctly set up. Please contact your admin." });
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "The request of TV Shows is not correctly set up. Please contact your admin." });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue