Archive:Create a repository for add-ons

From Official Kodi Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Time.png THIS PAGE IS OUTDATED:

This page or section has not been updated in a long time, no longer applies, refers to features that have been replaced/removed, and/or may not be reliable.

This page is only kept for historical reasons, or in case someone wants to try updating it.

See Add-on_repositories for up-to-date reference documentation.

When you have created your repository, feel free to add it to the Unofficial_add-on_repositories list.

Things you will require

  • Any HTTP server. A popular method is to use the svn or git source code servers of googlecode, gitorious and github.
    • In your code project page, make sure you set up the correct version control system (source tab). Most skins use SVN.
    • This will get you the right checkout address (link) and folder structure.
  • A folder containing one or more add-on.
    • Start by installing an svn program (like Tortoisesvn).
    • Right click the empty folder, choose 'SVN Checkout' to let it build a folder structure inside.
    • Make sure you get asked for authentication (!), the folders look like your source code server.
    • If you don't get asked for authentication check your server settings and http vs https links.
    • Make a test.txt file in the trunk, right click to mark it as 'add' and use and use 'SVN Commit' on top folder.
  • Make the following two files using the python code below. These 2 files are made from the addon.xml files in the folders below (from the addons). Where you can have your addon unzipped (or zipped as long as there is an addon.xml file next to it, that is always up to date with the one in the zip).
    • A master addons.xml file. This file contains metadata about all available add-ons.
    • A checksum of the above file (this file only contains a hash of addons.xml).
  • A zipped repository add-on for distribution. This allows you to share your repository with others.
    • Easiest way is to have a look at another repository file and change the name, info and links.
    • You can also have a look at how other repos set up their folder structure.

You can use the create_repository.py script to generate the addons.xml metadata and the signature. The script will package up your add-ons from your source folders or it can fetch the sources directly from a Git repository.

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 on 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.

Repository Files

Repositories are distributed just like any other add-on. In order for you to browse one in XBMC, 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 and icons required for an icon, you'll need an <extension> block specfically pointing to your repository. Use the addon.xml of any of the Unofficial_add-on_repositories as a template. 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).

Tips

Using your repo to host images

You may as a developer need to host images from time to time. Something like photobucket or flickr may work, but you can also use your repo. Commit an image to it, and then form the url to it as you would if you were accessing the image via git or svn (like below):

http://xbmc-adult.googlecode.com/svn/trunk/repository.xbmc-adult/icon.png

This can then be accessed easily from python code, or even embedded on the XBMC forums.

How to make an add-on self-updating without distributing a repository file

This is optional. You still need a repository for this, you just distribute the actual zipped plugin or script, as opposed to the repository file. First you need to have a working repository file. Copy the equivalent of this code from the addon.xml of your repository file:

  <extension point="xbmc.addon.repository"
              name="Official XBMC.org Add-on Repository">
    <info compressed="true">http://mirrors.xbmc.org/addons/dharma-pre/addons.xml</info>
    <checksum>http://mirrors.xbmc.org/addons/dharma-pre/addons.xml.md5</checksum>
    <datadir zip="true">http://mirrors.xbmc.org/addons/dharma-pre</datadir>
  </extension>

Then simply add it under the other <extension point> entries of your add-on's addon.xml The name= part of this repository extension must never be the same as your add-on.

More Video Tutorials

Update Your Repository

Video's Description.

Add more Add-ons to your Repository

Video's Description.