summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2024-10-23 18:26:14 -0400
committermorpheus65535 <[email protected]>2024-10-23 18:26:14 -0400
commitb34a0c19a21a2caac3fa8cf29cdcfa96717b54fc (patch)
tree7a3c5e4a0424849a1819017403b2309a7c3068df
parente8077d64dfb1c59d5a52d200e37d1387ced533e7 (diff)
downloadbazarr-b34a0c19a21a2caac3fa8cf29cdcfa96717b54fc.tar.gz
bazarr-b34a0c19a21a2caac3fa8cf29cdcfa96717b54fc.zip
Fixed issue with translation failing when nothing is returned by Google Translate. #2519
-rw-r--r--bazarr/subtitles/tools/translate.py6
1 files changed, 5 insertions, 1 deletions
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_subtitles_file(video_path, source_srt_file, from_lang, to_lang, fo
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