mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 08:16:05 -07:00
Finished #71
This commit is contained in:
parent
af6deec3f0
commit
37fa7809cc
6 changed files with 49 additions and 20 deletions
|
@ -64,7 +64,7 @@ namespace PlexRequests.Api
|
||||||
};
|
};
|
||||||
|
|
||||||
var options = new SonarrAddSeries();
|
var options = new SonarrAddSeries();
|
||||||
if (episodes == true)
|
if (episodes)
|
||||||
{
|
{
|
||||||
options.addOptions = new AddOptions
|
options.addOptions = new AddOptions
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace PlexRequests.Core.SettingModels
|
||||||
{
|
{
|
||||||
public class CouchPotatoSettings : Settings
|
public class CouchPotatoSettings : Settings
|
||||||
{
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
public string Ip { get; set; }
|
public string Ip { get; set; }
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
|
|
|
@ -198,7 +198,11 @@ $(document).on("click", ".approve", function (e) {
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
|
|
||||||
if (checkJsonResponse(response)) {
|
if (checkJsonResponse(response)) {
|
||||||
|
if (response.message) {
|
||||||
|
generateNotify(response.message, "success");
|
||||||
|
} else {
|
||||||
generateNotify("Success! Request Approved.", "success");
|
generateNotify("Success! Request Approved.", "success");
|
||||||
|
}
|
||||||
|
|
||||||
$("button[custom-button='" + buttonId + "']").remove();
|
$("button[custom-button='" + buttonId + "']").remove();
|
||||||
$("#" + buttonId + "notapproved").prop("class", "fa fa-check");
|
$("#" + buttonId + "notapproved").prop("class", "fa fa-check");
|
||||||
|
|
|
@ -177,6 +177,21 @@ namespace PlexRequests.UI.Modules
|
||||||
var cpSettings = CpService.GetSettings();
|
var cpSettings = CpService.GetSettings();
|
||||||
var cp = new CouchPotatoApi();
|
var cp = new CouchPotatoApi();
|
||||||
Log.Info("Adding movie to CP : {0}", request.Title);
|
Log.Info("Adding movie to CP : {0}", request.Title);
|
||||||
|
if (!cpSettings.Enabled)
|
||||||
|
{
|
||||||
|
// Approve it
|
||||||
|
request.Approved = true;
|
||||||
|
|
||||||
|
// Update the record
|
||||||
|
var inserted = Service.UpdateRequest(request);
|
||||||
|
return Response.AsJson(inserted
|
||||||
|
? new JsonResponseModel { Result = true, Message = "This has been approved, but It has not been sent to CouchPotato because it has not been configured." }
|
||||||
|
: new JsonResponseModel
|
||||||
|
{
|
||||||
|
Result = false,
|
||||||
|
Message = "We could not approve this request. Please try again or check the logs."
|
||||||
|
});
|
||||||
|
}
|
||||||
var result = cp.AddMovie(request.ImdbId, cpSettings.ApiKey, request.Title, cpSettings.FullUri, cpSettings.ProfileId);
|
var result = cp.AddMovie(request.ImdbId, cpSettings.ApiKey, request.Title, cpSettings.FullUri, cpSettings.ProfileId);
|
||||||
Log.Trace("Adding movie to CP result {0}", result);
|
Log.Trace("Adding movie to CP result {0}", result);
|
||||||
if (result)
|
if (result)
|
||||||
|
|
|
@ -176,15 +176,6 @@ namespace PlexRequests.UI.Modules
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Debug("movie with id {0} doesnt exists", movieId);
|
Log.Debug("movie with id {0} doesnt exists", movieId);
|
||||||
var cpSettings = CpService.GetSettings();
|
|
||||||
if (cpSettings.ApiKey == null)
|
|
||||||
{
|
|
||||||
Log.Warn("CP apiKey is null");
|
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "CouchPotato is not yet configured, If you are the Admin, please log in." });
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.Trace("Settings: ");
|
|
||||||
Log.Trace(cpSettings.DumpJson);
|
|
||||||
|
|
||||||
var movieApi = new TheMovieDbApi();
|
var movieApi = new TheMovieDbApi();
|
||||||
var movieInfo = movieApi.GetMovieInformation(movieId).Result;
|
var movieInfo = movieApi.GetMovieInformation(movieId).Result;
|
||||||
|
@ -219,6 +210,11 @@ namespace PlexRequests.UI.Modules
|
||||||
Log.Trace(settings.DumpJson());
|
Log.Trace(settings.DumpJson());
|
||||||
if (!settings.RequireApproval)
|
if (!settings.RequireApproval)
|
||||||
{
|
{
|
||||||
|
var cpSettings = CpService.GetSettings();
|
||||||
|
|
||||||
|
Log.Trace("Settings: ");
|
||||||
|
Log.Trace(cpSettings.DumpJson);
|
||||||
|
|
||||||
Log.Info("Adding movie to CP (No approval required)");
|
Log.Info("Adding movie to CP (No approval required)");
|
||||||
var result = CouchPotatoApi.AddMovie(model.ImdbId, cpSettings.ApiKey, model.Title, cpSettings.FullUri, cpSettings.ProfileId);
|
var result = CouchPotatoApi.AddMovie(model.ImdbId, cpSettings.ApiKey, model.Title, cpSettings.FullUri, cpSettings.ProfileId);
|
||||||
Log.Debug("Adding movie to CP result {0}", result);
|
Log.Debug("Adding movie to CP result {0}", result);
|
||||||
|
|
|
@ -14,7 +14,20 @@
|
||||||
<form class="form-horizontal" method="POST" id="mainForm">
|
<form class="form-horizontal" method="POST" id="mainForm">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>CouchPotato Settings</legend>
|
<legend>CouchPotato Settings</legend>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
@if (Model.Enabled)
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="Enabled" name="Enabled" checked="checked"><text>Enabled</text>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="Enabled" name="Enabled"><text>Enabled</text>
|
||||||
|
}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Ip" class="control-label">CouchPotato Hostname or IP</label>
|
<label for="Ip" class="control-label">CouchPotato Hostname or IP</label>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue