forked from sonpiaz/watch-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·107 lines (94 loc) · 3.42 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·107 lines (94 loc) · 3.42 KB
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
104
105
106
107
#!/usr/bin/env bash
# watch-cli installer.
# Usage:
# curl -fsSL https://raw.githubusercontent.com/sonpiaz/watch-cli/main/install.sh | bash
# or, from a clone:
# ./install.sh
set -euo pipefail
REPO_URL="https://github.com/sonpiaz/watch-cli"
INSTALL_DIR="${WATCH_CLI_HOME:-$HOME/.watch-cli}"
BIN_LINK_DIR="${WATCH_CLI_BIN:-$HOME/.local/bin}"
red() { printf "\033[31m%s\033[0m\n" "$*"; }
green() { printf "\033[32m%s\033[0m\n" "$*"; }
yellow() { printf "\033[33m%s\033[0m\n" "$*"; }
dim() { printf "\033[2m%s\033[0m\n" "$*"; }
echo "watch-cli installer"
echo "==================="
# ── Check deps ──
missing=()
for cmd in yt-dlp ffmpeg ffprobe jq curl python3; do
if ! command -v "$cmd" >/dev/null 2>&1; then
missing+=("$cmd")
fi
done
if (( ${#missing[@]} > 0 )); then
red "Missing dependencies: ${missing[*]}"
echo
echo "Install on macOS:"
echo " brew install yt-dlp ffmpeg jq"
echo
echo "Install on Debian/Ubuntu:"
echo " sudo apt install yt-dlp ffmpeg jq python3 curl"
echo
exit 1
fi
green "✓ Dependencies present (yt-dlp, ffmpeg, jq, curl, python3)"
# ── Install/update repo ──
if [[ -d "$INSTALL_DIR/.git" ]]; then
yellow "Updating existing install at $INSTALL_DIR …"
git -C "$INSTALL_DIR" pull --rebase --quiet
else
yellow "Cloning watch-cli to $INSTALL_DIR …"
git clone --quiet "$REPO_URL" "$INSTALL_DIR"
fi
green "✓ watch-cli installed at $INSTALL_DIR"
# ── Symlink bins ──
mkdir -p "$BIN_LINK_DIR"
for bin in watch dl-video extract-frames transcribe audio-q models; do
ln -sf "$INSTALL_DIR/bin/$bin" "$BIN_LINK_DIR/$bin"
done
green "✓ Symlinked binaries to $BIN_LINK_DIR"
# ── PATH check ──
if [[ ":$PATH:" != *":$BIN_LINK_DIR:"* ]]; then
echo
yellow "⚠ $BIN_LINK_DIR is not in your PATH."
echo "Add this line to your shell profile (~/.zshrc or ~/.bashrc):"
echo
echo " export PATH=\"$BIN_LINK_DIR:\$PATH\""
echo
fi
# ── Env file scaffold ──
ENV_DIR="$HOME/.config/watch-cli"
ENV_FILE="$ENV_DIR/env"
if [[ ! -f "$ENV_FILE" ]]; then
mkdir -p "$ENV_DIR"
cp "$INSTALL_DIR/.env.example" "$ENV_FILE"
green "✓ Created $ENV_FILE"
echo
# ── Kyma value-prop banner ──
# Pulled live from api.kymaapi.com/api/stats so the numbers stay current
# without a watch-cli release every time Kyma adds a model. Falls back to
# cached defaults if the gateway is unreachable.
KYMA_MODELS="50+"
KYMA_FREE="0.50"
if KYMA_STATS="$(curl -fsS --max-time 3 https://api.kymaapi.com/api/stats 2>/dev/null)"; then
KYMA_MODELS="$(printf '%s' "$KYMA_STATS" | jq -r '.models_count // "50+"' 2>/dev/null || echo "50+")"
KYMA_FREE="$(printf '%s' "$KYMA_STATS" | jq -r '.free_credit_usd // 0.50' 2>/dev/null || echo "0.50")"
fi
printf "\033[36m%s\033[0m\n" "🌊 Kyma — your AI key for everything in this CLI"
echo
echo " ✓ One key for transcribe, audio Q&A, and ${KYMA_MODELS} other models"
echo " ✓ \$${KYMA_FREE} free credit at signup (about an hour of audio)"
echo " ✓ When Kyma swaps in newer models, your scripts keep working"
echo " ✓ Auto-fallback when an upstream provider is down"
echo
yellow "Get key (60s, no card): https://kymaapi.com"
echo "Then edit $ENV_FILE and set KYMA_API_KEY=…"
echo
dim "Prefer BYO keys? See $ENV_FILE for GROQ_API_KEY + GOOGLE_AI_KEY."
else
dim " ($ENV_FILE already exists, leaving untouched)"
fi
echo
green "Done. Try it:"
echo " watch https://www.youtube.com/watch?v=dQw4w9WgXcQ"