43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Shim: translate_srt_argos
|
|
|
|
Delegates to `whisper_project.infra.argos_adapter.ArgosTranslator.translate_srt`
|
|
if available; otherwise runs `examples/translate_srt_argos.py` as fallback.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main():
|
|
p = argparse.ArgumentParser(prog="translate_srt_argos")
|
|
p.add_argument("--in", dest="in_srt", required=True)
|
|
p.add_argument("--out", dest="out_srt", required=True)
|
|
args = p.parse_args()
|
|
|
|
try:
|
|
from whisper_project.infra.argos_adapter import ArgosTranslator
|
|
|
|
t = ArgosTranslator()
|
|
t.translate_srt(args.in_srt, args.out_srt)
|
|
return
|
|
except Exception:
|
|
try:
|
|
script = "examples/translate_srt_argos.py"
|
|
cmd = [sys.executable, script, "--in", args.in_srt, "--out", args.out_srt]
|
|
subprocess.run(cmd, check=True)
|
|
return
|
|
except Exception as e:
|
|
print("Error: no se pudo ejecutar Argos Translate:", e, file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main() or 0)
|
|
|
|
# The deprecated block has been removed.
|
|
# Use whisper_project.infra.argos_adapter for programmatic access.
|
|
|