From a7562e06b5849b32d266cb0ee9e297edbbd4ddb4 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sat, 22 Jul 2023 12:24:53 -0400 Subject: [PATCH] Improved external subtitles file encoding guessing to ignore those who can't be guessed properly. --- bazarr/subtitles/indexer/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazarr/subtitles/indexer/utils.py b/bazarr/subtitles/indexer/utils.py index 77cbc3adc..79d7b3a2f 100644 --- a/bazarr/subtitles/indexer/utils.py +++ b/bazarr/subtitles/indexer/utils.py @@ -77,7 +77,7 @@ def guess_external_subtitles(dest_folder, subtitles, media_type, previously_inde text = f.read() encoding = detect(text) - if encoding and 'encoding' in encoding: + if encoding and 'encoding' in encoding and encoding['encoding']: encoding = detect(text)['encoding'] else: logging.debug("BAZARR skipping this subtitles because we can't guess the encoding. " @@ -129,7 +129,7 @@ def guess_external_subtitles(dest_folder, subtitles, media_type, previously_inde text = f.read() encoding = detect(text) - if encoding and 'encoding' in encoding: + if encoding and 'encoding' in encoding and encoding['encoding']: encoding = detect(text)['encoding'] else: logging.debug("BAZARR skipping this subtitles because we can't guess the encoding. "