wildlife: iNaturalist/Wikidata/GBIF import, CC photos and refresh script
All checks were successful
Deploy production / deploy (push) Successful in 1m8s
All checks were successful
Deploy production / deploy (push) Successful in 1m8s
This commit is contained in:
33
scripts/wildlife-refresh.sh
Executable file
33
scripts/wildlife-refresh.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Refresh of the wildlife pokedex (/trackers/wildlife) on stan-ovh.
|
||||
#
|
||||
# ssh stan@37.187.157.191 'cd ~/dev/website-wildlife && git fetch -q && git checkout -q --detach origin/main \
|
||||
# && bun install --frozen-lockfile >/dev/null && scripts/wildlife-refresh.sh --report-new'
|
||||
#
|
||||
# 1. bun scripts/wildlife-import.ts re-reads the species lists (NL, Europe, world) from
|
||||
# iNaturalist + Wikidata + GBIF, refreshes counts/status of every species and adds species
|
||||
# that entered the lists (existing ones are kept, Dex numbers are stable).
|
||||
# 2. bun scripts/wildlife-photos.ts --missing CC-licensed iNaturalist photos for species
|
||||
# without photos (new ones included).
|
||||
# --report-new: stdout is one JSON report {generatedAt, totals, newSpecies[] (with photo)}.
|
||||
# Without it, progress only. 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
|
||||
|
||||
if [ "${1:-}" = "--report-new" ]; then
|
||||
shift
|
||||
report=$(mktemp /tmp/wildlife-report.XXXXXX.json)
|
||||
trap 'rm -f "$report"' EXIT
|
||||
bun scripts/wildlife-import.ts --report-new "$@" >"$report"
|
||||
bun scripts/wildlife-photos.ts --missing --enrich "$report"
|
||||
else
|
||||
bun scripts/wildlife-import.ts "$@" >&2
|
||||
bun scripts/wildlife-photos.ts --missing >&2
|
||||
fi
|
||||
Reference in New Issue
Block a user