Metadata-Version: 2.4
Name: fanyit
Version: 0.2.0
Summary: Translate subtitles and documents from your terminal
Project-URL: Homepage, https://github.com/kileroppo/demo-test-git
Project-URL: Repository, https://github.com/kileroppo/demo-test-git
Project-URL: Issues, https://github.com/kileroppo/demo-test-git/issues
Author: Fanyi Contributors
License: MIT
License-File: LICENSE
Keywords: ass,cli,i18n,localization,srt,subtitles,translation,vtt
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.11
Requires-Dist: charset-normalizer>=3.0.0
Requires-Dist: click>=8.1.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: langdetect>=1.0.9
Requires-Dist: openai>=1.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pypdf2>=3.0.0
Requires-Dist: pysrt>=1.1.2
Requires-Dist: python-docx>=0.8.11
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# fanyit

**Install. Translate. Done.**

Zero-config CLI tool for translating subtitles and documents. Works out of the box with no API keys or setup required.

## Install

```bash
pip install fanyit
```

## Quick Start

Translate a subtitle file - no engine flag needed:

```bash
fanyi subs movie.srt --target zh
```

That's it. Fanyi automatically finds a working translation engine or uses its built-in demo engine.

For real translations, run setup once:

```bash
fanyi setup
```

## Quality Tiers

Choose your speed/quality tradeoff:

```bash
fanyi subs movie.srt --target zh --quality fast      # Draft quality, maximum speed
fanyi subs movie.srt --target zh --quality standard  # Everyday use (default)
fanyi subs movie.srt --target zh --quality best      # Publication quality, slower
```

## Supported Formats

| Format | Extensions | Description |
|--------|-----------|-------------|
| SRT | `.srt` | SubRip subtitle format |
| ASS/SSA | `.ass`, `.ssa` | Advanced SubStation Alpha |
| VTT | `.vtt` | WebVTT subtitle format |
| Text | `.txt` | Plain text files |
| Markdown | `.md` | Markdown documents |
| PDF | `.pdf` | PDF documents (text extraction) |
| DOCX | `.docx` | Microsoft Word documents |
| Audio | `.mp3`, `.wav` | Audio transcription + translation |

## Advanced

### Configuration File

Create `~/.fanyi.yaml` or run `fanyi setup`:

```yaml
engine: ollama
target_language: zh
ollama_host: http://localhost:11434
ollama_model: llama3
```

### Environment Variables

```bash
export FANYI_ENGINE=openai
export FANYI_OPENAI_API_KEY=your-key
export FANYI_TARGET_LANGUAGE=zh
```

### All Engines

| Engine | Description | Requires API Key |
|--------|-------------|-----------------|
| OpenAI | GPT-based translation | Yes |
| DeepL | Professional translation API | Yes |
| Ollama | Local LLM (private, offline) | No |
| Mock | Built-in demo engine | No |

### All CLI Options

```bash
fanyi translate file.txt --engine openai --target zh --source en
fanyi translate file.txt --quality best --context-lines 5
fanyi translate ./docs/ --recursive --concurrency 4
fanyi translate file.txt --no-cache --resume --glossary terms.csv
fanyi subs movie.srt --target ja --quality fast
fanyi check          # Verify engine connectivity
fanyi config --show  # View current config
fanyi cache stats    # Cache statistics
fanyi jobs list      # View interrupted jobs
```

## License

MIT
