HOW-TO:HelloWorld addon

From Official Kodi Wiki
Revision as of 15:47, 27 November 2014 by Zag (talk | contribs)
Jump to navigation Jump to search
Home icon grey.png   ▶ Development ▶ Add-on development ▶ Python development ▶ Python examples ▶ HOW-TO:HelloWorld addon


Introduction

This tutorial will explain how to write your first Kodi/XBMC Add-on!

Tools

I'd advise using a text editor for your first add-on, something like notepad++ or sublime are good due to their text syntaxing. Also make sure you have a version of Kodi installed on your development environment.

Helloworld1.jpg

Installing

For this example we can install the official "Hello World" add-on that is in the repository. It is under: System >> Add-Ons >> Get Add-Ons >> All Add-ons >> Program Add-Ons

Testing

You can first give the add-on a test run by going to: System >> Add-Ons >> Enabled Add-Ons >> Program Add-Ons >> Hello World. You should now see a popup with 3 lines of text.

Helloworld3.jpg

Modifying the Add-On

Each time we want to change the add-on you can simply go to the appdata folder and live edit it! No need to even close Kodi. This will allow you to quickly test your add-on modifications. On windows this will be in: C:\Users\user\AppData\Roaming\XBMC\addons\plugin.program.hello.world

Helloworld2.jpg

Structure

addon.py <-- This is the actual python code for your Add-On

addon.xml <-- This is the Add-Ons metadata

changelog.txt <-- This is a text file with any changelog information in it. We advise updating this on each release.

icon.png <-- A PNG icon for the add-on. It can be 256x256 or 512x512 pixels big. Try to make it look nice!

LICENSE.txt <-- Another text file with the Add-On license text.

Metadata

As we can see from the screenshot below the addon.xml is pretty simple. The main things you want to look at are on the first line of the XML. Its all pretty self explanitory, just change the fields to your Add-On ID, name, version, and author before you start. The Add-On ID will have to be unique so try to think of a good name here seperated by full stops.

The "Requires" section lets XBMC know what extra Add-On code to import. Since our Add-On is simple we only need the basic "xbmc.python" Add-On.

The "extension point" simple tells XBMC what type of Add-On you have created. In this case its am "executable" which we put inside the <provides> field.

The final section is the extension metadata, again its all pretty self explanatory. You can add descriptions, summary and license information in here. You can also add links to the forum thread, source code and email help users who need support for your Add-On.

Helloworld2.jpg