Creating Your First Kodi Add-on

Have you ever wanted to create an amazing Kodi add-on by yourself? Well, you first need to learn the basis and every programming language (or software in our case) has its own basic program called Hello World. This tutorial will teach you how to create your first add-on as the first step in learning how to develop complex Kodi add-ons. It requires only basic programming knowledge.

The Hello World add-on
The Hello World add-on

Before starting you need to have two things:

  • Kodi installed on your device
  • Text editor. We recommend using Notepad++ which you can download from here.

Installing the Hello World add-on:

  • For this tutorial, we use the official Hello World add-on. Download this add-on as ZIP file from here.
  • Launch Kodi
  • Click Add-ons
  • Click the Add-on browser icon  add-on browser icon
  • Click Install from zip file
  • Locate where you downloaded the file and select script.hello.world-master.zip

Testing the Hello World add-on:

  • Go back to the Kodi home page
  • Click Add-ons
  • Hover over Program add-ons
  • Click on the Hello World add-on. Once clicking the add-on a popup appears with three lines of text.

The structure of the add-on:

Hello World structure

The add-on contains several files and directory located in the AppData folder. For Windows it is found under this location: C:\Users\<username>\AppData\Roaming\Kodi\addons\script.hello.world

Those files include the following:

  • resources – This directory contains images for the add-on information screen
  • addon.py – The code of the add-on
  • addon.xml – The metadata of the add-on
  • changelog.txt – The changelog of the add-on containing information about every release.
  • fanart.jpg – The background image of the add-on that appears when hovering over it or after launching it. We recommend a 1280×720 JPEG file
  • icon.png – The icon of the add-on. Must be a 256×256 or 512×512 PNG file
  • LICENSE.txt – The license of this add-on
  • readme.txt – This file contains information about the add-on

The metadata of the add-on (addon.xml):

Addon XML

You can see here the metadata of the add-on which is in XML format:

  • The addon tag – includes details about the add-on including ID, name, version and author. The ID should be unique.
  • The require tag – describes which code should be imported by the add-on. In our case, it requires only xbmc.python
  • The extension tag is used twice, each one with a different point:
    • The first one defines the type of the add-on which is executable
    • The second one defines the metadata of the addon which includes fields like platform, description, license, language and more.

The code of the add-on (addon.py):

You can see here the code of the add-on written in Python. In order to start learning Python, we recommend learning from this tutorial.

Addon code

Here is what every line of code means:

  • Lines 1-2 import the necessary code for this add-on
  • Line 4 declares that this is an add-on
  • Line 5 assigns to a variable the name of the add-on (taken from the name field of the metadata file) which  is displayed in the title of the popup
  • Lines 7-9 contain the text of the popup
  • Line 11 open the popup with the title, text and OK button

Change the code of the add-on:

After you understand the structure of the add-on it is time to change it a bit. Edit this file addon.py, using Notepad++ and replace the lines 7-9 with the following lines of code:

line1 = “My first add-on”

line2 = “Works well!”

line3 – “Goodbye”

Save the file and test the add-on. You will see that the text in the popup was changed according to the changes made by you.

Congratulations, you just created your first Kodi add-on!

What’s next?

You have just finished your first Kodi add-on which was basic and simple. In the next tutorial you will learn using arguments and adding menu to Kodi add-ons and expand your knowledge.



Leave a Reply

Your email address will not be published. Required fields are marked *