Post-Processing Score tag Added

pull/1038/head
Halali 4 years ago
parent 84ad5aaeaa
commit 9bd725beb2

@ -220,10 +220,10 @@ def download_subtitle(path, language, audio_language, hi, forced, providers, pro
+ "%."
if use_postprocessing is True:
percent_score = round(subtitle.score * 100 / max_score, 2)
command = pp_replace(postprocessing_cmd, path, downloaded_path, downloaded_language,
downloaded_language_code2, downloaded_language_code3, audio_language,
audio_language_code2, audio_language_code3, subtitle.language.forced)
percent_score = round(subtitle.score * 100 / max_score, 2)
audio_language_code2, audio_language_code3, subtitle.language.forced, percent_score)
if media_type == 'series':
use_pp_threshold = settings.general.getboolean('use_postprocessing_threshold')
@ -445,10 +445,10 @@ def manual_download_subtitle(path, language, audio_language, hi, forced, subtitl
score) + "% using manual search."
if use_postprocessing is True:
percent_score = round(subtitle.score * 100 / max_score, 2)
command = pp_replace(postprocessing_cmd, path, downloaded_path, downloaded_language,
downloaded_language_code2, downloaded_language_code3, audio_language,
audio_language_code2, audio_language_code3, subtitle.language.forced)
percent_score = round(subtitle.score * 100 / max_score, 2)
audio_language_code2, audio_language_code3, subtitle.language.forced, percent_score)
if media_type == 'series':
use_pp_threshold = settings.general.getboolean('use_postprocessing_threshold')
@ -560,10 +560,10 @@ def manual_upload_subtitle(path, language, forced, title, scene_name, media_type
audio_language_code3 = alpha3_from_language(audio_language)
if use_postprocessing is True:
if use_postprocessing:
command = pp_replace(postprocessing_cmd, path, subtitle_path, uploaded_language,
uploaded_language_code2, uploaded_language_code3, audio_language,
audio_language_code2, audio_language_code3, forced)
audio_language_code2, audio_language_code3, forced, 100)
postprocessing(command, path)

