From 5eba6db10daf1bb28a0dedb1210ca48cd8cb211a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 26 Aug 2019 16:51:41 -0400 Subject: [PATCH] Fix for list_subtitles doing path mapping over already mapped path. --- bazarr/list_subtitles.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index 4d4bc28d7..20fbc592f 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -81,7 +81,7 @@ def store_subtitles(file): else: if os.path.splitext(subtitle)[1] != ".sub": logging.debug("BAZARR falling back to file content analysis to detect language.") - with open(path_replace(os.path.join(os.path.dirname(file), subtitle)), 'r') as f: + with open(os.path.join(os.path.dirname(file), subtitle), 'r') as f: text = list(islice(f, 100)) text = ' '.join(text) encoding = UnicodeDammit(text) @@ -90,9 +90,9 @@ def store_subtitles(file): detected_language = langdetect.detect(text) except Exception as e: logging.exception( - 'BAZARR Error trying to detect language for this subtitles file: ' + path_replace( - os.path.join(os.path.dirname(file), - subtitle)) + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.') + 'BAZARR Error trying to detect language for this subtitles file: ' + + os.path.join(os.path.dirname(file), subtitle) + + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.') else: if len(detected_language) > 0: logging.debug( @@ -171,8 +171,7 @@ def store_subtitles_movie(file): else: if os.path.splitext(subtitle)[1] != ".sub": logging.debug("BAZARR falling back to file content analysis to detect language.") - with open(path_replace_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle)), - 'r') as f: + with open(os.path.join(os.path.dirname(file), dest_folder, subtitle), 'r') as f: text = list(islice(f, 100)) text = ' '.join(text) encoding = UnicodeDammit(text) @@ -181,9 +180,9 @@ def store_subtitles_movie(file): detected_language = langdetect.detect(text) except Exception as e: logging.exception( - 'BAZARR Error trying to detect language for this subtitles file: ' + path_replace( - os.path.join(os.path.dirname(file), - subtitle)) + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.') + 'BAZARR Error trying to detect language for this subtitles file: ' + + os.path.join(os.path.dirname(file), subtitle) + + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.') else: if len(detected_language) > 0: logging.debug(