You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(f"{BackgroundColors.YELLOW}Warning: Translation limit would be exceeded. Current block size: {BackgroundColors.CYAN}{len(text_block)}{BackgroundColors.YELLOW}. Current remaining characters: {BackgroundColors.CYAN}{remaining_chars}{BackgroundColors.YELLOW}. Skipping translation for this block.{Style.RESET_ALL}")
250
-
returntext_block.split("\n") # Return original lines
248
+
ifremaining_charsisnotNone: # If there is a limit on remaining characters
print(f"{BackgroundColors.YELLOW}Warning: Translation limit would be exceeded. Current block size: {BackgroundColors.CYAN}{len(text_block)}{BackgroundColors.YELLOW}. Exceeding limit by: {BackgroundColors.CYAN}{len(text_block) -remaining_chars}{BackgroundColors.YELLOW} characters. Skipping translation for this block.{Style.RESET_ALL}") # Output warning message
252
+
returntext_block.split("\n") # Return original lines
251
253
else: # Perform translation
252
254
result=translator.translate_text(text_block, source_lang="EN", target_lang="PT-BR") # Translate text block
print(f"No .srt files found in directory: {INPUT_DIR}") # Output message
369
371
return# Exit the program
370
372
371
-
forsrt_fileintqdm(srt_files, desc=f"{BackgroundColors.GREEN}Translating SRT files{Style.RESET_ALL}", unit="file"): # Iterate through each SRT file with progress bar
372
-
tqdm.write(f"{BackgroundColors.GREEN}Processing file: {BackgroundColors.CYAN}{srt_file}{Style.RESET_ALL}") # Show current file
373
+
withtqdm(srt_files, desc=f"{BackgroundColors.GREEN}Translating SRT files", unit="file") asprogress_bar: # Progress bar for SRT files
374
+
forsrt_fileinprogress_bar: # Iterate through each SRT file
0 commit comments