User:Pline: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
m (Creating user page for new user.)
 
No edit summary
Line 1: Line 1:
This is a staging area for some rewrites to the Python add-on documentation. Ok, let's go!


= Python add-ons =
== Hello, World! ==
Before we get started, let's look at an extremely basic example script:
<source lang="python">
# TODO
</source>
== The entry point ==
The simplest form of Python add-on is one that gets run, adds some list items, and exits to let XBMC take over the navigation; people who have written server-side code for the web should be familiar with how this works. (More complex add-ons can process user input in real-time, but we'll discuss those later.) For add-ons like this, we can tailor the output based on the arguments passed into the add-on. These arguments are stored in <code>sys.argv</code>:
{| class="wikitable"
! Index !! Description
|-
| 0 || The base URL of your add-on, e.g. <code>'plugin://plugin.video.myaddon/'</code>
|-
| 1 || The process handle for this add-on, as a numeric string
|-
| 2 || The query string passed to your add-on, e.g. <code>'?foo=bar&baz=quux'</code>
|}

Revision as of 07:50, 24 November 2013

This is a staging area for some rewrites to the Python add-on documentation. Ok, let's go!

Python add-ons

Hello, World!

Before we get started, let's look at an extremely basic example script:

# TODO

The entry point

The simplest form of Python add-on is one that gets run, adds some list items, and exits to let XBMC take over the navigation; people who have written server-side code for the web should be familiar with how this works. (More complex add-ons can process user input in real-time, but we'll discuss those later.) For add-ons like this, we can tailor the output based on the arguments passed into the add-on. These arguments are stored in sys.argv:

Index Description
0 The base URL of your add-on, e.g. 'plugin://plugin.video.myaddon/'
1 The process handle for this add-on, as a numeric string
2 The query string passed to your add-on, e.g. '?foo=bar&baz=quux'