You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/views/settingssonarr.html

208 lines
8.3 KiB

5 years ago
{% extends '_main.html' %}
5 years ago
5 years ago
{% block title %}Sonarr - Bazarr{% endblock %}
5 years ago
5 years ago
{% block page_head %}
5 years ago
5 years ago
{% endblock page_head %}
{% block bcleft %}
<div class="">
<button class="btn btn-outline" id="save_button">
<div>
<span class="fa-stack">
<i class="fas fa-save fa-stack-2x align-top text-themecolor text-center font-20" aria-hidden="true"></i>
<i id="save_button_checkmark" class="fas fa-check fa-stack-2x" style="color:green;"></i>
</span>
5 years ago
</div>
5 years ago
<div class="align-bottom text-themecolor small text-center">Save</div>
</button>
</div>
{% endblock bcleft %}
{% block bcright %}
{% endblock bcright %}
{% block body %}
<div class="container-fluid" style="padding-top: 3em;">
<form class="form" name="settings_form" id="settings_form">
<h4>Use Sonarr</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Enabled</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-use_sonarr" name="settings-general-use_sonarr">
<span class="custom-control-label" for="settings-general-use_sonarr"></span>
</label>
5 years ago
</div>
</div>
5 years ago
<br>
5 years ago
5 years ago
<div id="sonarr_div">
<h4>Host</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Hostname or IP Address</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-sonarr-ip" name="settings-sonarr-ip" value="{{settings.sonarr.ip}}">
</div>
5 years ago
</div>
5 years ago
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Port Number</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-sonarr-port" name="settings-sonarr-port" value="{{settings.sonarr.port}}">
5 years ago
</div>
</div>
5 years ago
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>URL Base</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-sonarr-base_url" name="settings-sonarr-base_url" value="{{settings.sonarr.base_url}}">
</div>
5 years ago
</div>
5 years ago
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>SSL Enabled</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-sonarr-ssl" name="settings-sonarr-ssl">
<span class="custom-control-label" for="settings-sonarr-ssl"></span>
</label>
</div>
5 years ago
</div>
5 years ago
<div class="row">
<div class="col-sm-2 text-right">
<b>API Key</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-sonarr-apikey" name="settings-sonarr-apikey" value="{{settings.sonarr.apikey}}">
5 years ago
</div>
</div>
5 years ago
<br>
<h4>Options</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Minimum Score</b>
</div>
<div class="col-sm-1">
<input type="number" min="0" max="100" step="1" onkeydown="return false" class="form-control" id="settings-general-minimum_score" name="settings-general-minimum_score" value="{{settings.general.minimum_score}}">
</div>
5 years ago
</div>
5 years ago
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Download Only Monitored</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-sonarr-only_monitored" name="settings-sonarr-only_monitored">
<span class="custom-control-label" for="settings-sonarr-only_monitored"></span>
</label>
</div>
5 years ago
</div>
5 years ago
<br>
<h4>PAth Mapping</h4>
<hr/>
<div class="row">
<table class="dataTable table table-striped" id="path_mapping">
</table>
5 years ago
</div>
5 years ago
<br>
5 years ago
</div>
5 years ago
</form>
5 years ago
</div>
5 years ago
{% endblock body %}
{% block tail %}
<script>
$(document).ready(function () {
// Hide checkmark over save button
$('#save_button_checkmark').hide();
// Hide *_div on Select input changed to None
$('#settings-general-use_sonarr').on('change', function() {
if ($(this).prop('checked')) {
$('#sonarr_div').show();
} else {
$('#sonarr_div').hide();
}
});
// Set Checkbox input values
$('#settings-general-use_sonarr').prop('checked', {{'true' if settings.general.getboolean('use_sonarr')}});
$('#settings-sonarr-ssl').prop('checked', {{'true' if settings.sonarr.getboolean('ssl')}});
$('#settings-sonarr-only_monitored').prop('checked', {{'true' if settings.sonarr.getboolean('only_monitored')}});
$('#save_button').on('click', function() {
var formdata = new FormData(document.getElementById("settings_form"));
// Make sure all checkbox input are sent with true/false value
$('input[type=checkbox]').each(function () {
formdata.set($(this).prop('id'), $(this).prop('checked'));
});
$.ajax({
url: "{{ url_for('api.savesettings') }}",
data: formdata,
processData: false,
contentType: false,
type: 'POST',
complete: function () {
$('#save_button_checkmark').show();
setTimeout(
function()
{
$('#save_button_checkmark').hide();
}, 2000);
}
});
});
table = $('#path_mapping').DataTable({
data: [["/tvsonarr", "/tvbazarr"]],
columns: [{
title: "Path for Sonarr",
type: "text"
}, {
title: "Path for Bazarr",
type: "text"
}],
dom: 'Bfrtip', // Needs button container
select: 'single',
responsive: true,
altEditor: true, // Enable altEditor
buttons: [{
text: 'Add',
name: 'add' // do not change name
},
{
extend: 'selected', // Bind to Selected row
text: 'Edit',
name: 'edit' // do not change name
},
{
extend: 'selected', // Bind to Selected row
text: 'Delete',
name: 'delete' // do not change name
}]
});
5 years ago
});
5 years ago
</script>
{% endblock tail %}