1. Introduction
Write your first Kodi / XBMC script using this tutorial! If you need help writing a plugin, check out the tutorial .
2. Tools
For your first script, choose the notepad ++ or sublime text editors because of their syntax highlighting. Install Kodi on your computer.
URL = http://www.sublimetext.com
URL = http://notepad-plus-plus.org
3. Installation
Find the git repository for the official HelloWorld script here .
... and install it in Kodi from here using the zip file.
4. First launch
Open your dialog box with three lines of text using
System >> Add-ons >> My Add-ons >> Software Add-ons >> Hello World.
5. In the addons folder
Without closing Kodi, open your script folder and fix it! On Windows, it is located here:
C:\Users\user\AppData\Roaming\XBMC\addons\script.hello.world
If you have a Mac, find it here:
/Users/<your_user_name>/Library/ApplicationSupport/Kodi/addons/script.hello.world [1]
6. Structure
addon.py - Write your Python program here.
addon.xml - describe your script here.
changelog.txt - update this text file with every new version.
icon.png - Draw your script sign in a 256 or 512 pixel square.
LICENSE.txt - tell us about the copyright for your script.
7. XML
First of all, provide the ID, name and version of your script, and the name of its author using the first line of the XML file. Come up with a unique ID like in the screenshot below.
Explain to XBMC with the Requires section which modules you want to import. Mention the "xbmc.python" script there.
Tell XBMC the type of your script with an "extension point". Place "executable" there with the <provides> element.
Add description, summary, and license information using an edge section in your XML file. Paste in the same hyperlinks to the forum thread, source code, technical support email.
8. Program
Let's call it addon.py. By the way, if you want to learn Python - open the website https://www.codecademy.com/learn/learn-python .
Using the first two lines, we import the code needed to run the script and display the window.
Then there are lines to inform the system about our script and its name.
In lines 7, 8 and 9, the real magic begins. With their help, we will assign values ββto three variables (line1, line2 and line3).
Using the last line, we will show a window with the values ββof these variables on the computer screen. Together with them we will display the name of the script and make the OK button.
9. Other code
Knowing how to run your script, understanding its structure and knowing what it does, let's change it!
Open the folder with your script, fix the code. Get ready to launch it with Kodi when you do this. To do this, switch between a text editor and Kodi.
Change the values ββof the variables.
line1 = "Goodbye world!"
line2 = "And welcome back"
line3 = "My own Add-On!"
Save the file and run the script from Kodi. You will see new lines.
Congratulations! You are now an XBMC / Kodi Programmer!
10. Final considerations
Obviously, you will have access to more Kodi commands using the Python interface than you learned in this tutorial. There is also a JSON interface for this.
Feel free to discuss this tutorial on the forum thread at http://forum.kodi.tv/showthread.php?tid=209948 if you have any questions.
11. Something else
You can find other variations of the HelloWorld script using the hyperlink http://kodi.wiki/view/GUI_Tutorial .
12. Notes
1. Userdata