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

522 lines
26 KiB

5 years ago
{% extends '_main.html' %}
5 years ago
5 years ago
{% block title %}Subtitles - Bazarr{% endblock %}
5 years ago
5 years ago
{% block page_head %}
5 years ago
5 years ago
{% endblock page_head %}
5 years ago
5 years ago
{% 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>
5 years ago
<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>
5 years ago
</div>
5 years ago
{% 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">
5 years ago
<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>
5 years ago
</div>
</div>
<div id="subfolder_div">
5 years ago
<div class="row">
<div class="col-sm-3 text-right">
<b>Custom Subtitle Folder</b>
5 years ago
</div>
5 years ago
<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 }}">
5 years ago
<label for="settings-general-subfolder_custom">Choose your own folder for Subtitles</label>
5 years ago
</div>
</div>
5 years ago
<br>
5 years ago
</div>
5 years ago
<div class="row">
<div class="col-sm-3 text-right">
<b>Upgrade Previously Downloaded Subtitles</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-upgrade_subs"
name="settings-general-upgrade_subs">
5 years ago
<span class="custom-control-label" for="settings-general-upgrade_subs"></span>
</label>
5 years ago
<label>Schedule a task to upgrade Subtitles previously downloaded by Bazarr.</label>
5 years ago
</div>
</div>
5 years ago
<br>
<div id="upgradesubs_div">
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Number of days to go back in history to upgrade subtitles (up to 30)</b>
5 years ago
</div>
5 years ago
<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">
5 years ago
</div>
</div>
5 years ago
<br>
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Upgrade Manually Downloaded Subtitles</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-upgrade_manual"
name="settings-general-upgrade_manual">
5 years ago
<span class="custom-control-label" for="settings-general-upgrade_manual"></span>
</label>
5 years ago
<label>Enable or disable upgrade of manually searched and downloaded Subtitles.</label>
5 years ago
</div>
</div>
5 years ago
<br>
5 years ago
</div>
5 years ago
<h4>Anti-Captcha Options</h4>
<hr/>
<div class="row">
<div class="col-sm-3 text-right">
<b>Provider</b>
5 years ago
</div>
5 years ago
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-anti_captcha_provider"
name="settings-general-anti_captcha_provider">
5 years ago
<option value="None">None</option>
5 years ago
<option value="anti-captcha">Anti-Captcha</option>
<option value="death-by-captcha">Death by Captcha</option>
5 years ago
</select>
<label for="settings-general-anti_captcha_provider">Choose the Anti-Captcha provider you want to
use.</label>
5 years ago
</div>
</div>
<div id="anticaptcha_div">
5 years ago
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Provider Website</b>
</div>
<div class="col-sm-4">
<a href="http://getcaptchasolution.com/eixxo1rsnw" target="_blank">Anti-Captcha.com</a>
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Account Key</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-anticaptcha-anti_captcha_key"
name="settings-anticaptcha-anti_captcha_key"
value="{{ settings.anticaptcha.anti_captcha_key }}">
5 years ago
</div>
</div>
<br>
</div>
<div id="deathbycaptcha_div">
5 years ago
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Provider Website</b>
</div>
<div class="col-sm-4">
<a href="https://www.deathbycaptcha.com" target="_blank">DeathByCaptcha.com</a>
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Username</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-deathbycaptcha-username"
name="settings-deathbycaptcha-username" value="{{ settings.deathbycaptcha.username }}">
5 years ago
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Password</b>
</div>
<div class="col-sm-4">
<input type="password" class="form-control" id="settings-deathbycaptcha-password"
name="settings-deathbycaptcha-password" value="{{ settings.deathbycaptcha.password }}">
5 years ago
</div>
</div>
<br>
</div>
<h4>Performance / Optimization</h4>
<hr>
<div class="row">
<div class="col-sm-3 text-right">
<b>Adaptive Searching</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-adaptive_searching"
name="settings-general-adaptive_searching">
5 years ago
<span class="custom-control-label" for="settings-general-adaptive_searching"></span>
</label>
<label>When searching for Subtitles, Bazarr will search less frequently to limit call to
providers.</label>
5 years ago
</div>
</div>
<div class="row">
<div class="col-sm-3 text-right">
<b>Search Enabled Providers Simultaneously</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-multithreading"
name="settings-general-multithreading">
5 years ago
<span class="custom-control-label" for="settings-general-multithreading"></span>
</label>
5 years ago
<label>Search multiple providers at once (Don't choose this on low powered devices)</label>
5 years ago
</div>
</div>
<div class="row">
<div class="col-sm-3 text-right">
<b>Use Embedded Subtitles</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-use_embedded_subs"
name="settings-general-use_embedded_subs">
5 years ago
<span class="custom-control-label" for="settings-general-use_embedded_subs"></span>
</label>
5 years ago
<label>Use embedded Subtitles in media files when determining missing ones.</label>
5 years ago
</div>
</div>
<div id="embedded_div">
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Ignore Embedded PGS Subtitles</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-ignore_pgs_subs"
name="settings-general-ignore_pgs_subs">
5 years ago
<span class="custom-control-label" for="settings-general-ignore_pgs_subs"></span>
</label>
<label>Ignores PGS Subtitles in Embedded Subtitles detection. Only relevant if 'Use embedded
Subtitles' is enabled.</label>
5 years ago
</div>
</div>
<div class="row">
<div class="col-sm-4 text-right">
<b>Show Only Desired Languages</b>
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input"
id="settings-general-embedded_subs_show_desired"
name="settings-general-embedded_subs_show_desired">
<span class="custom-control-label" for="settings-general-embedded_subs_show_desired"></span>
</label>
<label>Hide embedded subtitles for languages that are not currently desired.</label>
</div>
</div>
5 years ago
</div>
5 years ago
5 years ago
<h4>Post-Processing</h4>
<hr>
<div class="row">
<div class="col-sm-3 text-right">
<b>Encode Subtitles To UTF8</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-utf8_encode"
name="settings-general-utf8_encode">
5 years ago
<span class="custom-control-label" for="settings-general-utf8_encode"></span>
</label>
5 years ago
<label>Re-encode downloaded Subtitles to UTF8. Should be left enabled in most case.</label>
5 years ago
</div>
</div>
5 years ago
{% if not os.startswith('win') %}
5 years ago
<div class="row">
<div class="col-sm-3 text-right">
<b>Enable CHMOD</b>
5 years ago
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-chmod_enabled"
name="settings-general-chmod_enabled">
<span class="custom-control-label" for="settings-general-chmod_enabled"></span>
</label>
5 years ago
</div>
</div>
<div id="chmod_div">
<div class="row">
<div class="col-sm-4 text-right">
<b>Set Subtitle file permissions to</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-general-chmod"
name="settings-general-chmod" value="{{ settings.general.chmod }}">
<label for="settings-general-chmod">Must be 4 digit octal, e.g.: 0775</label>
</div>
</div>
<br>
</div>
5 years ago
{% endif %}
5 years ago
<div class="row">
<div class="col-sm-3 text-right">
<b>Use Custom Post-Processing</b>
</div>
5 years ago
<div class="form-group col-sm-8">
5 years ago
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-use_postprocessing"
name="settings-general-use_postprocessing">
5 years ago
<span class="custom-control-label" for="settings-general-use_postprocessing"></span>
</label>
5 years ago
<label>Enable the post-processing execution after downloading a subtitles.</label>
5 years ago
</div>
</div>
<div id="custompp_div">
5 years ago
<div class="row">
<div class="col-sm-4 text-right">
<b>Post-processing score threshold for series</b>
</div>
<div class="col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input"
id="settings-general-use_postprocessing_threshold"
name="settings-general-use_postprocessing_threshold">
<span class="custom-control-label"
for="settings-general-use_postprocessing_threshold"></span>
5 years ago
</label>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-5 text-right">
<b>Only for score below</b>
</div>
<div class="col-sm-1">
<input type="number" class="form-control" id="settings-general-postprocessing_threshold"
name="settings-general-postprocessing_threshold" min="0" max="100" step="1"
onkeydown="return false" value="{{ settings.general.postprocessing_threshold }}">
5 years ago
</div>
</div>
<br>
<div class="row">
<div class="col-sm-4 text-right">
<b>Post-processing score threshold for movies</b>
</div>
<div class="col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input"
id="settings-general-use_postprocessing_threshold_movie"
name="settings-general-use_postprocessing_threshold_movie">
<span class="custom-control-label"
for="settings-general-use_postprocessing_threshold_movie"></span>
5 years ago
</label>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-5 text-right">
<b>Only for score below</b>
</div>
<div class="col-sm-1">
<input type="number" class="form-control" id="settings-general-postprocessing_threshold_movie"
name="settings-general-postprocessing_threshold_movie" min="0" max="100" step="1"
onkeydown="return false" value="{{ settings.general.postprocessing_threshold_movie }}">
5 years ago
</div>
</div>
<br>
5 years ago
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Post-processing command</b>
</div>
<div class="col-sm-8">
<input type="text" class="form-control" id="settings-general-postprocessing_cmd"
name="settings-general-postprocessing_cmd"
value="{{ settings.general.postprocessing_cmd }}">
5 years ago
</div>
</div>
<br>
<div class="row">
5 years ago
<div class="col-sm-4 text-right">
5 years ago
<b>Variables you can use in your command (include the double curly brace):</b>
</div>
<div class="col-sm-8">
<b>&lbrace;&lbrace;directory&rbrace;&rbrace;</b>
<p>The full path of the episode file parent directory.</p>
<b>&lbrace;&lbrace;episode&rbrace;&rbrace;</b>
<p>The full path of the episode file.</p>
<b>&lbrace;&lbrace;episode_name&rbrace;&rbrace;</b>
<p>The filename of the episode without parent directory or extension.</p>
<b>&lbrace;&lbrace;subtitles&rbrace;&rbrace;</b>
<p>The full path of the subtitles file.</p>
<b>&lbrace;&lbrace;subtitles_language&rbrace;&rbrace;</b>
<p>The language of the subtitles file.</p>
<b>&lbrace;&lbrace;subtitles_language_code2&rbrace;&rbrace;</b>
<p>The 2-letter ISO-639 language code of the subtitles language.</p>
<b>&lbrace;&lbrace;subtitles_language_code3&rbrace;&rbrace;</b>
<p>The 3-letter ISO-639 language code of the subtitles language.</p>
<b>&lbrace;&lbrace;episode_language&rbrace;&rbrace;</b>
<p>The audio language of the episode file.</p>
<b>&lbrace;&lbrace;episode_language_code2&rbrace;&rbrace;</b>
<p>The 2-letter ISO-639 language code of the episode audio language.</p>
<b>&lbrace;&lbrace;episode_language_code3&rbrace;&rbrace;</b>
<p>The 3-letter ISO-639 language code of the episode audio language.</p>
<b>&lbrace;&lbrace;score&rbrace;&rbrace;</b>
<p>The score of the subtitles file.</p>
5 years ago
</div>
</div>
</div>
5 years ago
</form>
5 years ago
</div>
5 years ago
{% endblock body %}
{% block tail %}
<script>
$(document).ready(function () {
5 years ago
// Show warning if there's unsaved changes in the settings_form
var form_changed = false;
$(window).on('beforeunload', function () {
5 years ago
if (form_changed) {
return "";
}
});
5 years ago
// Hide checkmark over save button
$('#save_button_checkmark').hide();
5 years ago
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
5 years ago
// Hide *_div on Select input changed to None
$('#settings-general-subfolder').on('change', function () {
5 years ago
if ($(this).val() === 'current') {
$('#subfolder_div').hide();
} else {
$('#subfolder_div').show();
}
});
$('#settings-general-upgrade_subs').on('change', function () {
5 years ago
if ($(this).prop('checked')) {
$('#upgradesubs_div').show();
} else {
$('#upgradesubs_div').hide();
}
});
$('#settings-general-anti_captcha_provider').on('change', function () {
5 years ago
if ($(this).val() === 'anti-captcha') {
$('#anticaptcha_div').show();
$('#deathbycaptcha_div').hide();
} else if ($(this).val() === 'death-by-captcha') {
$('#anticaptcha_div').hide();
$('#deathbycaptcha_div').show();
} else {
$('#anticaptcha_div').hide();
$('#deathbycaptcha_div').hide();
}
});
$('#settings-general-use_embedded_subs').on('change', function () {
5 years ago
if ($(this).prop('checked')) {
$('#embedded_div').show();
} else {
$('#embedded_div').hide();
}
});
$('#settings-general-chmod_enabled').on('change', function () {
5 years ago
if ($(this).prop('checked')) {
$('#chmod_div').show();
} else {
$('#chmod_div').hide();
}
});
$('#settings-general-use_postprocessing').on('change', function () {
5 years ago
if ($(this).prop('checked')) {
$('#custompp_div').show();
} else {
$('#custompp_div').hide();
}
});
5 years ago
// 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
5 years ago
$('#settings-general-upgrade_subs').prop('checked', {{'true' if settings.general.getboolean('upgrade_subs') else 'false'}}).trigger('change');
$('#settings-general-upgrade_manual').prop('checked', {{'true' if settings.general.getboolean('upgrade_manual') else 'false'}}).trigger('change');
$('#settings-general-adaptive_searching').prop('checked', {{'true' if settings.general.getboolean('adaptive_searching') else 'false'}}).trigger('change');
$('#settings-general-multithreading').prop('checked', {{'true' if settings.general.getboolean('multithreading') else 'false'}}).trigger('change');
$('#settings-general-use_embedded_subs').prop('checked', {{'true' if settings.general.getboolean('use_embedded_subs') else 'false'}}).trigger('change');
$('#settings-general-ignore_pgs_subs').prop('checked', {{'true' if settings.general.getboolean('ignore_pgs_subs') else 'false'}}).trigger('change');
$('#settings-general-embedded_subs_show_desired').prop('checked', {{'true' if settings.general.getboolean('embedded_subs_show_desired') else 'false'}}).trigger('change');
5 years ago
$('#settings-general-utf8_encode').prop('checked', {{'true' if settings.general.getboolean('utf8_encode') else 'false'}}).trigger('change');
$('#settings-general-chmod_enabled').prop('checked', {{'true' if settings.general.getboolean('chmod_enabled') else 'false'}}).trigger('change');
$('#settings-general-use_postprocessing').prop('checked', {{'true' if settings.general.getboolean('use_postprocessing') else 'false'}}).trigger('change');
5 years ago
$('#settings-general-use_postprocessing_threshold').prop('checked', {{'true' if settings.general.getboolean('use_postprocessing_threshold') else 'false'}}).trigger('change');
$('#settings-general-use_postprocessing_threshold_movie').prop('checked', {{'true' if settings.general.getboolean('use_postprocessing_threshold_movie') else 'false'}}).trigger('change');
5 years ago
$('#save_button').on('click', function () {
5 years ago
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();
5 years ago
form_changed = false;
5 years ago
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
5 years ago
setTimeout(
function () {
5 years ago
$('#save_button_checkmark').hide();
}, 2000);
}
});
});
5 years ago
// monitor changes to the settings_form
$('#settings_form').on('change', function () {
5 years ago
form_changed = true;
5 years ago
$('#save_button').prop('disabled', false).css('cursor', 'auto');
5 years ago
})
5 years ago
});
</script>
{% endblock tail %}