take.sh builds arr-tui, starts a fake Radarr, Sonarr and SABnzbd with a made-up library (catalog.py, server.py, generated posters), and runs the scene scripts in Ghostty under Xvfb, writing docs/screenshots/. Run on the same day it reproduces the committed pictures byte for byte. make test also shellchecks the scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
66 lines
2.3 KiB
Bash
Executable File
66 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Take the README screenshots: build arr-tui, start the fake services with the
|
|
# made-up library, and run every scene in Ghostty on a virtual X display. The
|
|
# pictures go to docs/screenshots/ (losslessly compressed if oxipng is there).
|
|
#
|
|
# Needs: go, python3, ghostty, xvfb-run (Xvfb), xdotool, ImageMagick 7,
|
|
# fontconfig with DejaVu fonts; oxipng optional. On NixOS:
|
|
# nix-shell -p xvfb-run xorg-server xdotool imagemagick oxipng --run dev/screenshots/take.sh
|
|
set -euo pipefail
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
repo=$(cd "$here/../.." && pwd)
|
|
out=$repo/docs/screenshots
|
|
# The Config view shows the config file's path; keep it neutral.
|
|
demo=/tmp/arr-tui-demo
|
|
|
|
for tool in go python3 ghostty xvfb-run xdotool magick fc-match; do
|
|
command -v "$tool" >/dev/null || { echo "take.sh: $tool is missing" >&2; exit 1; }
|
|
done
|
|
|
|
work=$(mktemp -d)
|
|
cleanup() {
|
|
[[ -n ${server:-} ]] && kill "$server" 2>/dev/null
|
|
rm -rf "$work" "$demo"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
echo "building arr-tui"
|
|
go build -C "$repo" -o "$work/arr-tui" ./cmd/arr-tui
|
|
|
|
[[ -d $here/posters ]] || { echo "generating posters"; "$here/posters.sh"; }
|
|
|
|
echo "starting the fake Radarr, Sonarr and SABnzbd"
|
|
python3 "$here/server.py" &
|
|
server=$!
|
|
sleep 1
|
|
|
|
# One config per theme, each at $demo/<theme>/.config/arr-tui/config.json.
|
|
for theme in dark light; do
|
|
mkdir -p "$demo/$theme/.config/arr-tui"
|
|
cat >"$demo/$theme/.config/arr-tui/config.json" <<JSON
|
|
{
|
|
"radarr": {"url": "http://127.0.0.1:19891", "apikey": "0123456789abcdef0123456789abcdef", "default_quality_profile": "Ultra-HD", "default_root_folder": "/movies"},
|
|
"sonarr": {"url": "http://127.0.0.1:19892", "apikey": "0123456789abcdef0123456789abcdef", "default_quality_profile": "HD-1080p", "default_root_folder": "/tv"},
|
|
"sabnzbd": {"url": "http://127.0.0.1:19893", "apikey": "0123456789abcdef0123456789abcdef"},
|
|
"ui": {"theme": "$theme"}
|
|
}
|
|
JSON
|
|
chmod 600 "$demo/$theme/.config/arr-tui/config.json"
|
|
done
|
|
|
|
mkdir -p "$out"
|
|
shoot() { # scene theme [ghostty args]
|
|
echo "scene $1"
|
|
XDG_CONFIG_HOME=$demo/$2/.config "$here/xshot.sh" "$here/scenes/$1.txt" "$out" "${3:-}" "$work/arr-tui"
|
|
}
|
|
shoot views dark
|
|
shoot episodes dark
|
|
shoot config dark
|
|
shoot light light "--background=eeeeee --foreground=1c1c1c"
|
|
|
|
if command -v oxipng >/dev/null; then
|
|
oxipng -o 4 --strip safe -q "$out"/*.png
|
|
fi
|
|
echo "screenshots in $out:"
|
|
ls "$out"
|