Repository navigation
Generate file_formats from a namedtuple spec and correct seven mimetypes - #250
rtibblesbot wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rtibbles
left a comment
There was a problem hiding this comment.
Two mimetype changes needed. Neither type is IANA-registered, so pick values that match existing conventions:
h5p→application/h5p+zip. This matches how we handle other zip files with custom extensions (perseus+zip,bloompub+zip,kpub+zip), and Kolibri'spackages/kolibri/utils/mimetypes.jsalready maps it toh5p.zim→application/x-openzim. That's the type freedesktop shared-mime-info registers for*.zim.
Update the spec, regenerated files, tests/pinned_api.json, the CHANGELOG and the PR description to match.
| "label": "H5P", | ||
| "field_constants": ["mimetype"], | ||
| "id": "h5p", | ||
| "mimetype": "application/x-h5p" |
There was a problem hiding this comment.
Use application/h5p+zip here, to match the other zip-based formats with custom extensions and Kolibri's existing mimetypes.js mapping.
There was a problem hiding this comment.
Changed to application/h5p+zip in 01ff28e: spec, generated Python/JS, tests/pinned_api.json, CHANGELOG, PR description. Searched for other invented x- types: only graphie (application/x-graphie) remains, left as-is since it is not a zip with a custom extension.
| "label": "ZIM", | ||
| "field_constants": ["mimetype"], | ||
| "id": "zim", | ||
| "mimetype": "application/x-zim" |
There was a problem hiding this comment.
Use application/x-openzim here. It's the freedesktop shared-mime-info type for *.zim.
There was a problem hiding this comment.
Changed to application/x-openzim in 01ff28e, with the same files updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56007c4 to
28bb415
Compare
Summary
file_formatsandjs/FileFormats.jsare generated from one spec, replacing the hand-maintained module and partial JSON lookup.getformathonours itsdefault.References
Closes #182. Part of #181.
Reviewer guidance
Suggested review: Full code review, then manual QA once the reviewer sets Needs QA.
js/FileFormats.js.loadconstantswrites them into storedFileFormat.mimetyperows, Kolibri'smp3/zipobject[type=…]selectors becomeaudio/mpeg/application/zip, and ricecooker loses itsimage/svg→svgmapping.idfield (record["id"],r.id) and onegenerate_listbody (X(id=id, **record)), butLanguagehas noidfield andLicenseis built differently.application/x-graphieshould stand: no registry entry or Kolibri mapping backs it.Commits run pin → migrate (snapshot unchanged) → correct (snapshot diff is only the seven mimetypes).
AI usage
Used Claude Code to write the generator, spec, snapshot test and corrections, and to trace the Kolibri, Studio and ricecooker consumers. Verified with the full test suite,
make buildidempotence, and prek.🤖 Generated with Claude Code
Deviations from the issue spec
h5pgets an IANA,x-or vendor typeapplication/h5p+zip, matching the other+zipformats and Kolibri'smimetypes.jsWritten by rtibblesbot, an LLM-based coding agent.
🟡 Waiting for feedback
Last updated: 2026-10-25 17:58 UTC