-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRUN.command
More file actions
executable file
·81 lines (68 loc) · 1.92 KB
/
Copy pathRUN.command
File metadata and controls
executable file
·81 lines (68 loc) · 1.92 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
#!/bin/zsh
set -e
pause_before_close() {
echo ""
read -k 1 "reply?Press any key to close..."
}
TRAPERR() {
local exit_code=$?
echo ""
echo "The research pipeline failed before finishing."
echo "Scroll up for the error. You can run RUN.command again after fixing it."
pause_before_close
exit $exit_code
}
SCRIPT_DIR="${0:a:h}"
cd "$SCRIPT_DIR"
echo "YouTubeResearchAI"
echo "================="
echo "Project folder: $SCRIPT_DIR"
echo ""
if ! command -v node >/dev/null 2>&1; then
echo "Node.js is required but was not found on PATH."
echo "Install Node.js, then double-click RUN.command again."
pause_before_close
exit 1
fi
if ! command -v yt-dlp >/dev/null 2>&1; then
echo "yt-dlp is required but was not found on PATH."
echo "Install it with: brew install yt-dlp"
pause_before_close
exit 1
fi
if ! command -v ffmpeg >/dev/null 2>&1 || ! command -v ffprobe >/dev/null 2>&1; then
echo "ffmpeg and ffprobe are required but were not found on PATH."
echo "Install them with: brew install ffmpeg"
pause_before_close
exit 1
fi
if [ ! -f ".env" ]; then
echo "Missing .env file. Copy .env.example to .env and add OPENAI_API_KEY=..."
pause_before_close
exit 1
fi
if [ ! -f "links.txt" ]; then
cat > links.txt <<'EOF'
# Put one YouTube URL per line.
# Blank lines and comments are ignored.
EOF
fi
if ! grep -Eq '^[[:space:]]*https?://' links.txt; then
echo "No YouTube links found in links.txt."
echo "Opening links.txt now. Add one URL per line, save it, then run again."
open -a TextEdit links.txt
pause_before_close
exit 1
fi
if [ ! -d "node_modules" ]; then
echo "Installing project dependencies. This only happens the first time..."
npm install
echo ""
fi
echo "Running research pipeline from links.txt..."
echo ""
npm run research -- --links "$SCRIPT_DIR/links.txt" --out-dir "$SCRIPT_DIR/outputs"
echo ""
echo "Done. Opening output folder..."
open "$SCRIPT_DIR/outputs"
pause_before_close