syncing latest revisions - dk123

This commit is contained in:
2026-01-12 15:15:37 -05:00
parent 56494208bd
commit e471d3e1f8
11 changed files with 100 additions and 89 deletions
@@ -25,8 +25,8 @@ def translate_via_ollama(source_srt_content, target_language="English", model="l
subs = pysubs2.SSAFile.from_string(source_srt_content)
# Using tqdm for progress bar
# dynamic_ncols=True helps it resize properly. leave=True ensures it stays after completion.
for line in tqdm(subs, desc=" Ollama Progress", unit="line", dynamic_ncols=True, leave=True):
# dynamic_ncols=True helps it resize properly.
for line in tqdm(subs, desc=" Ollama Progress", unit="line", dynamic_ncols=True, leave=False):
text = line.text.strip()
# Skip empty, numeric-only, or extremely short non-word text
@@ -81,7 +81,7 @@ def translate_fallback_mymemory(source_srt_content, target_language="en"):
# MyMemory uses ISO 639-1 usually
translator = MyMemoryTranslator(source='auto', target=target_language)
for line in tqdm(subs, desc=" MyMemory Progress", unit="line"):
for line in tqdm(subs, desc=" MyMemory Progress", unit="line", leave=False):
text = line.text.strip()
# Skip empty, numeric-only, or extremely short non-word text
@@ -121,7 +121,7 @@ def translate_fallback_free(source_srt_content, target_language="en"):
translator = GoogleTranslator(source='auto', target=target_language)
# Simple line-by-line translation
for line in tqdm(subs, desc=" DeepTranslate Progress", unit="line"):
for line in tqdm(subs, desc=" DeepTranslate Progress", unit="line", leave=False):
text = line.text.strip()
# Skip empty, numeric-only, or extremely short non-word text
@@ -335,8 +335,8 @@ def translate_with_auto_fallback(srt_content, target_language="English", prefer_
# Execute attempts
for i, method_func in enumerate(attempts):
if i > 0:
print(f" Attempt {i} failed. Trying next fallback...")
# if i > 0:
# print(f" Attempt {i} failed. Trying next fallback...")
content, method = method_func()
if content: