diff --git a/bazarr/api.py b/bazarr/api.py index cd11e45aa..ffddb5e49 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -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": []}) diff --git a/bazarr/config.py b/bazarr/config.py index 1ac551e76..b38365d3f 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -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', diff --git a/views/settingssubtitles.html b/views/settingssubtitles.html index 4e768e011..34c50c9f0 100644 --- a/views/settingssubtitles.html +++ b/views/settingssubtitles.html @@ -208,6 +208,18 @@ +
+
+ Show Only Desired Languages +
+
+ + +
+

Post-Processing

@@ -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');