From b34a0c19a21a2caac3fa8cf29cdcfa96717b54fc Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 23 Oct 2024 18:26:14 -0400 Subject: [PATCH] Fixed issue with translation failing when nothing is returned by Google Translate. #2519 --- bazarr/subtitles/tools/translate.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bazarr/subtitles/tools/translate.py b/bazarr/subtitles/tools/translate.py index 935d3ebd1..1998cb504 100644 --- a/bazarr/subtitles/tools/translate.py +++ b/bazarr/subtitles/tools/translate.py @@ -99,7 +99,11 @@ def translate_line(id, line, attempt): logging.debug(f'BAZARR saving translated subtitles to {dest_srt_file}') for i, line in enumerate(subs): try: - line.plaintext = lines_list[i] + if lines_list[i]: + line.plaintext = lines_list[i] + else: + # we assume that there was nothing to translate if Google returns None. ex.: "♪♪" + continue except IndexError: logging.error(f'BAZARR is unable to translate malformed subtitles: {source_srt_file}') return False