cars: Wikimedia Commons photos (cars.photos, card heroes, model gallery + lightbox, brand hero/logo), cars:photos + cars:refresh with --report-new, fold duplicate names (Golf VI, Peugot, Mustang Mach 1, Model 3/Y, i10/i30, Ceed, Lynk & Co)
All checks were successful
Deploy production / deploy (push) Successful in 3m0s

This commit is contained in:
2026-10-24 16:44:37 +00:00
parent 0612270545
commit bf0a1e1d2a
16 changed files with 21786 additions and 39 deletions

26
scripts/cars-refresh.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Weekly-ish refresh of the car pokedex (/trackers/cars) on stan-vm.
#
# ssh stan-vm 'cd ~/dev/website-cars && git fetch -q && git checkout -q --detach origin/main \
# && bun install --frozen-lockfile >/dev/null && scripts/cars-refresh.sh'
#
# 1. bun scripts/cars-import.ts --report-new rebuilds brands/models/variants from RDW +
# fueleconomy.gov and notes which brands/models did not exist before.
# 2. bun scripts/cars-photos.ts --missing finds Wikimedia Commons photos for models
# that have none yet (new ones included).
# stdout: one JSON report {generatedAt, totals, newBrands, newModels[] (with photo)}.
# Progress goes to stderr. DB_URL is read from the running app container and never printed.
set -euo pipefail
cd "$(dirname "$0")/.."
if [ -z "${DB_URL:-}" ]; then
DB_URL=$(sudo docker inspect personal-website-app-1 --format '{{range .Config.Env}}{{println .}}{{end}}' |
sed -n 's/^DB_URL=//p' | sed 's/@db:5432/@127.0.0.1:5440/')
export DB_URL
fi
report=$(mktemp /tmp/cars-report.XXXXXX.json)
trap 'rm -f "$report"' EXIT
bun scripts/cars-import.ts --report-new "$@" >"$report"
bun scripts/cars-photos.ts --missing --enrich "$report" --fetch