From 1005584f4f78ff3dde3c34ba40b0e1627f12f9c8 Mon Sep 17 00:00:00 2001 From: Pika <15848969+ThatNerdyPikachu@users.noreply.github.com> Date: Sat, 14 Sep 2019 18:15:59 -0400 Subject: [PATCH] Actually skip PGS subtitles (#543) * Update embedded_subs_reader.py * Update list_subtitles.py --- bazarr/embedded_subs_reader.py | 2 +- bazarr/list_subtitles.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bazarr/embedded_subs_reader.py b/bazarr/embedded_subs_reader.py index df9625d4c..c808b8f46 100644 --- a/bazarr/embedded_subs_reader.py +++ b/bazarr/embedded_subs_reader.py @@ -27,7 +27,7 @@ class EmbeddedSubsReader: detected_languages = [] for detected_language in data['subtitles']: - subtitles_list.append([detected_language['language'], detected_language['forced']]) + subtitles_list.append([detected_language['language'], detected_language['forced'], detected_language["codec"]]) else: if os.path.splitext(file)[1] == '.mkv': with open(file, 'rb') as f: diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index dcac64f4b..2c15d4a31 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -36,8 +36,12 @@ def store_subtitles(file): logging.debug("BAZARR is trying to index embedded subtitles.") try: subtitle_languages = embedded_subs_reader.list_languages(file) - for subtitle_language, subtitle_forced in subtitle_languages: + for subtitle_language, subtitle_forced, subtitle_codec in subtitle_languages: try: + if settings.general.getboolean("ignore_pgs_subs") and subtitle_codec == "hdmv_pgs_subtitle": + logging.debug("BAZARR skipping pgs sub for language: " + str(alpha2_from_alpha3(subtitle_language))) + continue + if alpha2_from_alpha3(subtitle_language) is not None: lang = str(alpha2_from_alpha3(subtitle_language)) if subtitle_forced: @@ -128,8 +132,12 @@ def store_subtitles_movie(file): logging.debug("BAZARR is trying to index embedded subtitles.") try: subtitle_languages = embedded_subs_reader.list_languages(file) - for subtitle_language, subtitle_forced in subtitle_languages: + for subtitle_language, subtitle_forced, subtitle_codec in subtitle_languages: try: + if settings.general.getboolean("ignore_pgs_subs") and subtitle_codec == "hdmv_pgs_subtitle": + logging.debug("BAZARR skipping pgs sub for language: " + str(alpha2_from_alpha3(subtitle_language))) + continue + if alpha2_from_alpha3(subtitle_language) is not None: lang = str(alpha2_from_alpha3(subtitle_language)) if subtitle_forced: