158 lines
2 KiB
Markdown
158 lines
2 KiB
Markdown
<p align="center">
|
|
<img src="images/subfox-logo.png" width="600">
|
|
</p>
|
|
|
|
# SubFox 🦊
|
|
|
|
> 🎬 Intelligent subtitle translation with disk cache & batching
|
|
|
|
SubFox translates subtitle files efficiently using batching and a persistent disk cache — reducing API calls and improving performance.
|
|
|
|
---
|
|
|
|
## 🚀 Version
|
|
|
|
**Current version: 0.1.0**
|
|
|
|
---
|
|
|
|
## ⚡ Features
|
|
|
|
* 🔁 Batch translation (packed subtitles)
|
|
* 💾 Disk cache (persistent across restarts)
|
|
* ⚡ Reduced API usage via caching
|
|
* 🧠 Smart fallback per subtitle line
|
|
* 🐳 Docker-based deployment
|
|
* 📡 API-driven translation flow
|
|
* 📊 Progress tracking support
|
|
|
|
---
|
|
|
|
## ⚡ Quick Start
|
|
|
|
### 1. Clone project
|
|
|
|
```bash
|
|
git clone https://git.lanx.dk/ed/subfox.git
|
|
cd subfox
|
|
```
|
|
|
|
---
|
|
|
|
### 2. Setup environment
|
|
|
|
Create `.env`:
|
|
|
|
```env
|
|
OPENAI_API_KEY=your_api_key_here
|
|
```
|
|
|
|
---
|
|
|
|
### 3. Start with Docker
|
|
|
|
```bash
|
|
docker compose up -d --build
|
|
```
|
|
|
|
---
|
|
|
|
### 4. Open in browser
|
|
|
|
```
|
|
http://localhost:8000
|
|
```
|
|
|
|
---
|
|
|
|
## 🧠 How it Works
|
|
|
|
```text
|
|
Upload SRT
|
|
↓
|
|
Parse blocks
|
|
↓
|
|
Batch translation (packed)
|
|
↓
|
|
Cache lookup
|
|
↓
|
|
OpenAI (if needed)
|
|
↓
|
|
Fallback per-line (if mismatch)
|
|
↓
|
|
Return translated subtitles
|
|
```
|
|
|
|
---
|
|
|
|
## 💾 Cache System
|
|
|
|
SubFox uses a disk-based cache:
|
|
|
|
* Stored in `/data/cache`
|
|
* Persisted via Docker volume
|
|
* One file per translation (hashed key)
|
|
|
|
Example:
|
|
|
|
```text
|
|
/data/cache/en_da/
|
|
├── a1b2c3d4.json
|
|
├── f6g7h8i9.json
|
|
```
|
|
|
|
---
|
|
|
|
## 🐳 Docker Configuration
|
|
|
|
Example volume setup:
|
|
|
|
```yaml
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
- ./outputs:/app/outputs
|
|
- /mnt/user/appdata/subfox/cache:/data/cache
|
|
```
|
|
|
|
---
|
|
|
|
## 📡 API
|
|
|
|
### Version endpoint
|
|
|
|
```bash
|
|
GET /version
|
|
```
|
|
|
|
Response:
|
|
|
|
```json
|
|
{
|
|
"version": "0.1.0"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 📜 Changelog
|
|
|
|
See [CHANGELOG.md](CHANGELOG.md)
|
|
|
|
---
|
|
|
|
## 🛠 Tech Stack
|
|
|
|
* Python 3.11
|
|
* FastAPI
|
|
* OpenAI API
|
|
* Docker
|
|
* JSON-based disk cache
|
|
|
|
---
|
|
|
|
## ❤️ Credits
|
|
|
|
Built with ❤️ for Lanx by [NodeFox 🦊](https://nodefox.lanx.dk)
|
|
Maintained by [Eddie Nielsen](https://lanx.dk)
|
|
|
|
> Learn. Adopt. Survive. Share.
|