spotters: most-active-in sort with country/region selector, collection tracking (seen marks, progress, filters), refresh scripts score activity and report new NL entries
Some checks failed
Deploy production / deploy (push) Has been cancelled
Some checks failed
Deploy production / deploy (push) Has been cancelled
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Weekly-ish refresh of the car pokedex (/trackers/cars) on stan-vm.
|
||||
# Weekly-ish refresh of the car pokedex (/trackers/cars) on stan-ovh.
|
||||
#
|
||||
# ssh stan-vm 'cd ~/dev/website-cars && git fetch -q && git checkout -q --detach origin/main \
|
||||
# ssh stan@37.187.157.191 '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)}.
|
||||
# 3. bun scripts/spotters-activity.ts cars refreshes the per-country activity scores
|
||||
# ("most active in NL" sort; see that script).
|
||||
# stdout: one JSON report {generatedAt, totals, newBrands, newModels[] (with photo)}, plus `nl` per new
|
||||
# entry and `newInNl` (new entries that are active in the Netherlands, see
|
||||
# scripts/spotters-report-nl.ts). --report-new is accepted (the report is always printed).
|
||||
# Progress goes to stderr. DB_URL is read from the running app container and never printed.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
@@ -19,8 +23,12 @@ if [ -z "${DB_URL:-}" ]; then
|
||||
export DB_URL
|
||||
fi
|
||||
|
||||
args=()
|
||||
for a in "$@"; do [ "$a" = "--report-new" ] || args+=("$a"); done
|
||||
|
||||
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
|
||||
bun scripts/cars-import.ts --report-new "${args[@]}" >"$report"
|
||||
bun scripts/spotters-activity.ts cars >&2
|
||||
bun scripts/cars-photos.ts --missing --enrich "$report" --fetch | bun scripts/spotters-report-nl.ts cars
|
||||
|
||||
Reference in New Issue
Block a user