#!/bin/bash # Start only the transcription worker set -e # Exit on error set -u # Exit on undefined variable # Ensure we're in the project root regardless of where script was called from # This is required because we use relative paths for venv and worker scripts SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # Validate virtual environment exists if [[ ! -f "$SCRIPT_DIR/venv/bin/activate" ]]; then echo "Error: Virtual environment not found at $SCRIPT_DIR/venv" echo "Create it with: python3 -m venv venv && source venv/bin/activate && pip install -e ." exit 1 fi source venv/bin/activate || { echo "Error: Failed to activate virtual environment" exit 1 } # Validate transcription worker script exists if [[ ! -f "$SCRIPT_DIR/worker/transcription.py" ]]; then echo "Error: Transcription script not found at $SCRIPT_DIR/worker/transcription.py" exit 1 fi # Verify required modules are available if ! python -c "from worker.transcription import main" 2>/dev/null; then echo "Error: Failed to import worker.transcription module" echo "Ensure the package is installed: pip install -e ." exit 1 fi # Verify whisper module is installed if ! python -c "import whisper" 2>/dev/null; then echo "Error: whisper module not installed" echo "Install with: pip install openai-whisper" exit 1 fi exec python worker/transcription.py "$@"