|
|
| (25 intermediate revisions by 2 users not shown) |
| 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>
| |
| |}
| |