- Implement faster-whisper TranscribeService with word-level timestamps, progress reporting, and hardware auto-detection - Wire up Rust SidecarManager for Python process lifecycle (spawn, IPC, shutdown) - Add transcribe_file Tauri command bridging frontend to Python sidecar - Integrate wavesurfer.js WaveformPlayer with play/pause, skip, seek controls - Build TranscriptEditor with word-level click-to-seek and active highlighting - Connect file import flow: prompt → asset load → transcribe → display - Add typed tauri-bridge service with TranscriptionResult interface - Add Python tests for hardware detection and transcription result formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
"""Main entry point for the Voice to Notes Python sidecar."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import signal
|
|
import sys
|
|
|
|
from voice_to_notes.ipc.handlers import (
|
|
HandlerRegistry,
|
|
hardware_detect_handler,
|
|
make_transcribe_handler,
|
|
ping_handler,
|
|
)
|
|
from voice_to_notes.ipc.messages import ready_message
|
|
from voice_to_notes.ipc.protocol import read_message, write_message
|
|
|
|
|
|
def create_registry() -> HandlerRegistry:
|
|
"""Set up the message handler registry."""
|
|
registry = HandlerRegistry()
|
|
registry.register("ping", ping_handler)
|
|
registry.register("transcribe.start", make_transcribe_handler())
|
|
registry.register("hardware.detect", hardware_detect_handler)
|
|
# TODO: Register diarize, pipeline, ai, export handlers
|
|
return registry
|
|
|
|
|
|
def main() -> None:
|
|
"""Main loop: read messages from stdin, dispatch to handlers, write responses to stdout."""
|
|
|
|
# Handle clean shutdown
|
|
def shutdown(signum: int, frame: object) -> None:
|
|
print("[sidecar] Shutting down...", file=sys.stderr, flush=True)
|
|
sys.exit(0)
|
|
|
|
signal.signal(signal.SIGTERM, shutdown)
|
|
signal.signal(signal.SIGINT, shutdown)
|
|
|
|
registry = create_registry()
|
|
|
|
# Signal to Rust that we're ready
|
|
write_message(ready_message())
|
|
print("[sidecar] Ready and waiting for messages", file=sys.stderr, flush=True)
|
|
|
|
# Message loop
|
|
while True:
|
|
msg = read_message()
|
|
if msg is None:
|
|
# EOF — parent closed stdin, time to exit
|
|
print("[sidecar] EOF on stdin, exiting", file=sys.stderr, flush=True)
|
|
break
|
|
|
|
response = registry.handle(msg)
|
|
if response is not None:
|
|
write_message(response)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|