|Development||Add-on development||Add-on repositories|
Beginning with Dharma, Kodi includes an interface to browse remote repositories where add-ons can be retrieved. The model is similar to the way many current Linux distributions work, whereby there is a "main" repository that is the default, and additional ones may be added by the user. The Official Add-on Repository is included with Kodi by default and is maintained by the Kodi team.
After you have created your repository, consider adding it to the 3rd party add-on repositories list.
1 Ingredients for a Repository
Repositories were created with the idea that they should be simple and easy enough to setup for anyone interested. The basic requirements are as follows:
- An HTTP server. Any should work.
- Some add-ons.
- MD5 hash files for each zipped addon (mandatory starting from Kodi 17 "Krypton").
- A master xml file. This file contains metadata about all available add-ons.
- A checksum of the above file.
- A repository add-on for distribution. This allows you to share your repository with others.
2 Directory Structure
addon.id addon.id-x.y.z.zip addon.id-x.y.z.zip.md5 ... addon2.id addon2.id-x.y.z.zip addon2.id-x.y.z.zip.md5 ...
In addition, each add-on directory should contain icon.png, fanart.jpg, changelog-x.y.z.txt and all files from the Addon.xml#.3Cassets.3E element.
- addon.id should be the same as the addon's id, which is expected to be unique.
- x.y.z is the addon's version, the same should be listed in its version attribute.
- .zip.md5 files are text files that contain MD5 hashes (hexdigests) for the respective ZIPs (mandatory starting from Kodi 17 "Krypton").
Kodi expects to fetch a master xml file that contains the information for each add-on inside the repo. This file is named addons.xml - it can be placed external to the main repository of add-on files if you wish. This file merely encapsulates the other addon.xml files in an <addons> tag. See below for the basic structure:
4 Repository Add-on
Repositories are distributed just like any other add-on. In order for you to browse one in Kodi, you'll need to create an add-on and install it. The repository addon extends the xbmc.addon.repository extension point, so in addition to the general XML structure, you'll need an 'extension' block as follows:
URL to the main xml file.
When fetching the file, Kodi will request a gzip encoded response. If the server for some reason does not support gzip encoding, it may be pre-gzipped, in which case it must have a .gz ending ending.
Note: Kodi v15 and older does not support pre-gzipped files and must specify the attribute compressed="true" to request gzip content encoding.
A text file that identifies the content of
Before fetching the full info file, Kodi will fetch the "checksum" and compare it to the previously fetched one. If changed, the info file will be fetched.
Note: for historical reason it is called "checksum", but it is not verified and not required to be a checksum as long as it is changed whenever addons.xml has changed.
URL to the root directory that contains the addons (i.e. the directory holding the addon.id subdirectories). The location of the zip files should be /datadir/addon.id/addon.id-x.y.z.zip.
zip attribute (Note: this feature has been dropped in v17 Krypton) is set to false, then Kodi assumes that each addon.id directory simply contains the addon itself, i.e. /datadir/addon.id/files for addon. Online repositories should always have zip set to true, both for efficiency of download and for the protection that .zip offers by way of verifying the download (i.e. can we unzip it).
5 Repository Tools
Once the individual add-ons have been created, the repository itself can be put together by a script. The script will package up your add-ons from your source folders or it can fetch the sources directly from a Git repository.
- Download the create_repository.py script from GitHub with this link or with this command:
wget https://raw.githubusercontent.com/chadparry/kodi-repository.chad.parry.org/master/tools/create_repository.py && chmod +x create_repository.py
- Run the script, and pass it the location of your add-ons. The location can be a local folder, a local ZIP file, or a Git repository URL.
For example, if you have one zipped add-on and one add-on folder, then the following command will create the add-on repository in the current directory:
./create_repository.py ~/my.spectacular.project.zip ~/development.project/
- The --datadir option can specify a different directory for the repository. The --compressed flag uses gzip to pre-compress the addons.xml file. Also, a Git URL can have an optional #branch or #tag and optional :path at the end to designate the add-on's location within the repository.
For example, if you are publishing two add-ons that are both stored within separate Git repositories, then the following command would create a compressed repository:
./create_repository.py --datadir=~/html/software/kodi --compressed \ https://github.com/chadparry/kodi-repository.chad.parry.org.git#release-1.0.0:repository.chad.parry.org \ https://github.com/chadparry/kodi-plugin.program.remote.control.browser.git:plugin.program.remote.control.browser
- Every time you update an add-on, run the script again.
6 See also