Match races by circuit id (Qatar 404), keep schedules, fix posters, add the example site #7

Merged
mesh-tools merged 20 commits from fix/match-circuits-by-id into master 2026-11-27 09:56:42 +00:00
Showing only changes of commit 6352eea892 - Show all commits
+10 -1
View File
@@ -49,6 +49,15 @@ def get_media_type(format: Format) -> str:
}
return media_types.get(format, "application/octet-stream") # fallback for unknown formats
def get_relative_filepath(layout: TrackLayout, format: Format) -> Path:
# Each format serves its own file: the PNG, the SVG, or the GPS-traced GeoJSON
relative_filepaths = {
Format.PNG: layout.relative_png_filepath,
Format.SVG: layout.relative_svg_filepath,
Format.GEOJSON: layout.relative_geojson_filepath,
}
return relative_filepaths[format]
@app.get("/")
async def root():
"""Root endpoint returning API information"""
@@ -227,7 +236,7 @@ async def get_grand_prix_circuit(grand_prix_name: str, season: int, image_format
def get_file_response(layout: TrackLayout, image_format: Format, response: Response) -> FileResponse:
# layout = circuit_service.get_layout_details(country_slug, city_slug, circuit_slug, layout_slug)
file_path = Path(f"./circuits").joinpath(layout.relative_svg_filepath)
file_path = Path(f"./circuits").joinpath(get_relative_filepath(layout, image_format))
if not file_path or not file_path.exists():
logger.error(f"File not found: {file_path}")
logger.info(f"Looking for {layout.slug} in format {image_format}")