blob: 2864551b12d3af623b4b5bf0bc2bef465ff1a608 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env bash
# build-oracle-ef.sh — generate the EF (1962) regression oracle by fetching
# missalemeum's per-date proper API (the same source lectio's trad scraper uses,
# built on Divinum Officium data) for 2025-2026.
#
# NOT run by `go test`. Requires network + curl + jq + GNU date. From repo root:
# scripts/build-oracle-ef.sh
# Writes internal/calendar/testdata/oracle-ef.json:
# { "YYYY-MM-DD": {"tempora": "...", "title": "...", "rank": N, "colour": "w"} }
# tempora is "" when missalemeum returns null (then the temporal identity is in
# title); the Go test derives the season from tempora-or-title.
set -euo pipefail
out=internal/calendar/testdata/oracle-ef.json
mkdir -p "$(dirname "$out")"
work=$(mktemp -d)
for y in 2025 2026; do
d="$y-01-01"
while [ "$(date -d "$d" +%Y)" = "$y" ]; do
echo "$d"
d=$(date -d "$d +1 day" +%F)
done
done > "$work/dates"
fetch() {
local d="$1"
local j
j=$(curl -sf --max-time 25 "https://www.missalemeum.com/en/api/v5/proper/$d" || true)
printf '%s' "$j" | jq -c --arg d "$d" \
'{($d): (.[0].info | {id:(.id // ""), tempora:(.tempora // ""), title:.title, rank:.rank, colour:(.colors|join(""))})}' \
2>/dev/null || true
}
export -f fetch
xargs -P 12 -I{} bash -c 'fetch "$@"' _ {} < "$work/dates" | jq -s 'add' > "$out"
echo "wrote $out ($(jq 'length' "$out") days)" >&2
rm -rf "$work"
|