Actually skip PGS subtitles (#543)

* Update embedded_subs_reader.py

* Update list_subtitles.py
pull/550/head
Pika 5 years ago committed by morpheus65535
parent a0200b23da
commit 1005584f4f

@ -27,7 +27,7 @@ class EmbeddedSubsReader:
detected_languages = [] detected_languages = []
for detected_language in data['subtitles']: 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: else:
if os.path.splitext(file)[1] == '.mkv': if os.path.splitext(file)[1] == '.mkv':
with open(file, 'rb') as f: with open(file, 'rb') as f:

@ -36,8 +36,12 @@ def store_subtitles(file):
logging.debug("BAZARR is trying to index embedded subtitles.") logging.debug("BAZARR is trying to index embedded subtitles.")
try: try:
subtitle_languages = embedded_subs_reader.list_languages(file) 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: 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: if alpha2_from_alpha3(subtitle_language) is not None:
lang = str(alpha2_from_alpha3(subtitle_language)) lang = str(alpha2_from_alpha3(subtitle_language))
if subtitle_forced: if subtitle_forced:
@ -128,8 +132,12 @@ def store_subtitles_movie(file):
logging.debug("BAZARR is trying to index embedded subtitles.") logging.debug("BAZARR is trying to index embedded subtitles.")
try: try:
subtitle_languages = embedded_subs_reader.list_languages(file) 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: 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: if alpha2_from_alpha3(subtitle_language) is not None:
lang = str(alpha2_from_alpha3(subtitle_language)) lang = str(alpha2_from_alpha3(subtitle_language))
if subtitle_forced: if subtitle_forced:

Loading…
Cancel
Save