Kodi Community Forum

Full Version: Writing and Publishing Addons for Kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Writing Addons for Kodi


Nope, i am not going to teach you how to create an add-on for Kodi,
But i'm going try to provide as much useful information as possible to get you going.

Since there's so much great and helpful posts on writing addons scattered across the forum,
the aim of this thread is to collect all of them in a single post.

Before you start
Think well through what addon you want to write. Start simple, learn how Kodi reacts and how to get things working and done.
Python is an easy to learn language and there is a lot of information available on the web on how to write scripts.
Dig yourself in some short python tutorials and start exploring the possibilities. Also know the difference between scripts and plugins.

Kodi wiki pages
The Kodi wiki pages is a valuable source of information to find specific examples on creating add-ons and how to use the Kodi python modules.
Be sure to start reading the Add-on development wiki to get you going.
There is also a more specific section about python development.
Some of these pages are a bit out of date and require updating but they should still provide the needed basics. Over time we will get these pages better organised.

Kodi specific python documentation
Documentation for all the kodi python modules can be found on our mirrors:
python-docs
This documentation contains all the specific function you need to interface with Kodi.

Quick start
The best start to get going is just taking a small script that is already working and start figuring out how things are done. Change the name and add-on id that you can find in the addon.xml (wiki) file and start tweaking it bit by bit until you created your own version. Just open the files included in the add-ons with a standard text editor (Notepad++ is recommended if your are using Windows.).
After you made the changes try running the add-on like you would with any other of that type.
Make sure you enable debugging so you can see in the Debug Log if any errors occur.

Here is a list of some simple script to get you started:
Our advice is to simply start looking at other basic addons and go from there. Be sure to look at more recent ones as they should follow best practice.
You can easily set up the required file/direcury structure using the Kodi addon generator tool.

If you are planning to create an add-on with a custom UI (not for the faint-hearted) you can find some more information about skinning here.


Common mistakes:
Make sure you read this post to avoid the most common mistake made in Kodi addons:
144677 (thread)


Presenting your add-on
Once you're well on your way, you may want to present your add-on to the outside world for testing to make sure it runs well for others to on different platforms (some scripts can be limited to a single platform of course).
Like every piece of code, your add-on will contain bugs. to assist you in squashing as much bugs as possible, you can let others test your add-on.
Don't hesitate to start a thread in our Python development area and marking your add-ons as WIP.

Do however follow our no Piracy Policy.


Testing:
To get others to test your add-on there are several ways.
  • Providing the URL where the source code can be found and let users manually install this. For example your github repo (or other development repo).
  • Providing your add-on as a .zip file so users can use the "install from .zip" option in the Kodi add-on section. This greatly simplifies it for users that are not that familiar with how things work. You can provide the .zip file by uploading it to some hosting site (or Dropbox i.e.) where users can download it from.
  • Creating your own repository which users can install and can install your add-on from there. This however requires some more knowledge of the add-on dev to get this going.

Kodi has a large and active user-base who is willing to test drive your 'work in progress' add-on
and can help you identify those bugs.

Once things are running smoothly you can request your thread to moved to the appropriate add-on section or start a fresh one and get a MOD to close the old WIP one.
Once you are confident your add-ons works like it should you can request it to be added to the "Kodi.tv official repo". Be sure to read the set guidelines on the wiki before submitting it. If you have any questions about these feel free to contact the repo maintainers. Also read this thread: HOW-TO get your addon into the official repository


Submitting your add-on to the official Kodi.tv repo
To make it easy for all Kodi users (not just the forum-goers) to install your add-on, we would appreciate it if you would submit your add-on to the official Kodi repository.
That way, it will be installable right from within Kodi for everyone.
To make the submission process as easy as possible we're providing a detailed list of guidelines for you to follow.

Currently all add-on submission is handled through our github repository. You can either send a direct pull-request or create an issue ticket to request inclusion. For both please follow the provided information closely.


Keeping it up-to-date
Some add-on require more maintenance than others depending on what type. If you rely on internet pages you might find it that they regularly change their website which breaks the function of your add-on.
Try to find the most reliable way to keep maintenance and breakage down as much as possible. This makes it easier for you and for the users Smile
In case of changes on the website or you find bugs or simply want to add new features, make sure you test them as good as you can. Once that's done you can submit your updated add-on to Kodi.tv official repo to distribute it amongst the users. Try to keep your updates to a minimum (once or twice a month for example in case of general maintenance) but of course don't hesitate to submit an update of your add-on to prevent breakage for users Smile

Buggalo
There's also a python module named Buggalo.
Quote:The buggalo script can collect various information about an
exception in a Python script as well as information about the
users system, such as Kodi and Python versions.

The collected information is then posted to the internet at a
predefined URL where the add-on author can investigate the exception.

The script is somewhat similar to posting the kodi.log to pastebin,
but is more specialised and doesn't contain superfluous information.
It is also better integrated into the user experience, the user only
has to decide if they want to submit the bug report or not.

Read more about it here here.


Last but not least
should you ever, at any time, get stuck (we all hit the brick wall before)
feel free to ask for help in the Python Add-on Development forum.
I'd like to add that you should add a proper description. So if you're writing an addon for a video blog, don't just write something like "Videos of website XY". Describe what "website XY" is about so that people that never heard of it get an idea on what kind of videos to expect, if it requires an account on that site to watch, etc. As an example
Quote:XY is a website about this and a whole lot of that, with lot's of video tutorials to watch. This addon let's you watch the free tutorials as well as subscribers only content if you have a subscription.