ka-lite-zim¶

OpenZIM export command for ka-lite.
Features¶
Use case and contributions¶
This project is a Python project but is NOT on PyPi because it’s not intended for a wider audience. So just get the latest master, it should work with the latest KA Lite release. Please contribute to this project if you have changes to the .zim files that are available on the Kiwix website
The goal of this command is to build an alternative use case of Khan Academy for the popular offline reader Kiwix, which works for the open standards format OpenZim. Thus, it can benefit from the data prepared through the KA Lite software.
While KA Lite is truly built for education, Kiwix is more of an eLibrary. While Kiwix and OpenZim is more static, KA Lite has its focus on interaction.
Future¶
The export command for KA Lite is the immediate and easiest target. But we hope to be able to understand the OpenZIM format well enough to build an import command as well such that KA Lite students can interact with the data packaged and distributed by zim-packagers.
Contents:¶
Installation¶
Clone from the Git repository:
git clone https://github.com/benjaoming/ka-lite-zim.git
Make sure that while you’re installing you are using the same Python environment (virtualenv?) that you also run KA Lite in.
To install a fresh KA Lite together with ka-lite-zim, you should use virtualenv
pip install virtualenv # Installs virtualenv # ...prepend "sudo" for system-wide cd ka-lite-zim/ # Go to the source folder virtualenv ./venv # Creates a new virtualenv in ./venv source ./venv/bin/activate # Activates the virtualenv pip install -e . # Installs an editable
If you already have KA Lite installed on your system, just CD to the directory and run the installer, provided that you have already activated the environment that KA Lite runs in:
cd ka-lite-zim/ python setup.py install # Add sudo in front if KA Lite is installed system-wide
Make sure you have KA Lite installed and that you have issued
kalite start
at least once. Then edit your~/.kalite/settings.py
to contain this:from kalite.project.settings.base import * INSTALLED_APPS += [ 'kalite_zim', 'compressor', ]
Note
If you install as an editable with pip install -e .
, then issuing
git pull && pip install -e .
from the source directory is enough to
update the software. But remember the latter as dependencies might have changed.
Warning
If you install as an editable with, you cannot delete the source directory after installing!!
Warning
We require a specific version of KA Lite for ka-lite-zim. Therefore, if you already have KA Lite on the system, we recommend a virtualenv.
Usage¶
Note
Your system should have /usr/bin/ffmpeg
available to generate thumbnails
on the fly. There are several thumbnails missing in the collection so this
is recommended.
To see all options, run:
kalite manage help export2zim
Manually select videos¶
Run
kalite start
and go to your browser, setting up KA Lite and selecting the videos you need and downloading them.When KA Lite has the videos, you want, run this command
kalite manage export2zim –language=en output.zim
Automatically downloading all videos¶
Run
kalite start
, you may runkalite stop
after, but the server has to be initialized firstly.To download a language pack for KA Lite without using the interface, run:
kalite manage languagepackdownload --language=en --commandline
Now you can run the OpenZim export command like this:
kalite manage export2zim --language=en --download output.zim
Note
We use a temporary directory to create the .zim file and hard link all the
videos. Therefore, if your /tmp
folder and KA Lite data are on different
devices, you can have problems. Use --tmp-dir=./tmp
to specify a
different location for temporary files.
Warning
We first created ka-lite-zim for ka-lite 0.15.x, and in case you are running
an older version of KA Lite or the unreleased 0.16, you should take care if
these versions of ka-lite already store data in ~/.kalite
.
Run commands differently to use different home directories, e.g.
KALITE_HOME=~/.kalite_zim kalite manage start
and
KALITE_HOME=~/.kalite_zim kalite manage export2zim
Remember your also need to change settings.py
in the new user folder.
Testing¶
The data sets are quite huge, so if you are developing and testing, use the
--test
flag and everything uses bogus JSON source data.
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/benjaoming/ka-lite-zim/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
ka-lite-zim could always use more documentation, whether as part of the official ka-lite-zim docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/benjaoming/ka-lite-zim/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up ka-lite-zim for local development.
Fork the ka-lite-zim repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/ka-lite-zim.git
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass style and unit tests, including testing other Python versions with tox:
$ tox
To get tox, just pip install it.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy.
Check https://travis-ci.org/benjaoming/ka-lite-zim
under pull requests for active pull requests or run the
tox
command and make sure that the tests pass for all supported Python versions.
Credits¶
Development Lead¶
- Benjamin Bach <benjamin@learningequality.org>
Contributors¶
None yet. Why not be the first?
Feedback¶
If you have any suggestions or questions about ka-lite-zim feel free to email me at benjamin@learningequality.org.
If you encounter any errors or problems with ka-lite-zim, please let me know! Open an Issue at the GitHub https://github.com/benjaoming/ka-lite-zim main repository.