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/settingssubtitles.html

172 lines
7.5 KiB

{% extends '_main.html' %}
{% block title %}Subtitles - Bazarr{% endblock %}
{% block page_head %}
{% 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>
</div>
<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>Subtitles Options</h4>
<hr/>
<div class="row">
<div class="col-sm-3 text-right">
<b>Subtitle Folder</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-subfolder" name="settings-general-subfolder">
<option value="current">Alongside Media File</option>
<option value="relative">Relative Path To Media File</option>
<option value="absolute">Absolute Path</option>
</select>
<label for="settings-general-subfolder">Choose the folder you wish to store/read the Subtitles</label>
</div>
</div>
<div id="subfolder_div">
<div class="row">
<div class="col-sm-3 text-right">
<b>Custom Subtitle Folder</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-general-subfolder_custom" name="settings-general-subfolder_custom" value="{{settings.general.subfolder_custom}}">
<label for="settings-general-subfolder_custom">Choose your own folder for Subtitles</label>
</div>
</div>
<br>
</div>
<div class="row">
<div class="col-sm-3 text-right">
<b>Upgrade Previously Downloaded Subtitles</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-upgrade_subs" name="settings-general-upgrade_subs">
<span class="custom-control-label" for="settings-general-upgrade_subs"></span>
</label>
</div>
</div>
<br>
<div id="upgradesubs_div">
<div class="row">
<div class="col-sm-3 text-right">
<b>Number of days to go back in history to upgrade subtitles (up to 30)</b>
</div>
<div class="col-sm-4">
<input type="number" class="form-control" id="settings-general-days_to_upgrade_subs" name="settings-general-days_to_upgrade_subs" min="1" max="30" value="{{settings.general.days_to_upgrade_subs}}" onkeydown="return false">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-3 text-right">
<b>Upgrade Manually Downloaded Subtitles</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-upgrade_manual" name="settings-general-upgrade_manual">
<span class="custom-control-label" for="settings-general-upgrade_manual"></span>
</label>
</div>
</div>
<br>
</div>
<h4>Anti-Captcha Options</h4>
<hr/>
<div class="row">
<div class="col-sm-3 text-right">
<b>Provider</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-anti_captcha_provider" name="settings-general-anti_captcha_provider">
<option value="None">None</option>
<option value="anti-captcha">Anti-Captcha</option>
<option value="death-by-captcha">Death by Captcha</option>
</select>
<label for="settings-general-anti_captcha_provider">Choose the Anti-Captcha provider you want to use.</label>
</div>
</div>
</form>
</div>
{% 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-subfolder').on('change', function() {
if ($(this).val() === 'current') {
$('#subfolder_div').hide();
} else {
$('#subfolder_div').show();
}
});
$('#settings-general-upgrade_subs').on('change', function() {
if ($(this).prop('checked')) {
$('#upgradesubs_div').show();
} else {
$('#upgradesubs_div').hide();
}
});
// Set Select input values
$('#settings-general-subfolder').val('{{settings.general.subfolder}}').trigger('change');
$('#settings-general-anti_captcha_provider').val('{{settings.general.anti_captcha_provider}}').trigger('change');
$('.selectpicker').selectpicker('refresh')
// Set Checkbox input values
$('#settings-general-upgrade_subs').prop('checked', {{'true' if settings.general.getboolean('upgrade_subs')}}).trigger('change');;
$('#settings-general-upgrade_manual').prop('checked', {{'true' if settings.general.getboolean('upgrade_manual')}}).trigger('change');;
$('#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);
}
});
});
});
</script>
{% endblock tail %}