added "Show Only Desired Languages" option for embedded subtitles

pull/1038/head
josdion 5 years ago
parent c89d542479
commit a9624fb818

@ -424,6 +424,10 @@ class Episodes(Resource):
"code2": subtitle[0],
"code3": alpha3_from_alpha2(subtitle[0]),
"forced": True if len(subtitle) > 1 else False}
if settings.general.getboolean('embedded_subs_show_desired'):
item['subtitles'] = [x for x in item['subtitles'] if
x[0]['code2'] in ast.literal_eval(desired_languages) or x[1]]
else:
item.update({"subtitles": []})
@ -713,6 +717,11 @@ class Movies(Resource):
"code2": language[0],
"code3": alpha3_from_alpha2(language[0]),
"forced": True if len(language) > 1 else False}
if settings.general.getboolean('embedded_subs_show_desired'):
item['subtitles'] = [x for x in item['subtitles'] if
x['code2'] in [y['code2'] for y in item['languages']] or x['path']]
item['subtitles'] = sorted(item['subtitles'], key=itemgetter('name', 'forced'))
else:
item.update({"subtitles": []})

@ -39,6 +39,7 @@ defaults = {
'page_size_manual_search': '10',
'minimum_score_movie': '70',
'use_embedded_subs': 'True',
'embedded_subs_show_desired': 'True',
'utf8_encode': 'True',
'ignore_pgs_subs': 'False',
'adaptive_searching': 'False',

@ -208,6 +208,18 @@
<label>Ignores PGS Subtitles in Embedded Subtitles detection. Only relevant if 'Use embedded Subtitles' is enabled.</label>
</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 subtitles for languages that are not currently enabled.</label>
</div>
</div>
</div>
<h4>Post-Processing</h4>
@ -426,6 +438,7 @@
$('#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');
$('#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');

Loading…
Cancel
Save