chessbaseLinux/website/shots/make-screenshots.sh
vrubelroman 1eb1fa3358
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Website: brilliant and great moves, self-updating online databases (2.0)
New desktop screenshots (bold notation, the new mark colours; the report at the
Evergreen game's 21.Qxd7+!!) and a phone screenshot of Lasker–Bauer at 15.Bxh7+!!.
Texts in nine languages; Android is no longer called an alpha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 03:45:46 +03:00

116 lines
6.2 KiB
Bash
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Takes the desktop 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 [more fields, ending with a comma]
cat <<EOF
{
${6:-}
"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
# The Evergreen game at 21.Qxd7+, the review's brilliant move (!! on the board and in the
# report).
shot 04-review "${dark_games}" 5 CP_OPEN=2 CP_PLY=41 CP_REPORT=1
# The play dialog with Rodent V (Tal, 2400, 5+3): needs RODENT_DIR, a downloaded Rodent V
# (the app's engines/rodent_v_1.2), and the name of the player; Maia's file is not needed.
if [[ -n "${RODENT_DIR:-}" ]]; then
play_json="$(settings true Green Merida "${classics}" "${tournament}" \
'"your_name": "Roman", "rating": 1650, "play": {"level": 2400, "rival": "Rodent", "style": "tal_hybrid", "color": "White", "clock": {"base": 300, "increment": 3}},')"
shot 05-play "${play_json}" 3 CP_PLAY=dialog "CP_RODENT=${RODENT_DIR}"
fi
# 06-android is four phone screens (the emulator, English, dark theme, Green and Merida):
# a database's games, the Opera game at 8.Nc3, the play sheet with Rodent IV (Tal) and the
# «Who to play» list at its top — side by side on 3840x2160 (shots/raw/06-android.png).
# The same screens one by one for the Android gallery (shots/raw/phone/NN-name.png, 1080x2400,
# English, dark, demo mode of the status bar: clock 5:35, Wi-Fi and battery): the home screen
# with a put-aside game, the database's games, the Opera game at 8.Nc3, Stockfish on it, the
# play sheet, «Who to play», a game against Rodent IV (Tal), and the review of Lasker–Bauer
# at 15.Bxh7+, the brilliant move (Report → Brilliant moves).
shot 07-filters "${dark_big}" 6 "CP_FILTER=player=carlsen magnus;years=2015-2026;elo=2600" "${tournament}"
shot 08-position-search "${dark_big}" 8 "CP_BOARD=e4 c5 Nf3 d6 d4 cxd4 Nxd4 Nf6 Nc3 a6" "${tournament}"
shot 09-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"