Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Unreleased
- `archive.contents_sha256` reads members in stored order
- Removed `resources/kindlookup.json`; use `content_kinds.KINDLIST`
- Added `kolibri-constants/ContentKinds`
- Removed `resources/presetlookup.json`; use `format_presets.PRESETLIST`
- Added `kolibri-constants/FormatPresets`


0.2.17 Apr 13, 2026
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ Every `ContentNode` is associated with one or more `File` objects and nature of
this association is represented though the `format_preset` attribute of the file.
The `format_preset` is the role the file is playing in the content node,
e.g., thumbnail, high resolution video, or low resolution video.
Note that format presets are represented redundantly as python string in
[constants/format_presets.py](https://github.com/learningequality/le-utils/blob/master/le_utils/constants/format_presets.py)
and as json [resources/presetlookup.json](https://github.com/learningequality/le-utils/blob/master/le_utils/resources/presetlookup.json).
Format presets are defined in
[spec/constants-format_presets.json](https://github.com/learningequality/le-utils/blob/main/spec/constants-format_presets.json),
from which [constants/format_presets.py](https://github.com/learningequality/le-utils/blob/main/le_utils/constants/format_presets.py)
and [js/FormatPresets.js](https://github.com/learningequality/le-utils/blob/main/js/FormatPresets.js) are generated.

You can think of the different format presets on a content node as different "slots"
to be filled in by files, with certain slots being required while other optional.
Expand Down
107 changes: 107 additions & 0 deletions js/FormatPresets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// -*- coding: utf-8 -*-
// Generated by scripts/generate_from_specs.py
// FormatPresets

export default {
VIDEO_HIGH_RES: "high_res_video",
VIDEO_HIGH_RES_READABLE: "High Resolution",
VIDEO_LOW_RES: "low_res_video",
VIDEO_LOW_RES_READABLE: "Low Resolution",
VIDEO_DEPENDENCY: "video_dependency",
VIDEO_DEPENDENCY_READABLE: "Video (dependency)",
VIDEO_THUMBNAIL: "video_thumbnail",
VIDEO_THUMBNAIL_READABLE: "Thumbnail",
VIDEO_SUBTITLE: "video_subtitle",
VIDEO_SUBTITLE_READABLE: "Subtitle",
AUDIO: "audio",
AUDIO_READABLE: "Audio",
AUDIO_DEPENDENCY: "audio_dependency",
AUDIO_DEPENDENCY_READABLE: "audio (dependency)",
AUDIO_THUMBNAIL: "audio_thumbnail",
AUDIO_THUMBNAIL_READABLE: "Thumbnail",
EPUB: "epub",
EPUB_READABLE: "ePub Document",
DOCUMENT: "document",
DOCUMENT_READABLE: "Document",
DOCUMENT_THUMBNAIL: "document_thumbnail",
DOCUMENT_THUMBNAIL_READABLE: "Thumbnail",
EXERCISE: "exercise",
EXERCISE_READABLE: "Exercise",
EXERCISE_THUMBNAIL: "exercise_thumbnail",
EXERCISE_THUMBNAIL_READABLE: "Thumbnail",
EXERCISE_IMAGE: "exercise_image",
EXERCISE_IMAGE_READABLE: "Exercise Image",
EXERCISE_GRAPHIE: "exercise_graphie",
EXERCISE_GRAPHIE_READABLE: "Exercise Graphie",
CHANNEL_THUMBNAIL: "channel_thumbnail",
CHANNEL_THUMBNAIL_READABLE: "Channel Thumbnail",
TOPIC_THUMBNAIL: "topic_thumbnail",
TOPIC_THUMBNAIL_READABLE: "Thumbnail",
HTML5_ZIP: "html5_zip",
HTML5_ZIP_READABLE: "HTML5 Zip",
HTML5_DEPENDENCY_ZIP: "html5_dependency",
HTML5_DEPENDENCY_ZIP_READABLE: "HTML5 Dependency (Zip format)",
HTML5_THUMBNAIL: "html5_thumbnail",
HTML5_THUMBNAIL_READABLE: "HTML5 Thumbnail",
IMSCP_ZIP: "imscp_zip",
IMSCP_ZIP_READABLE: "IMSCP Zip",
H5P_ZIP: "h5p",
H5P_ZIP_READABLE: "H5P Zip",
H5P_THUMBNAIL: "h5p_thumbnail",
H5P_THUMBNAIL_READABLE: "H5P Thumbnail",
ZIM: "zim",
ZIM_READABLE: "Zim",
ZIM_THUMBNAIL: "zim_thumbnail",
ZIM_THUMBNAIL_READABLE: "Zim Thumbnail",
QTI_ZIP: "qti",
QTI_ZIP_READABLE: "QTI Zip",
QTI_THUMBNAIL: "qti_thumbnail",
QTI_THUMBNAIL_READABLE: "QTI Thumbnail",
SLIDESHOW_IMAGE: "slideshow_image",
SLIDESHOW_IMAGE_READABLE: "Slideshow Image",
SLIDESHOW_THUMBNAIL: "slideshow_thumbnail",
SLIDESHOW_THUMBNAIL_READABLE: "Slideshow Thumbnail",
SLIDESHOW_MANIFEST: "slideshow_manifest",
SLIDESHOW_MANIFEST_READABLE: "Slideshow Manifest",
BLOOMPUB: "bloompub",
BLOOMPUB_READABLE: "Bloom Document",
KPUB_ZIP: "kpub",
KPUB_ZIP_READABLE: "Kolibri HTML5 Article",
VIDEO_VECTOR: "vector_video",
VIDEO_VECTOR_READABLE: "Vectorized",
};

export const PRESETLIST = [
{ id: "high_res_video", readable_name: "High Resolution", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "video", allowed_formats: ["mp4", "webm"], convertible_formats: ["avi", "mov", "mpg", "wmv", "mkv", "flv", "ogv", "m4v"] },
{ id: "low_res_video", readable_name: "Low Resolution", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 2, kind: "video", allowed_formats: ["mp4", "webm"], convertible_formats: ["avi", "mov", "mpg", "wmv", "mkv", "flv", "ogv", "m4v"] },
{ id: "video_dependency", readable_name: "Video Dependency", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 3, kind: "video", allowed_formats: ["mp4", "webm"], convertible_formats: ["avi", "mov", "mpg", "wmv", "mkv", "flv", "ogv", "m4v"] },
{ id: "video_thumbnail", readable_name: "Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 3, kind: "video", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "video_subtitle", readable_name: "Subtitle", multi_language: true, supplementary: true, thumbnail: false, subtitle: true, display: true, order: 4, kind: "video", allowed_formats: ["vtt"], convertible_formats: ["srt", "ttml", "sami", "scc", "dfxp"] },
{ id: "audio", readable_name: "Audio", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "audio", allowed_formats: ["mp3"], convertible_formats: ["wav", "m4a", "aac", "ogg"] },
{ id: "audio_dependency", readable_name: "Audio", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 3, kind: "audio", allowed_formats: ["mp3"], convertible_formats: ["wav", "m4a", "aac", "ogg"] },
{ id: "audio_thumbnail", readable_name: "Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 2, kind: "audio", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "epub", readable_name: "ePub Document", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "document", allowed_formats: ["epub"], convertible_formats: [] },
{ id: "document", readable_name: "Document", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 2, kind: "document", allowed_formats: ["pdf"], convertible_formats: [] },
{ id: "document_thumbnail", readable_name: "Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 4, kind: "document", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "exercise", readable_name: "Exercise", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 1, kind: "exercise", allowed_formats: ["perseus"], convertible_formats: [] },
{ id: "exercise_thumbnail", readable_name: "Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 2, kind: "exercise", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "exercise_image", readable_name: "Exercise Image", multi_language: false, supplementary: true, thumbnail: false, subtitle: false, display: false, order: 3, kind: "exercise", allowed_formats: ["png", "jpg", "jpeg", "gif", "svg"], convertible_formats: [] },
{ id: "exercise_graphie", readable_name: "Exercise Graphie", multi_language: false, supplementary: true, thumbnail: false, subtitle: false, display: false, order: 4, kind: "exercise", allowed_formats: ["svg", "json", "graphie"], convertible_formats: [] },
{ id: "channel_thumbnail", readable_name: "Channel Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 0, kind: null, allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "topic_thumbnail", readable_name: "Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 1, kind: "topic", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "html5_zip", readable_name: "HTML5 Zip", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "html5", allowed_formats: ["zip"], convertible_formats: [] },
{ id: "html5_dependency", readable_name: "HTML5 Zip Dependency", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 3, kind: "html5", allowed_formats: ["zip"], convertible_formats: [] },
{ id: "html5_thumbnail", readable_name: "HTML5 Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 2, kind: "html5", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "imscp_zip", readable_name: "IMSCP Zip", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "html5", allowed_formats: ["zip"], convertible_formats: [] },
{ id: "h5p", readable_name: "H5P", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "h5p", allowed_formats: ["h5p"], convertible_formats: [] },
{ id: "h5p_thumbnail", readable_name: "H5P Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 2, kind: "h5p", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "zim", readable_name: "Zim", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 1, kind: "zim", allowed_formats: ["zim"], convertible_formats: [] },
{ id: "zim_thumbnail", readable_name: "Zim Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 2, kind: "zim", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "qti", readable_name: "QTI", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 0, kind: "exercise", allowed_formats: ["zip"], convertible_formats: [] },
{ id: "qti_thumbnail", readable_name: "QTI Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: true, order: 2, kind: "exercise", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "slideshow_image", readable_name: "Slideshow Slide Image", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 3, kind: "slideshow", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "slideshow_thumbnail", readable_name: "Slideshow Thumbnail", multi_language: false, supplementary: true, thumbnail: true, subtitle: false, display: false, order: 2, kind: "slideshow", allowed_formats: ["png", "jpg", "jpeg"], convertible_formats: [] },
{ id: "slideshow_manifest", readable_name: "Slideshow Manifest", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: false, order: 1, kind: "slideshow", allowed_formats: ["json"], convertible_formats: [] },
{ id: "bloompub", readable_name: "Bloom Document", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 3, kind: "document", allowed_formats: ["bloompub", "bloomd"], convertible_formats: [] },
{ id: "kpub", readable_name: "Kolibri HTML5 Article", multi_language: false, supplementary: false, thumbnail: false, subtitle: false, display: true, order: 1, kind: "document", allowed_formats: ["kpub"], convertible_formats: [] },
];
Loading
Loading