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 @@ +