Python libraries: Difference between revisions
m (Ned Scott moved page Python Libraries to Python libraries: caps) |
m (URL changed) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
Kodi Python comes with all the standard modules from Python 3.8 or later. See https://docs.python.org/3.8/library/ for reference. | |||
== Built-in modules == | |||
In addition to the standard libraries, Kodi Python uses a handful of custom modules to expose Kodi functionality to Python. | |||
Up to date documentation about these modules can be found at https://xbmc.github.io/docs.kodi.tv/master/kodi-dev-kit/ | |||
Up to date documentation about these modules can be found at | |||
{| border=1 cellspacing=0 cellpadding=5 | {| border=1 cellspacing=0 cellpadding=5 | ||
Line 33: | Line 26: | ||
|} | |} | ||
== Third-party modules == | |||
Numerous python modules are already packages as add-ons that can be imported by other add-on. See [[:Category:Add-on_libraries/modules]] for a list of available modules. To use any of these modules with your add-on, add the relevant line to [[Addon.xml#.3Crequires.3E|Addon.xml]] | |||
== Installing additional modules == | |||
Additional | Additional modules may be installed by simply adding the module to the root folder of your add-on. | ||
A common way to organized third-party modules that are not part of add-on source code itself, is to add a <code>lib</code> directory and place an <code>__init__.py</code> file and other third-party modules inside it. These modules may then normally be imported using <code>from lib import somemodule</code>. | |||
[[Category: | [[Category:Add-on development]] |
Latest revision as of 13:23, 9 January 2022
Kodi Python comes with all the standard modules from Python 3.8 or later. See https://docs.python.org/3.8/library/ for reference.
Built-in modules
In addition to the standard libraries, Kodi Python uses a handful of custom modules to expose Kodi functionality to Python.
Up to date documentation about these modules can be found at https://xbmc.github.io/docs.kodi.tv/master/kodi-dev-kit/
Module | Description |
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. |
xbmcgui | Offers classes and functions that manipulate the Graphical User Interface through windows, dialogs, and various control widgets. |
xbmcplugin | Offers classes and functions that allow a developer to present information through XBMC'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. |
xbmcaddon | Offers classes and functions that manipulate the add-on settings, information and localization. |
xbmcvfs | Offers classes and functions offers acces to the Virtual File Server (VFS) which you can use to manipulate files and folders. |
Third-party modules
Numerous python modules are already packages as add-ons that can be imported by other add-on. See Category:Add-on_libraries/modules for a list of available modules. To use any of these modules with your add-on, add the relevant line to Addon.xml
Installing additional modules
Additional modules may be installed by simply adding the module to the root folder of your add-on.
A common way to organized third-party modules that are not part of add-on source code itself, is to add a lib
directory and place an __init__.py
file and other third-party modules inside it. These modules may then normally be imported using from lib import somemodule
.