@ -95,7 +95,7 @@ class PathMappings:
path_mappings = PathMappings()
def pp_replace(pp_command, episode, subtitles, language, language_code2, language_code3, episode_language, episode_language_code2, episode_language_code3, forced):
def pp_replace(pp_command, episode, subtitles, language, language_code2, language_code3, episode_language, episode_language_code2, episode_language_code3, forced, score):
is_forced = ":forced" if forced else ""
is_forced_string = " forced" if forced else ""
pp_command = pp_command.replace('{{directory}}', os.path.dirname(episode))
@ -108,6 +108,7 @@ def pp_replace(pp_command, episode, subtitles, language, language_code2, languag
pp_command = pp_command.replace('{{episode_language}}', episode_language)
pp_command = pp_command.replace('{{episode_language_code2}}', episode_language_code2)
pp_command = pp_command.replace('{{episode_language_code3}}', episode_language_code3)
pp_command = pp_command.replace('{{score}}', score)
return pp_command

@ -130,7 +130,7 @@
<!-- ============================================================== -->
<!-- Search -->
<!-- ============================================================== -->
<li class="nav-item hidden-sm-down search-box">
<li class="nav-item search-box">
<form class="form-material">
<div class="typeahead__container">
<div class="typeahead__field">

@ -11,7 +11,8 @@
<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 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>
@ -34,21 +35,24 @@
<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">
<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>
<label for="settings-general-subfolder">Choose the folder you wish to store/read the
Subtitles</label>
</div>
</div>
<div id="subfolder_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}}">
<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>
@ -60,7 +64,8 @@
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-upgrade_subs" name="settings-general-upgrade_subs">
<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>
<label>Schedule a task to upgrade Subtitles previously downloaded by Bazarr.</label>
@ -73,7 +78,9 @@
<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">
<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>
@ -83,7 +90,8 @@
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-upgrade_manual" name="settings-general-upgrade_manual">
<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>
<label>Enable or disable upgrade of manually searched and downloaded Subtitles.</label>
@ -99,15 +107,17 @@
<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">
<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>
<label for="settings-general-anti_captcha_provider">Choose the Anti-Captcha provider you want to
use.</label>
</div>
</div>
<div id="anticaptcha_div">
<div id="anticaptcha_div">
<div class="row">
<div class="col-sm-4 text-right">
<b>Provider Website</b>
@ -122,12 +132,14 @@
<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}}">
<input type="text" class="form-control" id="settings-anticaptcha-anti_captcha_key"
name="settings-anticaptcha-anti_captcha_key"
value="{{ settings.anticaptcha.anti_captcha_key }}">
</div>
</div>
<br>
</div>
<div id="deathbycaptcha_div">
<div id="deathbycaptcha_div">
<div class="row">
<div class="col-sm-4 text-right">
<b>Provider Website</b>
@ -142,7 +154,8 @@
<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}}">
<input type="text" class="form-control" id="settings-deathbycaptcha-username"
name="settings-deathbycaptcha-username" value="{{ settings.deathbycaptcha.username }}">
</div>
</div>
<br>
@ -151,7 +164,8 @@
<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}}">
<input type="password" class="form-control" id="settings-deathbycaptcha-password"
name="settings-deathbycaptcha-password" value="{{ settings.deathbycaptcha.password }}">
</div>
</div>
<br>
@ -165,10 +179,12 @@
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-adaptive_searching" name="settings-general-adaptive_searching">
<input type="checkbox" class="custom-control-input" id="settings-general-adaptive_searching"
name="settings-general-adaptive_searching">
<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>
<label>When searching for Subtitles, Bazarr will search less frequently to limit call to
providers.</label>
</div>
</div>
<div class="row">
@ -177,7 +193,8 @@
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-multithreading" name="settings-general-multithreading">
<input type="checkbox" class="custom-control-input" id="settings-general-multithreading"
name="settings-general-multithreading">
<span class="custom-control-label" for="settings-general-multithreading"></span>
</label>
<label>Search multiple providers at once (Don't choose this on low powered devices)</label>
@ -189,7 +206,8 @@
</div>
<div class="form-group col-sm-8">
<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">
<input type="checkbox" class="custom-control-input" id="settings-general-use_embedded_subs"
name="settings-general-use_embedded_subs">
<span class="custom-control-label" for="settings-general-use_embedded_subs"></span>
</label>
<label>Use embedded Subtitles in media files when determining missing ones.</label>
@ -202,10 +220,12 @@
</div>
<div class="form-group col-sm-8">
<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">
<input type="checkbox" class="custom-control-input" id="settings-general-ignore_pgs_subs"
name="settings-general-ignore_pgs_subs">
<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>
<label>Ignores PGS Subtitles in Embedded Subtitles detection. Only relevant if 'Use embedded
Subtitles' is enabled.</label>
</div>
</div>
<div class="row">
@ -214,7 +234,9 @@
</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">
<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>
@ -230,36 +252,39 @@
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-utf8_encode" name="settings-general-utf8_encode">
<input type="checkbox" class="custom-control-input" id="settings-general-utf8_encode"
name="settings-general-utf8_encode">
<span class="custom-control-label" for="settings-general-utf8_encode"></span>
</label>
<label>Re-encode downloaded Subtitles to UTF8. Should be left enabled in most case.</label>
</div>
</div>
{% if not os.startswith('win') %}
<div class="row">
<div class="col-sm-3 text-right">
<b>Enable CHMOD</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-chmod_enabled" name="settings-general-chmod_enabled">
<span class="custom-control-label" for="settings-general-chmod_enabled"></span>
</label>
</div>
</div>
<div id="chmod_div">
<div class="row">
<div class="col-sm-4 text-right">
<b>Set Subtitle file permissions to</b>
<div class="col-sm-3 text-right">
<b>Enable CHMOD</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 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>
</div>
</div>
<br>
</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>
{% endif %}
<div class="row">
<div class="col-sm-3 text-right">
@ -267,7 +292,8 @@
</div>
<div class="form-group col-sm-8">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-use_postprocessing" name="settings-general-use_postprocessing">
<input type="checkbox" class="custom-control-input" id="settings-general-use_postprocessing"
name="settings-general-use_postprocessing">
<span class="custom-control-label" for="settings-general-use_postprocessing"></span>
</label>
<label>Enable the post-processing execution after downloading a subtitles.</label>
@ -280,8 +306,11 @@
</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>
<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>
</label>
</div>
</div>
@ -291,7 +320,9 @@
<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}}">
<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 }}">
</div>
</div>
<br>
@ -301,8 +332,11 @@
</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>
<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>
</label>
</div>
</div>
@ -312,7 +346,9 @@
<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}}">
<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 }}">
</div>
</div>
<br>
@ -321,7 +357,9 @@
<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}}">
<input type="text" class="form-control" id="settings-general-postprocessing_cmd"
name="settings-general-postprocessing_cmd"
value="{{ settings.general.postprocessing_cmd }}">
</div>
</div>
<br>
@ -350,6 +388,8 @@
<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>
</div>
</div>
</div>
@ -362,7 +402,7 @@
$(document).ready(function () {
// Show warning if there's unsaved changes in the settings_form
var form_changed = false;
$(window).on('beforeunload', function() {
$(window).on('beforeunload', function () {
if (form_changed) {
return "";
}
@ -373,7 +413,7 @@
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide *_div on Select input changed to None
$('#settings-general-subfolder').on('change', function() {
$('#settings-general-subfolder').on('change', function () {
if ($(this).val() === 'current') {
$('#subfolder_div').hide();
} else {
@ -381,7 +421,7 @@
}
});
$('#settings-general-upgrade_subs').on('change', function() {
$('#settings-general-upgrade_subs').on('change', function () {
if ($(this).prop('checked')) {
$('#upgradesubs_div').show();
} else {
@ -389,7 +429,7 @@
}
});
$('#settings-general-anti_captcha_provider').on('change', function() {
$('#settings-general-anti_captcha_provider').on('change', function () {
if ($(this).val() === 'anti-captcha') {
$('#anticaptcha_div').show();
$('#deathbycaptcha_div').hide();
@ -402,7 +442,7 @@
}
});
$('#settings-general-use_embedded_subs').on('change', function() {
$('#settings-general-use_embedded_subs').on('change', function () {
if ($(this).prop('checked')) {
$('#embedded_div').show();
} else {
@ -410,7 +450,7 @@
}
});
$('#settings-general-chmod_enabled').on('change', function() {
$('#settings-general-chmod_enabled').on('change', function () {
if ($(this).prop('checked')) {
$('#chmod_div').show();
} else {
@ -418,7 +458,7 @@
}
});
$('#settings-general-use_postprocessing').on('change', function() {
$('#settings-general-use_postprocessing').on('change', function () {
if ($(this).prop('checked')) {
$('#custompp_div').show();
} else {
@ -445,7 +485,7 @@
$('#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');
$('#save_button').on('click', function() {
$('#save_button').on('click', function () {
var formdata = new FormData(document.getElementById("settings_form"));
// Make sure all checkbox input are sent with true/false value
@ -464,8 +504,7 @@
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
function () {
$('#save_button_checkmark').hide();
}, 2000);
}
@ -473,7 +512,7 @@
});
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
$('#settings_form').on('change', function () {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})

Loading…
Cancel
Save