The root's list named a /grand-prix/{name}/year/{year} route and a
/tracks/.../layout/... route that do not exist, and left out the
per-layout file route, the session thumbs and the Kometa metadata, so a
reader of / was sent to addresses that answer 404.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
A reader learns the API fastest from working calls: one page per area
(circuit browser, track images, GPS traces on a map, grand prix lookup,
posters, Kometa) shows the exact request URL next to its answer. Pages
call their own origin when the app serves them, and the public service
when opened from disk or given ?api=. Posters render only on a button
press, since each one fetches map tiles on the server. A body that does
not match the asked format is said in red, never shown as success.
The image copies examples/ so the deployed app serves the same pages.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
A Kometa YAML request asks Jolpica for every season at once; Jolpica
(4 requests a second, 500 an hour) answered 429 for 24 seasons on
2026-11-27 09:28, and lru_cache kept each failure as an empty schedule,
so every poster and thumb of those seasons answered 404 until a restart.
The service also ran two Jolpica clients, so the race lookup and the
posters held different schedules.
Now one client serves the whole service; a season that is over is kept
on disk in the cache volume for good, one not yet over is asked again
after six hours; requests are paced under the limit, a 429 is asked
again after its Retry-After; a failure is never kept. The Kometa
endpoint runs in the threadpool, as its first fill takes minutes.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
/png and /geojson answered the SVG file under a PNG or GeoJSON media
type, so the GPS-traced GeoJSON of a layout was never served at all.
Each format now serves its own file; a layout without one answers 404.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
posters_service:
- Standard / sprint episode-index → (label, slug) maps mirroring Kometa's
F1 builder numbering
- _fetch_map_landscape: aerial tile stitcher in 1920x1080
- render_session_thumb: GP aerial bg + projected track outline + GP name
+ session label with red accent bar
- _draw_track_projected now takes canvas_w / geo_center_y so it can be
reused for both 2:3 posters and 16:9 thumbs
- render_kometa_metadata now emits an episodes: block per Plex season
pointing every Kometa-numbered episode at the matching session thumb;
sprint vs standard format is detected from the Jolpica race entry
cdn-api:
- GET /posters/session/{name}/{year}/{slug}.png returns the thumb
posters_service:
- BackgroundStyle enum + tile stitcher for race posters
(Esri aerial / OSM Carto / CartoDB dark / CartoDB light / none)
- _resolve_circuit_geo: GeoJSON bbox centre + auto-zoom (no hand tuning),
falls back to Jolpica lat/lon + f1-locations.json zoom
- _draw_track_projected: project the layout's GeoJSON points into the
same window as the tile background, so the white outline aligns with
the actual track (the hand-drawn SVGs had arbitrary orientations)
- _render_world_locator: 140x140 CartoDB Dark inset at zoom 5 with a
red marker pinning the circuit on the continent
- _race_dark_overlay: dimming so the heading + footer stay legible
against any underlying tiles
- render_kometa_metadata: emits a Kometa-compatible YAML covering
every season 1950..current+1 with per-show + per-round url_poster
cdn-api:
- GET /posters/race/{name}/{year}.png supports ?bg= query param
- GET /kometa/formula-1-metadata.yml serves the generated config so
Kometa pulls it via metadata_files.url (auto-updates with schedule)
GET /posters/race/{grand_prix_name}/{season}.png
GET /posters/season/{season}.png
1000x1500 PNGs composed with Pillow + cairosvg:
checkered-flag strips top/bottom, F1 wordmark, round/year ribbon,
GP name, rasterised track outline (white), race date. Season poster
is wordmark + giant year + 'WORLD CHAMPIONSHIP'. Cached under
cache/posters/ so cold renders happen once.
Dataclass models have parent back-references (TrackLayout→Circuit→
Locality→Country) causing infinite recursion in dataclasses.asdict().
Add to_dict() methods that exclude parent refs, use them in API endpoints.