summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox179
1 files changed, 179 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox
new file mode 100644
index 0000000..2812c8a
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_python.dox
@@ -0,0 +1,179 @@
1/*!
2
3
4\defgroup python Python
5\image html logo-python.png
6\brief \htmlonly
7 <h3><span style="text-decoration: underline;"><span style="font-style: italic;"><span
8 style="color: rgb(102, 102, 102);">Python Script Add-On Development</span></span></span></h3>
9 \endhtmlonly
10
11Kodi includes a built-in [Python interpreter](http://en.wikipedia.org/wiki/Python_%28programming_language%29)
12that allows users to develop add-ons (scripts and plugins) that interface easily
13and cleanly with the Kodi dashboard. These add-ons can extend the functionality
14of Kodi without requiring extensive programming experience or ability. While you
15may not feel comfortable browsing the Kodi source code and submitting patches (or
16even bug reports), you can learn how to write a script or plugin with just a few
17hours' practice, using the information available in these pages.
18
19This page is intended as an introduction to Kodi Python for new developers, and
20a quick reference for more experienced programmers. If you're not interested in
21programming, you might want to visit [this page](http://kodi.wiki/view/Add-ons)
22for information about installing and using Python add-ons as an end user. If
23you're already familiar with Kodi Python, you can probably skip on down to the
24[environment details](http://kodi.wiki/view/Python_Development#Environment_details)
25or the [resource links](http://kodi.wiki/view/Python_Development#Resource_links)
26below for quick reference material.
27
28_ _ _
29
30Built-in modules
31----------------
32
33In addition to the standard libraries, Kodi [Python](https://www.python.org/)
34uses a handful of custom modules to expose Kodi functionality to Python.
35
36| Module | Description |
37|------------------------------------:|:-----------------------------------------------------------|
38| \ref python_xbmc "xbmc" | Offers classes and functions that provide information about the media currently playing and that allow manipulation of the media player (such as starting a new song). You can also find system information using the functions available in this library.
39| \ref python_xbmcgui "xbmcgui" | Offers classes and functions that manipulate the Graphical User Interface through windows, dialogs, and various control widgets.
40| \ref python_xbmcplugin "xbmcplugin" | Offers classes and functions that allow a developer to present information through Kodi's standard menu structure. While plugins don't have the same flexibility as scripts, they boast significantly quicker development time and a more consistent user experience.
41| \ref python_xbmcaddon "xbmcaddon" | Offers classes and functions that manipulate the add-on settings, information and localization.
42| \ref python_xbmcvfs "xbmcvfs" | Offers classes and functions offers access to the Virtual File Server (VFS) which you can use to manipulate files and folders.
43| \ref python_xbmcwsgi "xbmcwsgi" | The [<b>Web Server Gateway Interface (WSGI)</b>](https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface) is a specification for simple and universal interface between web servers and web applications or frameworks for the Python programming language.
44
45_ _ _
46
47Installing additional modules
48----------------
49
50Additional modules may be installed by simply adding the module to the root
51folder of your add-on.
52
53A common way to organized third-party modules that are not part of add-on source
54code itself, is to add a lib directory and place an __init__.py file and other
55third-party modules inside it. These modules may then normally be imported using
56from lib import some module.
57
58_ _ _
59
60Python plugins versus scripts
61----------------
62
63Please do not confuse "Plugins" with "Scripts". Unlike the Scripts, Plugins are
64not meant to be directly invoked by the user. Instead, Plugins are automatically
65invoked when the user enters such a virtual folder. Do not try to run Plugins
66files from the scripts window as that will only give you a weird error message.
67Plugins, unlike Scripts, do not really provide new functionality to Kodi,
68instead what they do do is provide an easy way to present content listings in
69Kodi through the native GUI interface.
70
71_ _ _
72
73Script development
74----------------
75
76If you're new to Python programming (or just new to Kodi Python), the easiest
77way to get started is with a script. The traditional Hello World program,
78written as an Kodi Python script, would look like this:
79~~~~~~~~~~~~~{.py}
80print("Hello World!")
81~~~~~~~~~~~~~
82That's the same code you would enter at the Python command line, because Kodi
83runs a full-featured, standard Python interpreter (for more information
84concerning the current version number and included modules see the environment
85details below). If you're already familiar with Python programming, the only new
86challenge is learning the custom modules that allow you to gather information
87from Kodi and manipulate the Graphical User Interface (GUI).
88
89There are some excellent tutorials available to introduce you to Kodi scripting
90(and Python in general). See the [HOW-TO](http://kodi.wiki/view/HOW-TO_write_Python_Scripts)
91included in the Kodi Online Manual, or visit Alexpoet's Kodi Scripting site for
92a popular beginner's tutorial (PDF).
93
94_ _ _
95Plugin development
96----------------
97
98While scripts offer you flexibility and full control over the Kodi GUI, plugins
99allow you to quickly and consistently present information to the user through
100the standard Kodi menu structure.
101
102When a user launches a plugin, the plugin generates a list of menu items and
103hands them to Kodi to draw on the screen (regardless of screen resolution, skin,
104or any other user setting). While plugin developers lose some amount of control
105over the presentation, they no longer have to make up their own UIs, or worry
106about creating a usable look and feel across multiple displays.
107
108Plugins are most commonly used to scrape websites for links to streaming videos,
109displaying the video list in Kodi just like it would movie files on the local
110hard drive, but a plugin can be used anywhere a script could, as long as the
111menu structure is a sufficient GUI for the add-on's needs.
112
113Also, note that a script can launch a plugin, and a plugin can launch a script
114(and, for that matter, it can call all the same functions available to a script)
115so the distinction is more theoretical than practical.
116
117
118@{
119\ingroup python
120\defgroup python_xbmc Library - xbmc
121
122\ingroup python
123\defgroup python_xbmcgui Library - xbmcgui
124
125\ingroup python
126\defgroup python_xbmcplugin Library - xbmcplugin
127
128\ingroup python
129\defgroup python_xbmcaddon Library - xbmcaddon
130
131\ingroup python
132\defgroup python_xbmcvfs Library - xbmcvfs
133
134\ingroup python
135\defgroup python_xbmcwsgi Library - xbmcwsgi
136@brief **Web Server Gateway Interface**
137
138The [<b>Web Server Gateway Interface (WSGI)</b>](https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface)
139is a specification for simple and universal interface between web servers and
140web applications or frameworks for the Python programming language.
141@}
142
143*/
144
145/*!
146@page python_v12 Python API v12
147*/
148/*!
149@page python_v13 Python API v13
150*/
151/*!
152@page python_v14 Python API v14
153*/
154/*!
155@page python_v15 Python API v15
156*/
157/*!
158@page python_v16 Python API v16
159*/
160/*!
161@page python_v17 Python API v17
162*/
163/*!
164@page python_v18 Python API v18
165*/
166
167/*!
168@page python_revisions Python API Changes
169@brief Overview of changes on Python API for Kodi
170
171- @subpage python_v12
172- @subpage python_v13
173- @subpage python_v14
174- @subpage python_v15
175- @subpage python_v16
176- @subpage python_v17
177- @subpage python_v18
178+*/
179 \ No newline at end of file