chessbaseLinux/website/shots/make-screenshots.sh
vrubelroman 005601afb2 Website: new features and fresh screenshots; no missing glyphs in the app
The site lists the reference tab, games from Lichess and Chess.com, translated
comments and self-update, and the notation and animation under "Make it
yours", in six languages. Thirteen screenshots (three new: reference,
translation, online games) on the owner's green board with Merida pieces, the
"looks" one on another board. The translation shot shows a real ChatGPT
translation of our own German comments to Reti-Tartakower 1910, put into the
screenshot cache once (shots/translate-for-shots.py); the shots send nothing.

The app: "✕" next to the Chess.com nickname, "⌂" in board search and "✓" in
translation texts had no glyph (empty boxes): replaced by the bundled 🗙, 🏠
and ✔. A test now checks every character of the translations and the string
literals against the character maps of the bundled fonts. The online games dev
hook takes two nicknames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:47:14 +03:00

105 lines
5.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Takes the thirteen screenshots of the website with the release build of ChessPenguin and
# its dev hooks (docs/dev/desktop.md), in English, fullscreen (3840x2160 at scale 2).
# Games: shots/classic-games.pgn (public-domain games, our own comments). Lists: a
# large ChessBase database shown under a neutral name (hard links), never its annotations.
#
# website/shots/make-screenshots.sh "/path/to/Mega Database 2026.cbh" /path/to/sf_19
# The second argument is a directory with a downloaded `stockfish` (engines/sf_19).
set -euo pipefail
big="${1:?usage: $0 BIG_DATABASE.cbh STOCKFISH_DIR}"
engine_dir="${2:?usage: $0 BIG_DATABASE.cbh STOCKFISH_DIR}"
root="$(cd "$(dirname "$0")/../.." && pwd)"
app="${root}/target/release/chesspenguin"
out="${root}/website/shots/raw"
work="${root}/target/site-shots"
mkdir -p "${out}" "${work}"
# The large database under a neutral name: every companion file hard-linked (a symlink
# would be resolved to the original name by the app).
db_dir="${work}/db"
rm -rf "${db_dir}" && mkdir -p "${db_dir}"
stem="$(basename "${big}" .cbh)"
for f in "$(dirname "${big}")/${stem}".*; do
[[ -f "${f}" ]] || continue
ln "${f}" "${db_dir}/Tournament games${f#"$(dirname "${big}")/${stem}"}"
done
tournament="${db_dir}/Tournament games.cbh"
classics="${db_dir}/Classic games.pgn"
cp "${root}/website/shots/classic-games.pgn" "${classics}"
# settings.json: English, the downloaded Stockfish, the databases in order, the large
# database for the reference tab, translation through ChatGPT (shown from the cache:
# the shots never send anything).
settings() { # dark board pieces first_db second_db
cat <<EOF
{
"language": "En", "dark_mode": $1, "board_theme": "$2", "piece_set": "$3",
"sound_enabled": false, "engines_discovered": true, "check_updates": false,
"engines": [{"name": "Stockfish 19", "path": "", "builtin": true, "threads": 8, "hash_mb": 512, "multipv": 3}],
"active_engine": 0,
"databases": ["$4", "$5"],
"reference_db": "${tournament}",
"translation": {"connection": "ChatGpt", "auto": true, "allowed": ["chatgpt"]}
}
EOF
}
# One shot (ONLY="07 08" takes just these): name, settings JSON, delay, then environment assignments and app arguments.
shot() {
local name="$1" json="$2" delay="$3"
if [[ -n "${ONLY:-}" && " ${ONLY} " != *" ${name%%-*} "* ]]; then return; fi
shift 3
local home="${work}/${name}"
rm -rf "${home}/cfg"
mkdir -p "${home}/cfg/chesspenguin" "${home}/data/chesspenguin/engines"
printf '%s' "${json}" > "${home}/cfg/chesspenguin/settings.json"
ln -sfn "${engine_dir}" "${home}/data/chesspenguin/engines/sf_19"
# The analysis cache is shared, so the game analysis is computed only once; NOCACHE
# gives a shot its own empty cache (no engine marks).
local cache="${work}/cache"
if [[ "${1:-}" == NOCACHE ]]; then cache="${home}/cache"; rm -rf "${cache}"; shift; fi
mkdir -p "${cache}"
echo "== ${name}"
# CP_* assignments go to the environment, the rest are the app's arguments.
local vars=() args=()
for a in "$@"; do
if [[ "${a}" == CP_*=* ]]; then vars+=("${a}"); else args+=("${a}"); fi
done
env XDG_CONFIG_HOME="${home}/cfg" XDG_DATA_HOME="${home}/data" XDG_CACHE_HOME="${cache}" \
CP_SCREENSHOT="${out}/${name}.png" CP_SCREENSHOT_DELAY="${delay}" "${vars[@]}" "${app}" "${args[@]}" \
> "${home}/log" 2>&1 || true
ls -la "${out}/${name}.png"
}
# The owner's board: green squares, Merida pieces; the "looks" shot shows another one.
dark_games="$(settings true Green Merida "${classics}" "${tournament}")"
dark_big="$(settings true Green Merida "${tournament}" "${classics}")"
light_games="$(settings false Wood Celtic "${classics}" "${tournament}")"
# Game analysis for the marks (Opera game) and the report (Evergreen game): computed
# once into the shared cache. The reference tab indexes the large database once too.
# The translated comments of the Reti game (German, ours) are put into the shared
# cache once by shots/translate-for-shots.py.
shot prep-opera "${dark_games}" 40 CP_OPEN=0 CP_REVIEW=1
shot prep-evergreen "${dark_games}" 60 CP_OPEN=2 CP_REVIEW=1
shot prep-reference "${dark_games}" 240 CP_OPEN=0 CP_PLY=7 CP_TAB=reference
shot 01-game "${dark_games}" 4 NOCACHE CP_OPEN=0 CP_PLY=23
shot 02-engine "${dark_games}" 14 CP_OPEN=1 CP_PLY=35 CP_ANALYZE=1 CP_ENGINE_PANEL=1
shot 03-reference "${dark_games}" 12 CP_OPEN=0 CP_PLY=7 CP_TAB=reference
shot 04-translation "${dark_games}" 5 CP_OPEN=4 CP_PLY=17
shot 05-variations "${dark_games}" 4 NOCACHE CP_OPEN=0 CP_PLY=18 CP_VAR=1
shot 06-review "${dark_games}" 5 CP_OPEN=2 CP_PLY=37 CP_REPORT=1
shot 07-marks "${dark_games}" 5 CP_OPEN=0 CP_PLY=18
shot 08-preview "${dark_games}" 5 CP_OPEN=0 CP_BEST=3
shot 09-library "${dark_big}" 6 CP_PANE=hidden CP_SORT=date "${tournament}"
shot 10-filters "${dark_big}" 6 "CP_FILTER=player=carlsen magnus;years=2015-2026;elo=2600" "${tournament}"
shot 11-position-search "${dark_big}" 8 "CP_BOARD=e4 c5 Nf3 d6 d4 cxd4 Nxd4 Nf6 Nc3 a6" "${tournament}"
# Public accounts of a world champion; only the lookup, nothing is downloaded.
shot 12-online "${dark_games}" 10 CP_ONLINE=DrNykterstein,MagnusCarlsen
shot 13-looks "${light_games}" 4 NOCACHE CP_OPEN=0 CP_PLY=23 CP_SETTINGS=board
rm -f "${out}"/prep-*.png
echo "Raw screenshots in ${out}; next: website/shots/derive.py"