blob: e2ea4ac9d71e901c35d7540247e4700d2238c9e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
|