mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
Started to add the specify Sonarr root folders.
This commit is contained in:
parent
ee66cd66e9
commit
1c6e75a413
16 changed files with 316 additions and 59 deletions
|
@ -17,14 +17,14 @@
|
|||
<legend>Sonarr Settings</legend>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
@if (Model.Enabled)
|
||||
{
|
||||
<input type="checkbox" id="Enabled" name="Enabled" checked="checked"><label for="Enabled">Enabled</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Enabled" name="Enabled"><label for="Enabled">Enabled</label>
|
||||
}
|
||||
@if (Model.Enabled)
|
||||
{
|
||||
<input type="checkbox" id="Enabled" name="Enabled" checked="checked"><label for="Enabled">Enabled</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Enabled" name="Enabled"><label for="Enabled">Enabled</label>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -51,14 +51,14 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
@if (Model.Ssl)
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl" checked="checked"><label for="Ssl">SSL</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl"><label for="Ssl">SSL</label>
|
||||
}
|
||||
@if (Model.Ssl)
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl" checked="checked"><label for="Ssl">SSL</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl"><label for="Ssl">SSL</label>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -69,7 +69,7 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button type="submit" id="getProfiles" class="btn btn-primary-outline">Get Quality Profiles <div id="getSpinner"/></button>
|
||||
<button type="submit" id="getProfiles" class="btn btn-primary-outline">Get Quality Profiles <div id="getSpinner" /></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -80,32 +80,47 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="RootPath" class="control-label">Root save directory for TV shows</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " placeholder="C:\Media\Tv" id="RootPath" name="RootPath" value="@Model.RootPath">
|
||||
<label>Enter the root folder where tv shows are saved. For example <strong>C:\Media\TV</strong>.</label>
|
||||
<button type="submit" id="getRootFolders" class="btn btn-primary-outline">Get RootFolders <div id="getRootFolderSpinner" /></button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="selectRootFolder" class="control-label">Root Folders</label>
|
||||
<div id="rootFolders">
|
||||
<select class="form-control form-control-custom" id="selectRootFolder"></select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@*<div class="form-group">
|
||||
<label for="RootPath" class="control-label">Root save directory for TV shows</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " placeholder="C:\Media\Tv" id="RootPath" name="RootPath" value="@Model.RootPath">
|
||||
<label>Enter the root folder where tv shows are saved. For example <strong>C:\Media\TV</strong>.</label>
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.SeasonFolders)
|
||||
{
|
||||
<input type="checkbox" id="SeasonFolders" name="SeasonFolders" checked="checked">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="SeasonFolders" name="SeasonFolders">
|
||||
}
|
||||
<label for="SeasonFolders">Enable season folders</label>
|
||||
@if (Model.SeasonFolders)
|
||||
{
|
||||
<input type="checkbox" id="SeasonFolders" name="SeasonFolders" checked="checked">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="SeasonFolders" name="SeasonFolders">
|
||||
}
|
||||
<label for="SeasonFolders">Enable season folders</label>
|
||||
|
||||
</div>
|
||||
<label>Enabled Season Folders to organize seasons into individual folders within a show.</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="testSonarr" type="submit" class="btn btn-primary-outline">Test Connectivity <div id="spinner"/></button>
|
||||
<button id="testSonarr" type="submit" class="btn btn-primary-outline">Test Connectivity <div id="spinner" /></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -161,6 +176,39 @@
|
|||
</text>
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.RootFolder))
|
||||
{
|
||||
<text>
|
||||
|
||||
console.log('Hit root folders..');
|
||||
|
||||
var rootFolderSelected = @Model.RootFolder;
|
||||
if (!rootFolderSelected) {
|
||||
return;
|
||||
}
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: "sonarrrootfolders",
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
response.forEach(function(result) {
|
||||
if (result.id == rootFolderSelected) {
|
||||
$("#selectRootFolder").append("<option selected='selected' value='" + result.id + "'>" + result.path + "</option>");
|
||||
} else {
|
||||
$("#selectRootFolder").append("<option value='" + result.id + "'>" + result.path + "</option>");
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
</text>
|
||||
}
|
||||
|
||||
|
||||
$('#save').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
@ -201,17 +249,17 @@
|
|||
e.preventDefault();
|
||||
if (!$('#Ip').val()) {
|
||||
generateNotify("Please enter a valid IP/Hostname.", "warning");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
if (!$('#portNumber').val()) {
|
||||
generateNotify("Please enter a valid Port Number.", "warning");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
if (!$('#ApiKey').val()) {
|
||||
generateNotify("Please enter a valid ApiKey.", "warning");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
var $form = $("#mainForm");
|
||||
|
@ -222,18 +270,58 @@
|
|||
dataType: "json",
|
||||
success: function (response) {
|
||||
response.forEach(function (result) {
|
||||
$('#getSpinner').attr("class", "fa fa-check");
|
||||
$('#getSpinner').attr("class", "fa fa-check");
|
||||
$("#select").append("<option value='" + result.id + "'>" + result.name + "</option>");
|
||||
});
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
$('#getSpinner').attr("class", "fa fa-times");
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#getRootFolders').click(function (e) {
|
||||
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-spinner fa-spin");
|
||||
e.preventDefault();
|
||||
if (!$('#Ip').val()) {
|
||||
generateNotify("Please enter a valid IP/Hostname.", "warning");
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
if (!$('#portNumber').val()) {
|
||||
generateNotify("Please enter a valid Port Number.", "warning");
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
if (!$('#ApiKey').val()) {
|
||||
generateNotify("Please enter a valid ApiKey.", "warning");
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
return;
|
||||
}
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: "sonarrrootfolders",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
response.forEach(function (result) {
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-check");
|
||||
$("#selectRootFolder").append("<option value='" + result.id + "'>" + result.path + "</option>");
|
||||
});
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
$('#getRootFolderSpinner').attr("class", "fa fa-times");
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
$('#testSonarr').click(function (e) {
|
||||
|
||||
|
@ -245,7 +333,7 @@
|
|||
|
||||
var data = $form.serialize();
|
||||
data = data + "&qualityProfile=" + qualityProfile;
|
||||
|
||||
|
||||
var url = createBaseUrl(base, '/test/sonarr');
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
|
@ -256,16 +344,16 @@
|
|||
console.log(response);
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
$('#spinner').attr("class", "fa fa-check");
|
||||
$('#spinner').attr("class", "fa fa-check");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue