-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·109 lines (97 loc) · 3.36 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·109 lines (97 loc) · 3.36 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
108
109
#!/usr/bin/env bash
# setup.sh — One-command installer for reels-workflow
# Works on Linux, macOS, and WSL2
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log() { echo -e "${GREEN}[✓]${NC} $1"; }
warn() { echo -e "${YELLOW}[!]${NC} $1"; }
err() { echo -e "${RED}[✗]${NC} $1"; exit 1; }
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " YouTube Reels Workflow — Setup"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# ── Check OS ──
OS="$(uname -s)"
case "$OS" in
Linux*) PLATFORM="linux";;
Darwin*) PLATFORM="macos";;
MINGW*|MSYS*|CYGWIN*) PLATFORM="windows";;
*) err "Unsupported OS: $OS";;
esac
log "Detected platform: $PLATFORM"
# ── Install system deps ──
install_system_deps() {
if command -v apt-get &>/dev/null; then
sudo apt-get update -qq
sudo apt-get install -y -qq ffmpeg python3 python3-pip python3-venv curl jq
elif command -v brew &>/dev/null; then
brew install ffmpeg python3 curl jq
elif command -v pacman &>/dev/null; then
sudo pacman -S --noconfirm ffmpeg python python-pip curl jq
else
warn "Unknown package manager — ensure ffmpeg, python3, curl, jq are installed"
fi
}
echo ""
echo "Step 1/5: System dependencies"
install_system_deps
log "System deps installed"
# ── Install yt-dlp ──
echo ""
echo "Step 2/5: yt-dlp"
if command -v yt-dlp &>/dev/null; then
log "yt-dlp already installed: $(yt-dlp --version)"
else
pip3 install --user yt-dlp 2>/dev/null || pip install --user yt-dlp
log "yt-dlp installed"
fi
# ── Install Node.js deps ──
echo ""
echo "Step 3/5: Node.js dependencies"
if [ -f "$REPO_DIR/package.json" ]; then
cd "$REPO_DIR"
npm install --silent 2>/dev/null
log "Node.js deps installed"
else
warn "No package.json found — skipping Node.js deps"
fi
# ── Python venv ──
echo ""
echo "Step 4/5: Python virtual environment"
if [ ! -d "$REPO_DIR/.venv" ]; then
python3 -m venv "$REPO_DIR/.venv"
log "Created .venv"
fi
source "$REPO_DIR/.venv/bin/activate"
pip install --quiet --upgrade pip
if [ -f "$REPO_DIR/requirements.txt" ]; then
pip install --quiet -r "$REPO_DIR/requirements.txt"
fi
log "Python venv ready"
# ── Config ──
echo ""
echo "Step 5/5: Configuration"
if [ ! -f "$REPO_DIR/config/config.yaml" ]; then
cp "$REPO_DIR/config/config.example.yaml" "$REPO_DIR/config/config.yaml"
log "Created config/config.yaml from template"
warn "EDIT config/config.yaml with your API keys before running!"
else
log "config/config.yaml already exists"
fi
# ── Make scripts executable ──
chmod +x "$REPO_DIR/scripts/"*.sh 2>/dev/null || true
chmod +x "$REPO_DIR/setup.sh" 2>/dev/null || true
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "${GREEN}Setup complete!${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Next steps:"
echo " 1. Edit config/config.yaml with your API keys"
echo " 2. Read WORKFLOW.md for full instructions"
echo " 3. Test: ./scripts/download.sh <youtube-url>"
echo ""