21 Aug 2020 - The wiki is undergoing a major cleanup. If you arrived here from a search engine and cannot find the page, please use the wiki search instead (top right corner of page)
More info can be found on the forum
|Development||Add-on development||HOW-TO:Script addon|
This page will outline the basics of creating your first Python script for Kodi. It assumes you're at least familiar with the basics of Python (or at least, programming in general). If not, we recommend visiting the Python tutorial first, and then returning here.
While a python script can do many things, this tutorial is aimed at creating a window in Kodi.
1 Before we get started
The first step to making an add-on is to put the basic structure in place. Make sure your directory is properly named, e.g.
Once these are done, you can get started writing the actual code for your add-on!
The structure of our addon will look like this:
2 The addon.xml file
In the addon.xml file you define the (unique) id of your addon and the name of the addon. It will also teel Kodi what type of addon it is. Since we're going to create a script type addon, we need to set our extension point to 'xbmc.python.script'.
This is what your addon.xml will need to look like (the bare minimum):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="script.testwindow" name="test window" version="0.0.1" provider-name="me"> <requires> <import addon="xbmc.python" version="2.25.0"/> </requires> <extension point="xbmc.python.script" library="default.py"> <provides>executable</provides> </extension> <extension point="xbmc.addon.metadata"> <summary lang="en_GB">window demo script</summary> <description lang="en_GB">a demo script to create a window</description> <language></language> <platform>all</platform> </extension> </addon>