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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
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.application/x-graphieis the intended type: IANA was never checked, and Kolibri'sobject[type=…]selectors and Studio'sassociated_mimetypesreadmimetype.generate_listbody (X(id=id, **record)) andr.idlookup are what Migrate licenses.py to spec + code generation #183–Migrate languages.py to spec + code generation #186 should extend:Languagehas noidfield, and licenses parse their ids differently.resources/formatlookup.jsonis deleted, Kolibri'smp3/zipselectors becomeaudio/mpeg/application/zip, and ricecooker loses itsimage/svg→svgmapping.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
Written by rtibblesbot, an LLM-based coding agent.
⚪ Updating PR
Last updated: 2026-10-24 16:45 UTC