#!/usr/bin/env bash set -euo pipefail PROJECT_DIR="/home/jarian/projects/media-transcriber" WHISPER_CPP="/home/jarian/whisper.cpp" echo "=== Media Transcriber Setup ===" # Create venv cd "$PROJECT_DIR" python3 -m venv venv source venv/bin/activate # Install deps pip install --upgrade pip # Ensure ffmpeg available if ! command -v ffmpeg &>/dev/null; then echo "ERROR: ffmpeg not found. Install with: sudo apt install ffmpeg" exit 1 fi if ! command -v ffprobe &>/dev/null; then echo "ERROR: ffprobe not found. Install with: sudo apt install ffmpeg" exit 1 fi # Check whisper-server binary if [ ! -f "$WHISPER_CPP/build/bin/whisper-server" ]; then echo "ERROR: whisper-server not built. Run:" echo " cd $WHISPER_CPP && cmake -B build -DWHISPER_CUDA=ON && cmake --build build" exit 1 fi # Download small model if missing MODEL_PATH="$WHISPER_CPP/models/ggml-small.bin" if [ ! -f "$MODEL_PATH" ]; then echo "Downloading whisper small model..." bash "$WHISPER_CPP/models/download-ggml-model.sh" small fi # Initial scan echo "Running initial video scan..." cd "$PROJECT_DIR" source venv/bin/activate python src/worker.py scan echo "" echo "=== Setup complete ===" echo "" echo "To start whisper-server on GPU 1:" echo " CUDA_VISIBLE_DEVICES=1 $WHISPER_CPP/build/bin/whisper-server \\" echo " -m $MODEL_PATH -ngl 99 -ps 16384" echo "" echo "Or enable systemd service:" echo " sudo cp systemd/whisper-server.service /etc/systemd/system/" echo " sudo systemctl enable --start whisper-server" echo "" echo "To enable nightly transcription:" echo " sudo cp systemd/media-transcriber.timer /etc/systemd/system/" echo " sudo cp systemd/media-transcriber.service /etc/systemd/system/" echo " sudo systemctl enable --now media-transcriber.timer"