Kolibri plugin to add a Zim file viewer
Project description
Kolibri Zim plugin
This is a Kolibri plugin to add a Zim file viewer.
Usage
Install a release from pypi:
pip install kolibri-zim-plugin
Enable the plugin in Kolibri:
kolibri plugin enable kolibri_zim_plugin
Now, Zim content in Kolibri will be rendered using the Zim plugin.
Development
Getting started
Create a pipenv shell and then install additional dependencies using bootstrap.sh:
pipenv shell
./scripts/bootstrap.sh
Install kolibri-explore-plugin in editable mode:
pip install -e .
To build front end code:
yarn build
Submitting changes
Before submitting changes, please be sure to run the pre-commit checks:
pre-commit run
If you can configure git to run these checks automatically:
pre-commit install -f --install-hooks
Creating a release
If you are releasing a new version, use bump-version with with major, minor, or patch. For example:
yarn bump-version patch
This creates a new commit and a git tag. Push this to the remote:
git push
git push --tags
Create a .whl file:
yarn dist
The file will be placed in the dist/ directory.
Finally, upload the .whl file to PyPi:
yarn release
Creating test content
This is a temporary hack to add Zim content to Kolibri, after installing and enabling kolibri-zim-plugin.
Override Kolibri's le_utils with the newest version:
pip install git+https://github.com/learningequality/le-utils.git@master --target=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/kolibri/dist --upgrade
Download a Wikipedia zim file to Kolibri's storage directory:
mkdir -p ~/.kolibri/content/storage/0/0
curl -L 'http://download.kiwix.org/zim/wikipedia/wikipedia_en_all_mini_2021-01.zim' > ~/.kolibri/content/storage/0/0/00abcdef000000000000000000000000.zim
The
wikipedia_en_all_mini_2021-01.zimzim file is 11 GB. If you need to save space, downloadwikipedia_en_100_maxi_2021-05.ziminstead.
Install the "Canal de Patatas" channel:
kolibri manage importchannel network 2f74713b89595a1899a850df897bd7bb
kolibri manage importcontent network 2f74713b89595a1899a850df897bd7bb
Edit "Growing potatoes" in "Canal de Patatas" (2f74713b89595a1899a850df897bd7bb)
from kolibri.core.content.models import ContentNode, LocalFile
node = ContentNode.objects.get(id='ad33938ca05a53a6bdf5e79944f12757')
file = node.files.get(thumbnail=False)
new_local_file = LocalFile(
id='00abcdef000000000000000000000000',
extension='zim',
available=True,
file_size=None
)
new_local_file.save()
file.local_file = new_local_file
file.preset = 'zim'
file.save()
Navigate to http://localhost:8080/en/learn/#/topics/c/ad33938ca05a53a6bdf5e79944f12757.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kolibri_zim_plugin-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: kolibri_zim_plugin-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 44.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a827aea113be988186050e62e4088c2704bbfab99730ec0c7ef9af3543fbc656
|
|
| MD5 |
7012d85c1a6c5bc07ca2f7d1112fa59b
|
|
| BLAKE2b-256 |
3fd8026c8c576af3338c3463db20177f832e11ec3da14f43288f35d3e0d6001e
|