mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-31 03:12:12 +00:00
Added settings to disable UTF8 subtitles re-encoding.
This commit is contained in:
parent
2745666945
commit
bed98832ed
4 changed files with 43 additions and 1 deletions
|
@ -31,6 +31,7 @@ defaults = {
|
|||
'page_size': '25',
|
||||
'minimum_score_movie': '70',
|
||||
'use_embedded_subs': 'True',
|
||||
'utf8_encode': 'True',
|
||||
'ignore_pgs_subs': 'False',
|
||||
'adaptive_searching': 'False',
|
||||
'enabled_providers': '',
|
||||
|
|
|
@ -103,6 +103,11 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName,
|
|||
# fixme: supply all missing languages, not only one, to hit providers only once who support multiple languages in
|
||||
# one query
|
||||
|
||||
if settings.general.getboolean('utf8_encode'):
|
||||
os.environ["SZ_KEEP_ENCODING"] = ""
|
||||
else:
|
||||
os.environ["SZ_KEEP_ENCODING"] = True
|
||||
|
||||
logging.debug('BAZARR Searching subtitles for this file: ' + path)
|
||||
if hi == "True":
|
||||
hi = "force HI"
|
||||
|
@ -328,7 +333,12 @@ def manual_search(path, language, hi, providers, providers_auth, sceneName, titl
|
|||
|
||||
def manual_download_subtitle(path, language, hi, subtitle, provider, providers_auth, sceneName, title, media_type):
|
||||
logging.debug('BAZARR Manually downloading subtitles for this file: ' + path)
|
||||
|
||||
|
||||
if settings.general.getboolean('utf8_encode'):
|
||||
os.environ["SZ_KEEP_ENCODING"] = ""
|
||||
else:
|
||||
os.environ["SZ_KEEP_ENCODING"] = True
|
||||
|
||||
subtitle = pickle.loads(codecs.decode(subtitle.encode(), "base64"))
|
||||
use_scenename = settings.general.getboolean('use_scenename')
|
||||
use_postprocessing = settings.general.getboolean('use_postprocessing')
|
||||
|
|
|
@ -1243,6 +1243,11 @@ def save_settings():
|
|||
settings_general_embedded = 'False'
|
||||
else:
|
||||
settings_general_embedded = 'True'
|
||||
settings_general_utf8_encode = request.forms.get('settings_general_utf8_encode')
|
||||
if settings_general_utf8_encode is None:
|
||||
settings_general_utf8_encode = 'False'
|
||||
else:
|
||||
settings_general_utf8_encode = 'True'
|
||||
settings_general_ignore_pgs = request.forms.get('settings_general_ignore_pgs')
|
||||
if settings_general_ignore_pgs is None:
|
||||
settings_general_ignore_pgs = 'False'
|
||||
|
@ -1347,6 +1352,7 @@ def save_settings():
|
|||
|
||||
settings.general.minimum_score_movie = text_type(settings_general_minimum_score_movies)
|
||||
settings.general.use_embedded_subs = text_type(settings_general_embedded)
|
||||
settings.general.utf8_encode = text_type(settings_general_utf8_encode)
|
||||
settings.general.ignore_pgs_subs = text_type(settings_general_ignore_pgs)
|
||||
settings.general.adaptive_searching = text_type(settings_general_adaptive_searching)
|
||||
settings.general.multithreading = text_type(settings_general_multithreading)
|
||||
|
|
|
@ -236,6 +236,25 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned four wide column">
|
||||
<label>Encode subtitles to UTF8</label>
|
||||
</div>
|
||||
<div class="one wide column">
|
||||
<div id="settings_utf8_encode" class="ui toggle checkbox" data-utf8encode={{ settings.general.getboolean('utf8_encode') }}>
|
||||
<input name="settings_general_utf8_encode" type="checkbox">
|
||||
<label></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapsed column">
|
||||
<div class="collapsed center aligned column">
|
||||
<div class="ui basic icon" data-tooltip="Re-encode downloaded subtitles to UTF8. Should be left enabled in most case." data-inverted="">
|
||||
<i class="help circle large icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -539,6 +558,12 @@
|
|||
$("#settings_multithreading").checkbox('uncheck');
|
||||
}
|
||||
|
||||
if ($('#settings_utf8_encode').data("utf8encode") === "True") {
|
||||
$("#settings_utf8_encode").checkbox('check');
|
||||
} else {
|
||||
$("#settings_utf8_encode").checkbox('uncheck');
|
||||
}
|
||||
|
||||
if (($('#settings_subfolder').val() !== "relative") && ($('#settings_subfolder').val() !== "absolute")) {
|
||||
$('.subfolder').hide();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue