Metadata-Version: 2.3
Name: subt-ai-tles
Version: 0.0.3
Summary: 
Author: xyzjonas
Author-email: xyzjonas <you@example.com>
License: MIT
Requires-Dist: openai>=1.3.6,<2.0.0
Requires-Dist: libretranslatepy>=2.1.3,<3.0.0
Requires-Dist: pysrt>=1.1.2,<2.0.0
Requires-Dist: deepl>=1.16.1,<2.0.0
Requires-Dist: srt>=3.5.3,<4.0.0
Requires-Dist: pydantic-settings>=2.10.1
Requires-Dist: pydantic-ai-slim[openai]>=1.0.10
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/xyzjonas/subt-ai-tles
Description-Content-Type: text/markdown

# SUBT-AI-TLES
A simple wrapper around LLMs that provides language translation interface for subtitles (.srt). 

## Predefined implementations
> So far OpenAI API is the only supported/pre-implemented 'backend'

Setup required environment variables and then simply import and invoke the function. 
```python
import asyncio
from subtaitles import translate_srt_file, Engine, Lang

# use predefined translators from the Engine enum
asyncio.run(
    translate_srt_file(
        path="/tmp/subtitles.en.srt",
        new_path="/tmp/subtitles.de.srt",
        translator=Engine.OPEN_AI,
        source=Lang.EN,
        target=Lang.DE
    )
)
```

```python
# behavior and configuration is controlled via environment variables
# all the used variables are defined int the environment module
from subtaitles import env
```

## Custom implementations
An arbitrary class that implements the `TranslateProtocol` can be passed to both 
the `translate_srt_file()` and `translate_srt()`
```python
import asyncio
from subtaitles import Lang, translate_srt_file

class MyCustomTranslator:
     async def translate(
        self, text: list[str], language_from: Lang, language_to: Lang,
    ) -> list[str]:
        # <implement whatever floats your boat>
        ...

asyncio.run(
    translate_srt_file(
        path="/tmp/subtitles.en.srt",
        new_path="/tmp/subtitles.de.srt",
        translator=MyCustomTranslator(),
        source=Lang.EN,
        target=Lang.DE
    )
)
```

## CLI
`translate_srt_file` is exposed as a utility command for command line usage:
```bash
translate_subtitles --help
translate_subtitles --engine openai /tmp/subtitles.en.srt /tmp/subtitles.de.srt en de
```
