New frontmatter'd docs:
- download (ServeFile — raw bytes, family-lens enforced; corrects the old
download doc's claim that no download route is registered: ServeFile IS
routed, DownloadBook is the dead code)
- set_audio_speed (speed range 0.25-4.0, NaN/Inf rejected)
- rescan (abridged example over the full 70+-column row; write-after-success
guarantee noted)
- purge-archived (destructive, admin), unarchive (204), merge (SHA-256
precondition, per-user collisions keep active copy)
- facets (two modes: facet+values, field autocomplete counts)
- filter_count (family lens)
Registry: RawMessage pins for map/abridged responses; Schema{} for non-JSON
body routes (download = raw bytes; unarchive = 204). Audit now:
missing docs down to ~55 (from 112), 0 orphans.
44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
---
|
|
method: POST
|
|
path: /api/media-items/:id/rescan
|
|
auth: jwt+admin
|
|
area: media-items
|
|
---
|
|
<!-- source: internal/handlers/media.go:1765 MediaHandler.RescanMediaItem -->
|
|
|
|
# Rescan Media Item
|
|
|
|
Re-extracts metadata for one media item from its file and returns the updated
|
|
row (200, full `media_items` record — 70+ columns; the most relevant are shown
|
|
below).
|
|
|
|
Write-after-success guarantee: a failed/empty extraction never clears
|
|
scan-derived columns.
|
|
|
|
## Example response (abridged)
|
|
|
|
```json example-response
|
|
{
|
|
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"library_id": "990e8400-e29b-41d4-a716-446655440000",
|
|
"title": "1984",
|
|
"author": "George Orwell",
|
|
"file_path": "/books/1984.epub",
|
|
"mime_type": "application/epub+zip",
|
|
"scan_status": "completed",
|
|
"updated_at": "2026-10-24T14:57:01Z"
|
|
}
|
|
```
|
|
|
|
The example is abridged for readability — the response carries the full
|
|
`media_items` row.
|
|
|
|
## Errors
|
|
|
|
| Status | Body | When |
|
|
| ------ | ---- | ---- |
|
|
| 400 | `{"error": "invalid media item id"}` | malformed id |
|
|
| 403 | `{"error": "admin access required"}` | not an admin |
|
|
| 404 | `{"error": "media item not found"}` | no such item |
|
|
| 500 | `{"error": "..."}` | extraction/DB failure |
|