71c19370e5
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
whisper-local
Lokales Speech-to-Text-Tool: Hotkey halten → Audio aufnehmen → faster-whisper transkribieren → Text einfügen.
Entwicklungsumgebung
- Python 3.13+, Paketmanager:
uv(Lock-File:uv.lock) - Tests:
uv run pytest(mitpytest-asynciofür async-Tests) - Starten:
uv run whisper-local
Architektur
- Plattform-Dispatch via Factory-Funktionen:
create_listener()/create_inserter() - Linux: evdev (Hotkey) + ydotool/wl-copy (Wayland-Inserter)
- Windows: pynput (Hotkey) + pywin32 Clipboard + Ctrl+V (Win32-Inserter)
- Interfaces als
typing.Protocol— keine abstrakte Basisklasse
Wichtige Muster
- Hotkey-Key-Namen im evdev-Format (
KEY_F12), auch auf Windows —_pynput.pyübersetzt intern - Key-Repeat-Unterdrückung im pynput-Backend:
_pressed-Flag verhindert Doppelevents - Async-Callbacks (
on_press,on_release) viaasyncio.get_running_loop().call_soon_threadsafe
Konfiguration
- Linux:
~/.config/whisper-local/config.toml - Windows:
%APPDATA%\whisper-local\config.toml - Vorlage:
config.example.toml
Tests
- Plattform-spezifische Tests mit
@pytest.mark.skipif(sys.platform != "linux", ...) - Async-Callbacks mit
unittest.mock.AsyncMockmocken