summaryrefslogtreecommitdiff
path: root/scripts/install-whisper.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-04 14:35:50 -0600
committerCraig Jennings <c@cjennings.net>2025-11-04 14:35:50 -0600
commit45cab5c38dc089935416a89d36b461d9127094ac (patch)
treeccfb33579de009c8c8694f2a79d10e487d74de8f /scripts/install-whisper.sh
parentefbcd0b7de7993b9fde29297daad1154711a3e81 (diff)
feat: Add complete async audio transcription workflow
Implemented full transcription system with local Whisper and OpenAI API support. Includes comprehensive test suite (60 tests) and reorganized keybindings for better discoverability. Features: - Async transcription (non-blocking workflow) - Desktop notifications (started/complete/error) - Output: audio.txt (transcript) + audio.log (process logs) - Modeline integration showing active transcription count - Dired integration (press T on audio files) - Process management and tracking Scripts: - install-whisper.sh: Install Whisper via AUR or pip - uninstall-whisper.sh: Clean removal with cache cleanup - local-whisper: Offline transcription using installed Whisper - oai-transcribe: Cloud transcription via OpenAI API Tests (60 passing): - Audio file detection (16 tests) - Path generation logic (11 tests) - Log cleanup behavior (5 tests) - Duration formatting (9 tests) - Active counter & modeline (11 tests) - Integration workflows (8 tests) Keybindings: - Reorganized gcal to C-; g submenu (s/t/r/c) - Added C-; t transcription submenu (t/b/k) - Dired: T to transcribe file at point 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'scripts/install-whisper.sh')
-rwxr-xr-xscripts/install-whisper.sh103
1 files changed, 103 insertions, 0 deletions
diff --git a/scripts/install-whisper.sh b/scripts/install-whisper.sh
new file mode 100755
index 00000000..e2ea4ac9
--- /dev/null
+++ b/scripts/install-whisper.sh
@@ -0,0 +1,103 @@
+#!/usr/bin/env bash
+# Install OpenAI Whisper for transcription on Arch Linux
+# Usage: install-whisper.sh [--yes] # --yes for non-interactive mode
+
+set -euo pipefail
+
+# Non-interactive mode
+ASSUME_YES=false
+if [[ "${1:-}" == "--yes" ]] || [[ "${1:-}" == "-y" ]]; then
+ ASSUME_YES=true
+fi
+
+echo "=== Whisper Installation for Arch Linux ==="
+echo
+
+# Check if running on Arch
+if [[ ! -f /etc/arch-release ]]; then
+ echo "Warning: This script is designed for Arch Linux"
+ if [[ "$ASSUME_YES" == false ]]; then
+ read -p "Continue anyway? [y/N] " -n 1 -r
+ echo
+ [[ ! $REPLY =~ ^[Yy]$ ]] && exit 1
+ else
+ echo "Continuing anyway (--yes mode)"
+ fi
+fi
+
+# 1. Install system dependencies
+echo "Step 1/3: Installing system dependencies (ffmpeg)..."
+if ! command -v ffmpeg &> /dev/null; then
+ sudo pacman -S --needed ffmpeg
+ echo "✓ ffmpeg installed"
+else
+ echo "✓ ffmpeg already installed"
+fi
+
+# 2. Check for AUR package first (optional but cleaner)
+echo
+echo "Step 2/3: Checking for AUR package..."
+AUR_INSTALLED=false
+
+if command -v yay &> /dev/null; then
+ echo "Found yay. Checking AUR for python-openai-whisper..."
+ if yay -Ss python-openai-whisper | grep -q 'python-openai-whisper'; then
+ INSTALL_AUR=false
+ if [[ "$ASSUME_YES" == true ]]; then
+ echo "Installing from AUR (--yes mode)"
+ INSTALL_AUR=true
+ else
+ read -p "Install from AUR via yay? [Y/n] " -n 1 -r
+ echo
+ if [[ $REPLY =~ ^[Yy]$ ]] || [[ -z $REPLY ]]; then
+ INSTALL_AUR=true
+ fi
+ fi
+
+ if [[ "$INSTALL_AUR" == true ]]; then
+ yay -S --needed --noconfirm python-openai-whisper
+ echo "✓ Installed from AUR"
+ AUR_INSTALLED=true
+ fi
+ else
+ echo "Package python-openai-whisper not found in AUR"
+ fi
+else
+ echo "yay not found. Skipping AUR installation."
+ echo "(Install yay if you prefer AUR packages)"
+fi
+
+# 3. Install via pip if not from AUR
+if [[ "$AUR_INSTALLED" == false ]]; then
+ echo
+ echo "Step 3/3: Installing openai-whisper via pip..."
+ pip install --user -U openai-whisper
+ echo "✓ openai-whisper installed via pip"
+ echo
+ echo "Note: Ensure ~/.local/bin is in your PATH"
+ echo "Add to ~/.bashrc or ~/.zshrc: export PATH=\"\$HOME/.local/bin:\$PATH\""
+fi
+
+# Verify installation
+echo
+echo "=== Verifying Installation ==="
+if command -v whisper &> /dev/null; then
+ echo "✓ whisper command found at: $(which whisper)"
+ whisper --help | head -n 3
+ echo
+ echo "=== Installation Complete! ==="
+ echo
+ echo "Models available: tiny, base, small, medium, large"
+ echo "Recommended: small (good balance of speed/accuracy)"
+ echo "Model will download automatically on first use."
+ echo
+ echo "Test with: whisper your-audio.m4a --model small --language en"
+else
+ echo "✗ Installation failed - whisper command not found"
+ echo
+ echo "Troubleshooting:"
+ echo "1. Ensure ~/.local/bin is in your PATH"
+ echo "2. Run: source ~/.bashrc (or ~/.zshrc)"
+ echo "3. Try: python -m whisper --help"
+ exit 1
+fi