Auto-Synced-Translated-Dubs icon indicating copy to clipboard operation
Auto-Synced-Translated-Dubs copied to clipboard

Having a large subtitles file causes a crash (chunk translation)

Open sofiadparamo opened this issue 2 years ago • 0 comments

The usage of batch translation causes the program to crash due to an list index out of range, as seen here:

...
  File "Auto-Synced-Translated-Dubs\main.py", line 425, in translate_dictionary
    inputSubsDict[key]['translated_text'] = translatedTexts[i]
IndexError: list index out of range

This is due to the program iterating thru the chunks of translated text, and going to the range of the size of the whole list of texts to translate, causing it to crash if there are more than 100 texts in the srt file.

The list will always have 100 chunks of text, but the for loop is going beyond that.

main.py
                   Here's the problem
                           |
                           v
                   ------------------------
424| for i, key in enumerate(inputSubsDict):
425|                    inputSubsDict[key]['translated_text'] = translatedTexts[i]
426|                    # Print progress, ovwerwrite the same line
427|                    print(f' Translated: {key} of {len(inputSubsDict)}', end='\r')

sofiadparamo avatar Jan 03 '23 07:01 sofiadparamo