added sorting and artist dates

This commit is contained in:
Ebbe Baß
2026-09-09 14:10:15 +02:00
parent b2468cc083
commit 5d56df1af8
11 changed files with 96 additions and 11 deletions
+18 -1
View File
@@ -75,12 +75,14 @@ RELOAD_MIN_INTERVAL_SECONDS=30 uvicorn main:app
| GET | `/events` | List events, with optional filters (see below) |
| GET | `/events/archive` | Past events only — shorthand for `/events?upcoming=false` |
| GET | `/events/{index}` | Single event by its position in the merged list (0-based) |
| GET | `/artists` | Deduplicated, sorted list of all artist names |
| GET | `/artists` | Deduplicated, sorted list of all artists with every date they appear on |
| GET | `/calendar.ics` | iCalendar/webcal feed of all events — subscribe with `webcal://<host>/calendar.ics` |
| POST | `/reload` | Re-read the data file(s) from disk (after a fresh scrape) - rate-limited, see below |
### `/events` query parameters
`/events/archive` accepts the same parameters except `upcoming` (always `false`).
| Param | Type | Meaning |
|------------|--------|---------|
| `free` | bool | Only free / only paid events |
@@ -88,11 +90,26 @@ RELOAD_MIN_INTERVAL_SECONDS=30 uvicorn main:app
| `artist` | string | Case-insensitive substring match on any artist name |
| `date` | string | Exact match on the raw date string (`dd.mm.yy`) |
| `upcoming` | bool | `true` = today or later, `false` = past events |
| `sort` | string | `asc`/`desc` = chronological by event date (unparseable dates sort last either way); `az`/`za` = alphabetical by event name (case-insensitive) |
Examples:
```bash
curl 'http://127.0.0.1:8000/events?free=true'
curl 'http://127.0.0.1:8000/events?artist=randali&upcoming=true'
curl 'http://127.0.0.1:8000/events?sort=asc'
curl 'http://127.0.0.1:8000/events?sort=za'
curl 'http://127.0.0.1:8000/events/0'
```
### `/artists` response shape
Each artist appears once, with every date (past or upcoming) they're on the
line-up for, sorted chronologically:
```json
[
{ "artist_name": "Bizarre", "dates": ["05.09.26", "12.10.26"] },
{ "artist_name": "Skkin Velvet", "dates": ["04.09.26"] }
]
```