interpreter-v2 2.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- interpreter_v2-2.13.0/.gitignore +35 -0
- interpreter_v2-2.13.0/.python-version +1 -0
- interpreter_v2-2.13.0/PKG-INFO +110 -0
- interpreter_v2-2.13.0/README.md +76 -0
- interpreter_v2-2.13.0/icon.png +0 -0
- interpreter_v2-2.13.0/install.ps1 +71 -0
- interpreter_v2-2.13.0/install.sh +150 -0
- interpreter_v2-2.13.0/interpreter-v2.desktop +8 -0
- interpreter_v2-2.13.0/pyproject.toml +98 -0
- interpreter_v2-2.13.0/screenshot.png +0 -0
- interpreter_v2-2.13.0/src/interpreter/__init__.py +20 -0
- interpreter_v2-2.13.0/src/interpreter/__main__.py +11 -0
- interpreter_v2-2.13.0/src/interpreter/capture/__init__.py +325 -0
- interpreter_v2-2.13.0/src/interpreter/capture/convert.py +45 -0
- interpreter_v2-2.13.0/src/interpreter/capture/linux_wayland.py +516 -0
- interpreter_v2-2.13.0/src/interpreter/capture/linux_x11.py +715 -0
- interpreter_v2-2.13.0/src/interpreter/capture/macos.py +351 -0
- interpreter_v2-2.13.0/src/interpreter/capture/windows.py +649 -0
- interpreter_v2-2.13.0/src/interpreter/config.py +193 -0
- interpreter_v2-2.13.0/src/interpreter/gpu/__init__.py +30 -0
- interpreter_v2-2.13.0/src/interpreter/gpu/linux.py +73 -0
- interpreter_v2-2.13.0/src/interpreter/gpu/macos.py +18 -0
- interpreter_v2-2.13.0/src/interpreter/gpu/windows.py +60 -0
- interpreter_v2-2.13.0/src/interpreter/gui/__init__.py +11 -0
- interpreter_v2-2.13.0/src/interpreter/gui/app.py +162 -0
- interpreter_v2-2.13.0/src/interpreter/gui/keyboard.py +268 -0
- interpreter_v2-2.13.0/src/interpreter/gui/main_window.py +824 -0
- interpreter_v2-2.13.0/src/interpreter/gui/workers.py +254 -0
- interpreter_v2-2.13.0/src/interpreter/log.py +110 -0
- interpreter_v2-2.13.0/src/interpreter/models.py +47 -0
- interpreter_v2-2.13.0/src/interpreter/ocr.py +332 -0
- interpreter_v2-2.13.0/src/interpreter/overlay/__init__.py +20 -0
- interpreter_v2-2.13.0/src/interpreter/overlay/base.py +458 -0
- interpreter_v2-2.13.0/src/interpreter/overlay/linux.py +930 -0
- interpreter_v2-2.13.0/src/interpreter/overlay/macos.py +48 -0
- interpreter_v2-2.13.0/src/interpreter/overlay/windows.py +77 -0
- interpreter_v2-2.13.0/src/interpreter/resources/icons/icon.icns +0 -0
- interpreter_v2-2.13.0/src/interpreter/resources/icons/icon.ico +0 -0
- interpreter_v2-2.13.0/src/interpreter/resources/icons/icon.png +0 -0
- interpreter_v2-2.13.0/src/interpreter/translate.py +284 -0
- interpreter_v2-2.13.0/uv.lock +943 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Binary
|
|
2
|
+
/interpreter
|
|
3
|
+
/interpreter.exe
|
|
4
|
+
|
|
5
|
+
# Models directory (downloaded on first run)
|
|
6
|
+
models/
|
|
7
|
+
|
|
8
|
+
# Python
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[cod]
|
|
11
|
+
*$py.class
|
|
12
|
+
*.so
|
|
13
|
+
.Python
|
|
14
|
+
.venv/
|
|
15
|
+
venv/
|
|
16
|
+
ENV/
|
|
17
|
+
.ruff_cache/
|
|
18
|
+
|
|
19
|
+
# IDE
|
|
20
|
+
.idea/
|
|
21
|
+
.vscode/
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
*.iml
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
.env
|
|
30
|
+
|
|
31
|
+
# Claude Code
|
|
32
|
+
.claude/
|
|
33
|
+
|
|
34
|
+
# Debug files
|
|
35
|
+
debug_capture.png
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: interpreter-v2
|
|
3
|
+
Version: 2.13.0
|
|
4
|
+
Summary: Offline screen translator for Japanese retro games
|
|
5
|
+
Author: qube
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: games,japanese,ocr,retro,translation
|
|
8
|
+
Requires-Python: <3.13,>=3.11
|
|
9
|
+
Requires-Dist: ctranslate2
|
|
10
|
+
Requires-Dist: dbus-python>=1.3.2; sys_platform == 'linux'
|
|
11
|
+
Requires-Dist: evdev-binary>=1.9.0; sys_platform == 'linux'
|
|
12
|
+
Requires-Dist: meikiocr
|
|
13
|
+
Requires-Dist: mss>=9.0.0
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: nvidia-cublas-cu12; sys_platform == 'win32' or sys_platform == 'linux'
|
|
16
|
+
Requires-Dist: nvidia-cudnn-cu12; sys_platform == 'win32' or sys_platform == 'linux'
|
|
17
|
+
Requires-Dist: onnxruntime
|
|
18
|
+
Requires-Dist: opencv-python
|
|
19
|
+
Requires-Dist: pillow>=10.0.0
|
|
20
|
+
Requires-Dist: pygetwindow>=0.0.9; sys_platform == 'win32'
|
|
21
|
+
Requires-Dist: pygobject>=3.42.0; sys_platform == 'linux'
|
|
22
|
+
Requires-Dist: pynput>=1.7.0; sys_platform == 'darwin' or sys_platform == 'win32'
|
|
23
|
+
Requires-Dist: pyobjc-framework-cocoa>=12.1; sys_platform == 'darwin'
|
|
24
|
+
Requires-Dist: pyobjc-framework-quartz>=10.0; sys_platform == 'darwin'
|
|
25
|
+
Requires-Dist: pyside6>=6.6.0
|
|
26
|
+
Requires-Dist: python-xlib>=0.33; sys_platform == 'linux'
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: requests
|
|
29
|
+
Requires-Dist: sentencepiece
|
|
30
|
+
Requires-Dist: structlog>=24.0.0
|
|
31
|
+
Requires-Dist: tqdm
|
|
32
|
+
Requires-Dist: windows-capture-interpreter>=1.5.1; sys_platform == 'win32'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Interpreter
|
|
36
|
+
|
|
37
|
+
Offline screen translator for Japanese retro games. Captures text from any window, performs OCR, translates to English, and displays subtitles in a floating overlay.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Fully offline** - No cloud APIs, no internet required after setup
|
|
44
|
+
- **Free** - No API costs or subscriptions
|
|
45
|
+
- **Private** - Text never leaves your machine
|
|
46
|
+
- **Optimized for retro games** - Uses MeikiOCR, trained specifically on Japanese game text
|
|
47
|
+
- **Two overlay modes** - Banner (subtitle bar) or inplace (text over game)
|
|
48
|
+
- **Translation caching** - Fuzzy matching avoids re-translating similar text
|
|
49
|
+
- **Multi-display support** - Overlay appears on the same display as the game
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
- **Windows 10 version 1903+**, macOS, or Linux (X11/XWayland/Wayland)
|
|
54
|
+
|
|
55
|
+
### Linux Notes
|
|
56
|
+
|
|
57
|
+
- **Global hotkeys** require `input` group membership. The installer will show instructions.
|
|
58
|
+
- **Native Wayland capture** requires GStreamer PipeWire plugin. The installer will attempt to install it automatically.
|
|
59
|
+
- **Inplace overlay** on Wayland only works with fullscreen windows (Wayland's security model prevents knowing window positions).
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
### One-liner Install
|
|
64
|
+
|
|
65
|
+
**macOS/Linux:**
|
|
66
|
+
```bash
|
|
67
|
+
curl -LsSf https://raw.githubusercontent.com/bquenin/interpreter/main/install.sh | bash
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Windows (PowerShell):**
|
|
71
|
+
```powershell
|
|
72
|
+
powershell -c "irm https://raw.githubusercontent.com/bquenin/interpreter/main/install.ps1 | iex"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then run with `interpreter-v2`.
|
|
76
|
+
|
|
77
|
+
## Upgrading
|
|
78
|
+
|
|
79
|
+
To update to the latest version, run the installer again (see Installation above).
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
interpreter-v2
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This opens the GUI where you can select a window to capture and configure all settings.
|
|
88
|
+
|
|
89
|
+
## Overlay Modes
|
|
90
|
+
|
|
91
|
+
### Banner Mode (default)
|
|
92
|
+
A subtitle bar at the bottom of the screen displaying translated text. Draggable, opaque background, centered text.
|
|
93
|
+
|
|
94
|
+
### Inplace Mode
|
|
95
|
+
Transparent overlay positioned over the game window. Translated text appears directly over the original Japanese text at OCR-detected positions. Click-through so you can interact with the game.
|
|
96
|
+
|
|
97
|
+
## How It Works
|
|
98
|
+
|
|
99
|
+
1. **Screen Capture** - Captures the target window at the configured refresh rate
|
|
100
|
+
2. **OCR** - [MeikiOCR](https://github.com/rtr46/meikiocr) extracts Japanese text (optimized for pixel fonts)
|
|
101
|
+
3. **Translation** - [Sugoi V4](https://huggingface.co/entai2965/sugoi-v4-ja-en-ctranslate2) translates Japanese to English
|
|
102
|
+
4. **Display** - Shows translated text in the selected overlay mode
|
|
103
|
+
|
|
104
|
+
## Troubleshooting
|
|
105
|
+
|
|
106
|
+
### Poor OCR accuracy
|
|
107
|
+
Try adjusting the OCR confidence slider in the GUI. Lower values include more text (but may include garbage), higher values are stricter.
|
|
108
|
+
|
|
109
|
+
### Slow performance
|
|
110
|
+
First run downloads models (~1.5GB). Subsequent runs use cached models from `~/.cache/huggingface/`.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Interpreter
|
|
2
|
+
|
|
3
|
+
Offline screen translator for Japanese retro games. Captures text from any window, performs OCR, translates to English, and displays subtitles in a floating overlay.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Fully offline** - No cloud APIs, no internet required after setup
|
|
10
|
+
- **Free** - No API costs or subscriptions
|
|
11
|
+
- **Private** - Text never leaves your machine
|
|
12
|
+
- **Optimized for retro games** - Uses MeikiOCR, trained specifically on Japanese game text
|
|
13
|
+
- **Two overlay modes** - Banner (subtitle bar) or inplace (text over game)
|
|
14
|
+
- **Translation caching** - Fuzzy matching avoids re-translating similar text
|
|
15
|
+
- **Multi-display support** - Overlay appears on the same display as the game
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- **Windows 10 version 1903+**, macOS, or Linux (X11/XWayland/Wayland)
|
|
20
|
+
|
|
21
|
+
### Linux Notes
|
|
22
|
+
|
|
23
|
+
- **Global hotkeys** require `input` group membership. The installer will show instructions.
|
|
24
|
+
- **Native Wayland capture** requires GStreamer PipeWire plugin. The installer will attempt to install it automatically.
|
|
25
|
+
- **Inplace overlay** on Wayland only works with fullscreen windows (Wayland's security model prevents knowing window positions).
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
### One-liner Install
|
|
30
|
+
|
|
31
|
+
**macOS/Linux:**
|
|
32
|
+
```bash
|
|
33
|
+
curl -LsSf https://raw.githubusercontent.com/bquenin/interpreter/main/install.sh | bash
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Windows (PowerShell):**
|
|
37
|
+
```powershell
|
|
38
|
+
powershell -c "irm https://raw.githubusercontent.com/bquenin/interpreter/main/install.ps1 | iex"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then run with `interpreter-v2`.
|
|
42
|
+
|
|
43
|
+
## Upgrading
|
|
44
|
+
|
|
45
|
+
To update to the latest version, run the installer again (see Installation above).
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
interpreter-v2
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This opens the GUI where you can select a window to capture and configure all settings.
|
|
54
|
+
|
|
55
|
+
## Overlay Modes
|
|
56
|
+
|
|
57
|
+
### Banner Mode (default)
|
|
58
|
+
A subtitle bar at the bottom of the screen displaying translated text. Draggable, opaque background, centered text.
|
|
59
|
+
|
|
60
|
+
### Inplace Mode
|
|
61
|
+
Transparent overlay positioned over the game window. Translated text appears directly over the original Japanese text at OCR-detected positions. Click-through so you can interact with the game.
|
|
62
|
+
|
|
63
|
+
## How It Works
|
|
64
|
+
|
|
65
|
+
1. **Screen Capture** - Captures the target window at the configured refresh rate
|
|
66
|
+
2. **OCR** - [MeikiOCR](https://github.com/rtr46/meikiocr) extracts Japanese text (optimized for pixel fonts)
|
|
67
|
+
3. **Translation** - [Sugoi V4](https://huggingface.co/entai2965/sugoi-v4-ja-en-ctranslate2) translates Japanese to English
|
|
68
|
+
4. **Display** - Shows translated text in the selected overlay mode
|
|
69
|
+
|
|
70
|
+
## Troubleshooting
|
|
71
|
+
|
|
72
|
+
### Poor OCR accuracy
|
|
73
|
+
Try adjusting the OCR confidence slider in the GUI. Lower values include more text (but may include garbage), higher values are stricter.
|
|
74
|
+
|
|
75
|
+
### Slow performance
|
|
76
|
+
First run downloads models (~1.5GB). Subsequent runs use cached models from `~/.cache/huggingface/`.
|
|
Binary file
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# install.ps1 - One-liner installer for interpreter-v2
|
|
2
|
+
# Usage: powershell -c "irm https://raw.githubusercontent.com/bquenin/interpreter/main/install.ps1 | iex"
|
|
3
|
+
|
|
4
|
+
$ErrorActionPreference = 'Stop'
|
|
5
|
+
|
|
6
|
+
Write-Host ""
|
|
7
|
+
Write-Host "=== interpreter-v2 Installer ===" -ForegroundColor Cyan
|
|
8
|
+
Write-Host "Offline screen translator for Japanese retro games"
|
|
9
|
+
Write-Host ""
|
|
10
|
+
|
|
11
|
+
# Check if uv is installed
|
|
12
|
+
$uvPath = Get-Command uv -ErrorAction SilentlyContinue
|
|
13
|
+
if (-not $uvPath) {
|
|
14
|
+
Write-Host "[1/2] Installing uv package manager..." -ForegroundColor Yellow
|
|
15
|
+
Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression
|
|
16
|
+
|
|
17
|
+
# Refresh PATH to find uv
|
|
18
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
19
|
+
|
|
20
|
+
# Verify uv is now available
|
|
21
|
+
$uvPath = Get-Command uv -ErrorAction SilentlyContinue
|
|
22
|
+
if (-not $uvPath) {
|
|
23
|
+
Write-Host "Error: uv installation failed. Please restart your terminal and try again." -ForegroundColor Red
|
|
24
|
+
exit 1
|
|
25
|
+
}
|
|
26
|
+
Write-Host "uv installed successfully!" -ForegroundColor Green
|
|
27
|
+
} else {
|
|
28
|
+
Write-Host "[1/2] uv is already installed" -ForegroundColor Green
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Install or upgrade interpreter-v2
|
|
32
|
+
Write-Host "[2/3] Installing interpreter-v2 from PyPI..." -ForegroundColor Yellow
|
|
33
|
+
Write-Host " (this may take a minute on first install)" -ForegroundColor Gray
|
|
34
|
+
# Use Python 3.12 explicitly - onnxruntime doesn't have wheels for 3.14 yet
|
|
35
|
+
# Temporarily allow errors so uv's progress output (on stderr) doesn't stop the script
|
|
36
|
+
$ErrorActionPreference = 'Continue'
|
|
37
|
+
uv tool install --upgrade --python 3.12 interpreter-v2
|
|
38
|
+
$installExitCode = $LASTEXITCODE
|
|
39
|
+
$ErrorActionPreference = 'Stop'
|
|
40
|
+
if ($installExitCode -ne 0) {
|
|
41
|
+
Write-Host ""
|
|
42
|
+
Write-Host "Installation failed!" -ForegroundColor Red
|
|
43
|
+
Write-Host "This may be due to missing dependencies. Try:" -ForegroundColor Yellow
|
|
44
|
+
Write-Host " uv python install 3.12"
|
|
45
|
+
Write-Host " Then run this installer again."
|
|
46
|
+
exit 1
|
|
47
|
+
}
|
|
48
|
+
$ErrorActionPreference = 'SilentlyContinue'
|
|
49
|
+
uv tool update-shell | Out-Null
|
|
50
|
+
$ErrorActionPreference = 'Stop'
|
|
51
|
+
|
|
52
|
+
# Pre-compile bytecode and warm up OS caches
|
|
53
|
+
Write-Host "[3/3] Optimizing for fast startup..." -ForegroundColor Yellow
|
|
54
|
+
$toolDir = "$env:LOCALAPPDATA\uv\tools\interpreter-v2"
|
|
55
|
+
if (Test-Path $toolDir) {
|
|
56
|
+
& "$toolDir\Scripts\python.exe" -m compileall -q "$toolDir\Lib" 2>$null
|
|
57
|
+
# Warm up caches (Windows Defender, etc.) by running once
|
|
58
|
+
& interpreter-v2 --list-windows 2>$null | Out-Null
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Write-Host ""
|
|
62
|
+
Write-Host "========================================" -ForegroundColor Green
|
|
63
|
+
Write-Host " Installation complete!" -ForegroundColor Green
|
|
64
|
+
Write-Host "========================================" -ForegroundColor Green
|
|
65
|
+
Write-Host ""
|
|
66
|
+
Write-Host "To start, run:" -ForegroundColor White
|
|
67
|
+
Write-Host ""
|
|
68
|
+
Write-Host " interpreter-v2" -ForegroundColor Cyan
|
|
69
|
+
Write-Host ""
|
|
70
|
+
Write-Host "You may need to restart your terminal first."
|
|
71
|
+
Write-Host ""
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# install.sh - One-liner installer for interpreter-v2
|
|
3
|
+
# Usage: curl -LsSf https://raw.githubusercontent.com/bquenin/interpreter/main/install.sh | bash
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Colors
|
|
8
|
+
CYAN='\033[0;36m'
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
YELLOW='\033[0;33m'
|
|
11
|
+
GRAY='\033[0;90m'
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
NC='\033[0m' # No Color
|
|
14
|
+
|
|
15
|
+
# Determine total steps (Linux has extra steps)
|
|
16
|
+
if [[ "$(uname)" == "Linux" ]]; then
|
|
17
|
+
TOTAL_STEPS=5
|
|
18
|
+
else
|
|
19
|
+
TOTAL_STEPS=3
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
echo ""
|
|
23
|
+
echo -e "${CYAN}=== interpreter-v2 Installer ===${NC}"
|
|
24
|
+
echo "Offline screen translator for Japanese retro games"
|
|
25
|
+
echo ""
|
|
26
|
+
|
|
27
|
+
# Check if uv is installed
|
|
28
|
+
if ! command -v uv &> /dev/null; then
|
|
29
|
+
echo -e "${YELLOW}[1/${TOTAL_STEPS}] Installing uv package manager...${NC}"
|
|
30
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
31
|
+
|
|
32
|
+
# Add uv to PATH for this session
|
|
33
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
34
|
+
|
|
35
|
+
# Verify uv is now available
|
|
36
|
+
if ! command -v uv &> /dev/null; then
|
|
37
|
+
echo -e "${RED}Error: uv installation failed. Please restart your terminal and try again.${NC}"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
echo -e "${GREEN}uv installed successfully!${NC}"
|
|
41
|
+
else
|
|
42
|
+
echo -e "${GREEN}[1/${TOTAL_STEPS}] uv is already installed${NC}"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Install or upgrade interpreter-v2
|
|
46
|
+
echo -e "${YELLOW}[2/${TOTAL_STEPS}] Installing interpreter-v2 from PyPI...${NC}"
|
|
47
|
+
echo -e "${GRAY} (this may take a minute on first install)${NC}"
|
|
48
|
+
# Use Python 3.12 - uv-managed Python includes tkinter, system Python 3.13+ often doesn't
|
|
49
|
+
if ! uv tool install --upgrade --python 3.12 interpreter-v2 2>&1; then
|
|
50
|
+
echo ""
|
|
51
|
+
echo -e "${RED}Installation failed!${NC}"
|
|
52
|
+
echo -e "${YELLOW}This may be due to missing dependencies. Try:${NC}"
|
|
53
|
+
echo -e " uv python install 3.12"
|
|
54
|
+
echo -e " Then run this installer again."
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
uv tool update-shell > /dev/null 2>&1 || true
|
|
58
|
+
|
|
59
|
+
# Pre-compile bytecode and warm up OS caches
|
|
60
|
+
echo -e "${YELLOW}[3/${TOTAL_STEPS}] Optimizing for fast startup...${NC}"
|
|
61
|
+
TOOL_DIR="$HOME/.local/share/uv/tools/interpreter-v2"
|
|
62
|
+
if [ -d "$TOOL_DIR" ]; then
|
|
63
|
+
# Compile bytecode (exclude .tmpl.py template files that aren't valid Python)
|
|
64
|
+
"$TOOL_DIR/bin/python" -m compileall -q -x '\.tmpl\.py$' "$TOOL_DIR/lib" 2>/dev/null || true
|
|
65
|
+
# Warm up OS caches by running once
|
|
66
|
+
interpreter-v2 --list-windows > /dev/null 2>&1 || true
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Install Wayland dependencies (Linux only)
|
|
70
|
+
if [[ "$(uname)" == "Linux" ]]; then
|
|
71
|
+
echo -e "${YELLOW}[4/${TOTAL_STEPS}] Checking Wayland capture dependencies...${NC}"
|
|
72
|
+
|
|
73
|
+
# Skip if not running on Wayland
|
|
74
|
+
if [ -z "$WAYLAND_DISPLAY" ]; then
|
|
75
|
+
echo -e "${GRAY} Not running on Wayland, skipping${NC}"
|
|
76
|
+
# Skip if GStreamer PipeWire plugin already installed
|
|
77
|
+
elif gst-inspect-1.0 pipewiresrc > /dev/null 2>&1; then
|
|
78
|
+
echo -e "${GREEN} GStreamer PipeWire plugin already installed${NC}"
|
|
79
|
+
# Need to install - detect package manager
|
|
80
|
+
elif command -v apt-get &> /dev/null; then
|
|
81
|
+
echo -e "${GRAY} Installing gstreamer1.0-pipewire...${NC}"
|
|
82
|
+
sudo apt-get install -y gstreamer1.0-pipewire gir1.2-gstreamer-1.0 2>/dev/null || \
|
|
83
|
+
echo -e "${YELLOW} Could not install automatically. Run: sudo apt-get install gstreamer1.0-pipewire gir1.2-gstreamer-1.0${NC}"
|
|
84
|
+
elif command -v dnf &> /dev/null; then
|
|
85
|
+
echo -e "${GRAY} Installing gstreamer1-plugin-pipewire...${NC}"
|
|
86
|
+
sudo dnf install -y gstreamer1-plugin-pipewire 2>/dev/null || \
|
|
87
|
+
echo -e "${YELLOW} Could not install automatically. Run: sudo dnf install gstreamer1-plugin-pipewire${NC}"
|
|
88
|
+
elif command -v pacman &> /dev/null; then
|
|
89
|
+
echo -e "${GRAY} Installing gst-plugin-pipewire...${NC}"
|
|
90
|
+
sudo pacman -S --noconfirm gst-plugin-pipewire 2>/dev/null || \
|
|
91
|
+
echo -e "${YELLOW} Could not install automatically. Run: sudo pacman -S gst-plugin-pipewire${NC}"
|
|
92
|
+
else
|
|
93
|
+
echo -e "${YELLOW} Please install GStreamer PipeWire plugin for native Wayland capture${NC}"
|
|
94
|
+
fi
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# Install desktop entry and icon (Linux only)
|
|
98
|
+
if [[ "$(uname)" == "Linux" ]]; then
|
|
99
|
+
echo -e "${YELLOW}[5/${TOTAL_STEPS}] Installing desktop entry...${NC}"
|
|
100
|
+
|
|
101
|
+
# Find the installed icon
|
|
102
|
+
ICON_SRC=$(find "$TOOL_DIR/lib" -name "icon.png" -path "*/resources/icons/*" 2>/dev/null | head -1)
|
|
103
|
+
|
|
104
|
+
if [ -n "$ICON_SRC" ]; then
|
|
105
|
+
# Install icon
|
|
106
|
+
mkdir -p "$HOME/.local/share/icons/hicolor/256x256/apps"
|
|
107
|
+
cp "$ICON_SRC" "$HOME/.local/share/icons/hicolor/256x256/apps/interpreter-v2.png"
|
|
108
|
+
|
|
109
|
+
# Install desktop entry
|
|
110
|
+
mkdir -p "$HOME/.local/share/applications"
|
|
111
|
+
cat > "$HOME/.local/share/applications/interpreter-v2.desktop" << 'EOF'
|
|
112
|
+
[Desktop Entry]
|
|
113
|
+
Name=Interpreter
|
|
114
|
+
Comment=Offline screen translator for Japanese games
|
|
115
|
+
Exec=interpreter-v2
|
|
116
|
+
Icon=interpreter-v2
|
|
117
|
+
Type=Application
|
|
118
|
+
Categories=Utility;Translation;
|
|
119
|
+
StartupWMClass=interpreter-v2
|
|
120
|
+
EOF
|
|
121
|
+
|
|
122
|
+
# Update caches
|
|
123
|
+
gtk-update-icon-cache -f "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
|
|
124
|
+
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
|
|
125
|
+
|
|
126
|
+
echo -e "${GREEN}Desktop entry installed${NC}"
|
|
127
|
+
else
|
|
128
|
+
echo -e "${GRAY}Skipping desktop entry (icon not found)${NC}"
|
|
129
|
+
fi
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
echo ""
|
|
133
|
+
echo -e "${GREEN}========================================${NC}"
|
|
134
|
+
echo -e "${GREEN} Installation complete!${NC}"
|
|
135
|
+
echo -e "${GREEN}========================================${NC}"
|
|
136
|
+
echo ""
|
|
137
|
+
echo "To start, run:"
|
|
138
|
+
echo ""
|
|
139
|
+
echo -e " ${CYAN}interpreter-v2${NC}"
|
|
140
|
+
echo ""
|
|
141
|
+
if [[ "$(uname)" == "Linux" ]]; then
|
|
142
|
+
echo -e "${YELLOW}Hotkeys:${NC} To use global hotkeys, add yourself to the input group:"
|
|
143
|
+
echo ""
|
|
144
|
+
echo -e " ${CYAN}sudo usermod -aG input \$USER${NC}"
|
|
145
|
+
echo ""
|
|
146
|
+
echo "Then log out and back in."
|
|
147
|
+
echo ""
|
|
148
|
+
fi
|
|
149
|
+
echo "You may need to restart your terminal first."
|
|
150
|
+
echo ""
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "interpreter-v2"
|
|
3
|
+
version = "2.13.0"
|
|
4
|
+
description = "Offline screen translator for Japanese retro games"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11,<3.13"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "qube" }
|
|
10
|
+
]
|
|
11
|
+
keywords = ["ocr", "translation", "japanese", "games", "retro"]
|
|
12
|
+
|
|
13
|
+
dependencies = [
|
|
14
|
+
# OCR
|
|
15
|
+
"meikiocr",
|
|
16
|
+
"onnxruntime",
|
|
17
|
+
# Translation (Sugoi V4)
|
|
18
|
+
"ctranslate2",
|
|
19
|
+
"sentencepiece",
|
|
20
|
+
# Image processing
|
|
21
|
+
"Pillow>=10.0.0",
|
|
22
|
+
"numpy",
|
|
23
|
+
"opencv-python",
|
|
24
|
+
# Screen capture
|
|
25
|
+
"mss>=9.0.0",
|
|
26
|
+
# Configuration
|
|
27
|
+
"PyYAML>=6.0",
|
|
28
|
+
# Model download
|
|
29
|
+
"requests",
|
|
30
|
+
"tqdm",
|
|
31
|
+
# Logging
|
|
32
|
+
"structlog>=24.0.0",
|
|
33
|
+
# macOS only - window capture
|
|
34
|
+
"pyobjc-framework-Quartz>=10.0; sys_platform == 'darwin'",
|
|
35
|
+
# Windows only - window capture
|
|
36
|
+
"pygetwindow>=0.0.9; sys_platform == 'win32'",
|
|
37
|
+
# Fork with HWND support for reliable capture with dynamic window titles
|
|
38
|
+
"windows-capture-interpreter>=1.5.1; sys_platform == 'win32'",
|
|
39
|
+
# Linux only - window capture (X11)
|
|
40
|
+
"python-xlib>=0.33; sys_platform == 'linux'",
|
|
41
|
+
# Linux only - window capture (Wayland via PipeWire portal)
|
|
42
|
+
"dbus-python>=1.3.2; sys_platform == 'linux'",
|
|
43
|
+
"PyGObject>=3.42.0; sys_platform == 'linux'",
|
|
44
|
+
# GPU acceleration (CUDA 12) - Windows and Linux
|
|
45
|
+
"nvidia-cublas-cu12; sys_platform == 'win32' or sys_platform == 'linux'",
|
|
46
|
+
"nvidia-cudnn-cu12; sys_platform == 'win32' or sys_platform == 'linux'",
|
|
47
|
+
# GUI
|
|
48
|
+
"PySide6>=6.6.0",
|
|
49
|
+
# Global hotkeys (macOS/Windows use pynput, Linux uses evdev directly)
|
|
50
|
+
"pynput>=1.7.0; sys_platform == 'darwin' or sys_platform == 'win32'",
|
|
51
|
+
"pyobjc-framework-cocoa>=12.1; sys_platform == 'darwin'",
|
|
52
|
+
# Linux only - global hotkeys (evdev-binary provides pre-built wheels, no kernel headers needed)
|
|
53
|
+
"evdev-binary>=1.9.0; sys_platform == 'linux'",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.scripts]
|
|
57
|
+
interpreter-v2 = "interpreter:main"
|
|
58
|
+
|
|
59
|
+
[build-system]
|
|
60
|
+
requires = ["hatchling"]
|
|
61
|
+
build-backend = "hatchling.build"
|
|
62
|
+
|
|
63
|
+
[tool.hatch.build.targets.wheel]
|
|
64
|
+
packages = ["src/interpreter"]
|
|
65
|
+
|
|
66
|
+
[dependency-groups]
|
|
67
|
+
dev = [
|
|
68
|
+
"ruff>=0.14.10",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 120
|
|
73
|
+
target-version = "py311"
|
|
74
|
+
src = ["src"]
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
select = [
|
|
78
|
+
"E", # pycodestyle errors
|
|
79
|
+
"F", # pyflakes
|
|
80
|
+
"W", # pycodestyle warnings
|
|
81
|
+
"I", # isort
|
|
82
|
+
"UP", # pyupgrade
|
|
83
|
+
"B", # flake8-bugbear
|
|
84
|
+
"SIM", # flake8-simplify
|
|
85
|
+
"RUF", # ruff-specific rules
|
|
86
|
+
]
|
|
87
|
+
ignore = [
|
|
88
|
+
"E501", # line too long (handled by formatter)
|
|
89
|
+
"RUF001", # ambiguous unicode (intentional Japanese punctuation)
|
|
90
|
+
"RUF012", # mutable class attributes (ctypes structures)
|
|
91
|
+
"SIM102", # nested if statements (sometimes clearer)
|
|
92
|
+
"SIM105", # contextlib.suppress (try/except/pass is clearer)
|
|
93
|
+
"SIM108", # ternary operator (multi-line if/else is clearer)
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[tool.ruff.lint.isort]
|
|
97
|
+
known-first-party = ["interpreter"]
|
|
98
|
+
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Interpreter - Offline screen translator for Japanese retro games.
|
|
2
|
+
|
|
3
|
+
This application captures text from a target window, performs OCR using
|
|
4
|
+
MeikiOCR, translates using Sugoi V4, and displays subtitles in a
|
|
5
|
+
transparent overlay.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from importlib.metadata import version
|
|
9
|
+
|
|
10
|
+
__version__ = version("interpreter-v2")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main():
|
|
14
|
+
"""Entry point for the application."""
|
|
15
|
+
from .gui import run
|
|
16
|
+
|
|
17
|
+
return run()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = ["__version__", "main"]
|