21 Aug 2020 - The wiki is undergoing a major cleanup. If you arrived here from a search engine and cannot find the page, please use the wiki search instead (top right corner of page)
More info can be found on the forum

Difference between revisions of "List of built-in functions"

From Official Kodi Wiki
Jump to: navigation, search
(List of functions)
(Add-on built-in's)
 
(101 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{mininav|[[Development]]|[[Add-on development]]}}
+
{{mininav| [[Python development]] {{l2| [[Add-on development]] }} {{l2| [[Skinning]] }} | [[Built-in scripting]] }}
 +
<section begin="main content" />
 +
Skins can use built-in functions with the <onclick> or <onfocus> tag. Scripts can call built-in functions with <code>xbmc.executebuiltin(function, block)</code>.
  
{{see also|Python development|Skinning}}
+
The latest up-to-date list of built-in functions can be found in the source code files in [https://github.com/xbmc/xbmc/tree/master/xbmc/interfaces/builtins].
 
 
The latest up-to-date list of built-in functions can be found in the function '''CBuiltins::Execute()''' in the source code file [https://github.com/xbmc/xbmc/blob/master/xbmc/interfaces/Builtins.cpp xbmc/interfaces/Builtins.cpp].
 
  
 
In addition to the following list, for most <onclick> and <onfocus> button actions in the skin you can also use the functions from [[Keyboard.xml]].
 
In addition to the following list, for most <onclick> and <onfocus> button actions in the skin you can also use the functions from [[Keyboard.xml]].
<br />
 
  
'''Example:'''<br />
+
<poem>
<onclick>VolumeUp</onclick><br />
+
'''Example:'''
<onclick>VolumeDown</onclick><br />
+
<onclick>VolumeUp</onclick>
 +
<onclick>VolumeDown</onclick>
 +
</poem>
  
 
'''You can use parameters with all media windows, as can be seen here:'''
 
'''You can use parameters with all media windows, as can be seen here:'''
* [[Opening Windows and Dialogs]]<br />
+
* [[Opening Windows and Dialogs]]
  
 
== List of functions ==
 
== List of functions ==
 +
<section begin="functions" />
 +
 +
=== Add-on built-in's ===
 +
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 +
|-
 +
| <code>Addon.Default.OpenSettings(extensionpoint)</code>
 +
| Open a settings dialog for the default addon of the given type (extensionpoint)
 +
|
 +
|-
 +
| <code>Addon.Default.Set(extensionpoint)</code>
 +
| Open a select dialog to allow choosing the default addon of the given type (extensionpoint)
 +
|
 +
|-
 +
| <code>Addon.OpenSettings(id)</code>
 +
| Open a settings dialog for the addon of the given id
 +
|
 +
|-
 +
| <code>EnableAddon(id)</code>
 +
| Enables the specified plugin/script
 +
| v19 addition
 +
|-
 +
| <code>InstallAddon(id)</code>
 +
| Will install the addon with the given id.
 +
|
 +
|-
 +
| <code>InstallFromZip</code>
 +
| Opens the "Install from zip"-dialog if "Unknown sources" is enabled. Prompts the warning message if not.
 +
|
 +
|-
 +
| <code>RunAddon(id)</code>
 +
| Runs the specified plugin/script
 +
|
 +
|-
 +
| <code>RunAppleScript(script[,args]*)</code>
 +
| Run the specified AppleScript command
 +
|
 +
|-
 +
| <code>RunPlugin(plugin)</code>
 +
| Runs the plugin. Full path must be specified. Does not work for folder plugins
 +
|
 +
|-
 +
| <code>RunScript(script[,args]*)</code>
 +
| Runs the python script. You must specify the add-on id of the script. As of 2007/02/24, all extra parameters are passed to the script as arguments and can be accessed by python using sys.argv
 +
|
 +
|-
 +
| <code>StopScript(id)</code>
 +
| Stop the script by ID or path, if running
 +
| {{nowrap|v12 Addition}}
 +
|-
 +
| <code>UpdateAddonRepos</code>
 +
| Triggers a forced update of enabled add-on repositories.
 +
|
 +
|-
 +
| <code>UpdateLocalAddons</code>
 +
| Triggers a scan of local add-on directories.
 +
|
 +
|-
 +
|}
 +
 +
=== Android built-in's ===
 +
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 +
|-
 +
| <code>StartAndroidActivity(package,[intent,dataType,dataURI])</code>
 +
| Launch an Android native app with the given package name. Optional parms (in order): intent, dataType, dataURI. example: <nowiki>StartAndroidActivity(com.android.chrome,android.intent.action.VIEW,,http://kodi.tv/)</nowiki>
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
|}
 +
 +
=== Application built-in's ===
 +
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 +
|-
 +
| <code>Extract(archive_url[, destination])</code>
 +
| Extracts a specified archive to an optionally specified 'absolute' path.
 +
|
 +
|-
 +
| <code>Mute</code>
 +
| Mutes (or unmutes) the volume.
 +
|
 +
|-
 +
| <code>NotifyAll(sender, data [, json])</code>
 +
| Notify all connected clients
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
| <code>SetVolume(percent[,showvolumebar])</code>
 +
| Sets the volume to the percentage specified. Optionally, show the Volume Dialog in Kodi when setting the volume.
 +
|
 +
|-
 +
| <code>ToggleDebug</code>
 +
| Enables/disables debug mode
 +
| {{nowrap|v12 Addition}}
 +
|-
 +
| <code>ToggleDPMS</code>
 +
| Toggle DPMS (VESA Display Power Management Signaling) mode manually
 +
|
 +
|-
 +
| <code>WakeOnLan(mac)</code>
 +
| Sends the wake-up packet to the broadcast address for the specified MAC address (Format: FF:FF:FF:FF:FF:FF or FF-FF-FF-FF-FF-FF).
 +
|
 +
|-
 +
|}
 +
 +
=== CEC built-in's ===
 +
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 +
|-
 +
| <code>CECActivateSource</code>
 +
| Wake up playing device via a CEC peripheral
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
| <code>CECStandby</code>
 +
| Put playing device on standby via a CEC peripheral
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
| <code>CECToggleState</code>
 +
| Toggle state of playing device via a CEC peripheral
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
|}
  
{| class="wikitable" border="1"
+
=== GUI built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| Help
+
| <code>Action(action[,window])</code>
| This help message
+
| Executes an action (same as in keymap) for the given window or the active window if the parameter window is omitted. The parameter window can either be the window's id, or in the case of a standard window, the window's name. See [[Action IDs]] for a list of available actions.
 +
|  
 
|-
 
|-
| Reboot
+
| <code>ActivateWindow(window[,dir,return])</code>
| Cold reboots the system (power cycle)
+
| Opens the given window. The parameter window can either be the window's id, or in the case of a standard window, the window's name. See [[Window IDs]] for a list of window names, and their respective ids. If, furthermore, the window is Music, Video, Pictures, or Program files, then the optional dir parameter specifies which folder Kodi should default to once the window is opened. This must be a source as specified in sources.xml, or a subfolder of a valid source. For some windows (MusicLibrary and VideoLibrary), the return parameter may be specified, which indicates that Kodi should use this folder as the "root" of the level, and thus the "parent directory" action from within this folder will return the user to where they were prior to the window activating.
 +
|
 
|-
 
|-
| ShutDown
+
| <code>ActivateWindowAndFocus(id1, id2,item1, id3,item2)</code>
| Trigger default Shutdown action defined in System Settings
+
| Activate window with id1, first focus control id2 and then focus control id3. if either of the controls is a container, you can specify which item to focus (else, set it to 0).
 +
| {{nowrap|v12 Addition}}
 
|-
 
|-
| Powerdown
+
| <code>AlarmClock(name,command,time[,silent,loop])</code>
| Powerdown system
+
| Pops up a dialog asking for the length of time (mm:ss) for the alarm (unless the parameter time is specified), and starts a timer. When the timer runs out, it'll execute the built-in command (the parameter command) if it is specified, otherwise it'll pop up an alarm notice. Add silent to hide the alarm notification. Add loop for the alarm to execute the command each time the specified time interval expires.
 +
|  
 
|-
 
|-
| Quit
+
| <code>CancelAlarm(name[,silent])</code>
| Quits XBMC
+
| Cancel a running alarm. Set silent to true to hide the alarm notification.
 +
|  
 
|-
 
|-
| Hibernate
+
| <code>ClearProperty(key[,id])</code>
| Hibernate (S4) the System
+
| Clears a window property for the current focused window/dialog(key), or the specified window (key,id).
 +
|
 
|-
 
|-
| Suspend
+
| <code>Dialog.Close(dialog[,force])</code>
| Suspends (S3 / S1 depending on bios setting) the System
+
| Close a dialog. Set force to true to bypass animations. Use (all,true) to close all opened dialogs at once.  
|-{{frodo row}}
+
|  
| InhibitIdleShutdown(true/false)
 
| Prevent the system to shutdown on idle. '''([[:Category:Frodo feature|Future Frodo addition]])'''
 
|-{{frodo row}}
 
| AllowIdleShutdown
 
| Allow the system to shutdown on idle. '''([[:Category:Frodo feature|Future Frodo addition]])'''
 
|-{{gotham row}}
 
| ActivateScreensaver
 
| Starts the screensaver '''([[:Category:Gotham feature|Future Gotham addition]])'''
 
 
|-
 
|-
| RestartApp
+
| <code>NextChannelGroup</code>
| Restarts XBMC (not implemented under Win32)
+
| Navigate to the next PVR channel group (in DialogPVRChannelsOSD.xml)
 +
| {{nowrap|v13 Addition}}
 
|-
 
|-
| Minimize
+
| <code>NextStereoMode</code>
| Minimizes XBMC
+
| Changes the stereo mode of the GUI to the next available mode.
 +
| {{nowrap|v13 Addition}}
 
|-
 
|-
| Reset
+
| <code>Notification(header,message[,time,image])</code>
| Reset the system (same as reboot)
+
| Will display a notification dialog with the specified header and message, in addition you can set the length of time it displays in milliseconds and a icon image.
 +
|
 
|-
 
|-
| Mastermode
+
| <code>PreviousChannelGroup</code>
| Runs XBMC in master mode
+
| Navigate to the previous PVR channel group (in DialogPVRChannelsOSD.xml)
|- {{gotham row}}
+
| {{nowrap|v13 Addition}}
| SetGUILanguage
 
| Set GUI Language '''([[:Category:Gotham feature|Future Gotham addition]])'''
 
 
|-
 
|-
| ActivateWindow(window[,dir,return])
+
| <code>PreviousStereoMode</code>
| Opens the given window. The parameter window can either be the window's id, or in the case of a standard window, the window's name. [[Window IDs|See here for a list of window names, and their respective ids.]] If, furthermore, the window is Music, Video, Pictures, or Program files, then the optional dir parameter specifies which folder XBMC should default to once the window is opened. This must be a source as specified in sources.xml, or a subfolder of a valid source. For some windows (MusicLibrary and VideoLibrary), the return parameter may be specified, which indicates that XBMC should use this folder as the "root" of the level, and thus the "parent directory" action from within this folder will return the user to where they were prior to the window activating.
+
| Changes the stereo mode of the GUI to the previous available mode.
|-{{frodo row}}
+
| {{nowrap|v13 Addition}}
| ActivateWindowAndFocus(id1, id2,item1, id3,item2)
 
| Activate window with id1, first focus control id2 and then focus control id3. if either of the controls is a container, you can specify which item to focus (else, set it to 0).'''([[:Category:Frodo feature|Future Frodo addition]])'''
 
|-{{gotham row}}
 
| ReplaceWindowAndFocus(id1, id2,item1, id3,item2)
 
| Replace window with id1, first focus control id2 and then focus control id3.  if either of the controls is a container, you can specify which item to focus (else, set it to 0).'''([[:Category:Gotham feature|Future Gotham addition]])'''
 
 
|-
 
|-
| ReplaceWindow(window,dir)
+
| <code>RefreshRSS</code>
| Replaces the current window with the given window. This is the same as ActivateWindow() but it doesn't update the window history list, so when you go back from the new window it will not return to the previous window, rather will return to the previous window's previous window.
+
| Reload RSS feeds from RSSFeeds.xml
 +
|
 
|-
 
|-
| TakeScreenshot
+
| <code>ReplaceWindow(window,dir)</code>
| Takes a Screenshot
+
| Replaces the current window with the given window. This is the same as ActivateWindow() but it doesn't update the window history list, so when you go back from the new window it will not return to the previous window, rather will return to the previous window's previous window.
 +
|  
 
|-
 
|-
| RunScript(script[,args]*)
+
| <code>ReplaceWindowAndFocus(id1, id2,item1, id3,item2)</code>
| Runs the python script. You must specify the full path to the script. If the script is an add-on, you can also execute it using its add-on id. As of 2007/02/24, all extra parameters are passed to the script as arguments and can be accessed by python using sys.argv
+
| Replace window with id1, first focus control id2 and then focus control id3. if either of the controls is a container, you can specify which item to focus (else, set it to 0).
 +
| {{nowrap|v13 Addition}}
 
|-
 
|-
| StopScript(id)
+
| <code>Resolution</code>
| Stop the script by ID or path, if running
+
| Change Kodi's Resolution.
 +
|
 +
|-
 +
| <code>SetGUILanguage(value)</code>
 +
| Set GUI Language, 'value' is the language file to use. SetGUILanguage(resource.language.de_de)
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
| <code>SetProperty(key,value[,id])</code>
 +
| Sets a window property for the current window (key,value), or the specified window (key,value,id).
 +
|
 +
|-
 +
| <code>SetStereoMode</code>
 +
| Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, monoscopic)
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
| <code>settingslevelchange</code>
 +
| Toggles the visible settings (in SettingsCategory.xml) between 'basic', 'standard', 'advanced and 'expert'
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
| <code>TakeScreenshot([filenameandpath,sync])</code>
 +
| Takes a Screenshot. You can optionally specify the filename (including the path). Note: only .png files are supported. Add "sync" parameter to run synchronously (slow).
 +
|
 +
|-
 +
| <code>ToggleDirtyRegionVisualization</code>
 +
| makes dirty regions visible for debugging proposes.
 +
| {{nowrap|v16 Addition}}
 +
|-
 +
| <code>ToggleStereoMode</code>
 +
| Toggle the stereoscopic mode of the GUI (on/off).
 +
| {{nowrap|v13 Addition}}
 +
|-
 +
|}
 +
 
 +
=== GUI container built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 +
|-
 +
| <code>Container.NextSortMethod</code>
 +
| Change to the next sort method.
 +
|
 +
|-
 +
| <code>Container.NextViewMode</code>
 +
| Select the next view mode.
 +
|
 +
|-
 +
| <code>Container.PreviousSortMethod</code>
 +
| Change to the previous sort method.
 +
|
 +
|-
 +
| <code>Container.PreviousViewMode</code>
 +
| Select the previous view mode.
 +
|
 +
|-
 +
| <code>Container.Refresh</code>
 +
| Refresh current listing.
 +
|
 +
|-
 +
| <code>Container.SetSortMethod(id)</code>
 +
| Change to the specified sort method. (For list of ID's see [[https://kodi.wiki/view/List_of_built-in_functions#List_of_sort_methods list of sort methods]])
 +
|
 +
|-
 +
| <code>Container.SetViewMode(id)</code>
 +
| Set the current view mode (list, icons etc.) to the given container id.
 +
|
 
|-
 
|-
| RunAppleScript(script[,args]*)
+
| <code>Container.SetSortDirection</code>
| Run the specified AppleScript command
+
| Toggle the sort direction.
 +
|
 
|-
 
|-
| RunPlugin(plugin)
+
| <code>Container.Update</code>
| Runs the plugin. Full path must be specified. Does not work for folder plugins
+
| Update current listing. Send Container.Update(path,replace) to reset the path history.  
 +
|
 
|-
 
|-
| RunAddon(id)
+
|}
| Runs the specified plugin/script
+
 
 +
=== GUI control built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| Extract
+
| <code>Control.Message(id,message,[windowid])</code>
| Extracts a specified archive to an optionally specified path. <font color="red">! REQUIRES ABSOLUTE PATHS !</font>
+
| Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.  
 +
|
 
|-
 
|-
| PlayMedia(media[,isdir][,1],[playoffset=xx])
+
| <code>Control.Move(id,offset)</code>
| Plays the media. This can be a playlist, music, or video file, directory, plugin or an Url. The optional parameter ",isdir" can be used for playing a directory. ",1" will start a video in a preview window, instead of fullscreen. If media is a playlist, you can use playoffset=xx where xx is the position to start playback from.
+
| Will make a Container with the "id" specified in the command move focus by "offset".  
 +
|
 
|-
 
|-
| SlideShow(dir [,recursive, [not]random])
+
| <code>Control.SetFocus(id,position[,absolute])</code>
| Starts a slideshow of pictures in the folder dir.  Optional parameters are "recursive", and "random" or "notrandom" parameters. The "recursive" parameter starts a recursive slideshow, adding images from sub-folders.  The "random" and "notrandom" parameters override the Randomize setting found in the pictures media window.
+
| Will make a list with the "id" specified in the command gain focus at "position" number in its list. Set absolute to focus the first listitem of a container instead of the first visible listitem. Alias SetFocus(id,position)
 +
|
 
|-
 
|-
| RecursiveSlideShow(dir)
+
| <code>PageDown</code>
| Run a slideshow from the specified directory, including all subdirs
+
| Send a page down event to the pagecontrol with given id.
 +
|
 
|-
 
|-
| ReloadSkin()
+
| <code>PageUp</code>
| Reloads the current skin – useful for Skinners to use after they upload modified skin files (saves power cycling)
+
| Send a page up event to the pagecontrol with given id.
 +
|
 
|-
 
|-
| UnloadSkin()
+
| <code>SendClick(windowid,id)</code>
| uNLOADS the current skin
+
| Sends a click to a control in a given window (or active window if omitted).
 +
|  
 
|-
 
|-
| RefreshRSS
+
| <code>SetFocus(id,position[,absolute])</code>
| Reload RSS feeds from RSSFeeds.xml
+
| Will make a list with the "id" specified in the command gain focus at "position" number in its list. Set absolute to focus the first listitem of a container instead of the first visible listitem. Alias Control.SetFocus(id,position)
 +
|
 
|-
 
|-
| PlayerControl(command)
+
|}
| Allows control of music and videos. The command may be one of Play, Stop, Forward, Rewind, Next, Previous, BigSkipForward, BigSkipBackward, SmallSkipForward, SmallSkipBackward, Random, RandomOn, RandomOff, Repeat, RepeatOne, RepeatAll, RepeatOff, Partymode(music) or Partymode(video) or Partymode(path to .xsp file), and Record. Play will either pause, resume, or stop ffwding or rewinding. Random toggles random playback and Repeat cycles through the repeat modes (these both take an optional second parameter, Notify, that notifies the user of the new state). Partymode(music/video) toggles the appropriate partymode, defaults to music if no parameter is given, besides the default music or video partymode you can also pass a path to a custom smartplaylist (.xsp) as parameter.
+
 
 +
=== Library built-in's ===
 +
 
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
! style="width: 5%"| Version
 
|-
 
|-
| Playlist.PlayOffset
+
| <code>CleanLibrary(database)</code>
| Start playing from a particular offset in the playlist
+
| This funtion will perform a number of 'cleanup' tasks on your video database and can be run if you have moved, deleted or renamed files. Takes either "video" or "music" as a parameter to begin cleaning the corresponding database.
 +
|
 
|-
 
|-
| Playlist.Clear
+
| <code>exportlibrary(music,false,filepath)</code>
| Clear the current playlist
+
| The music library will be exported to a single file stored at filepath location.  
 +
|  
 
|-
 
|-
| EjectTray()
+
| <code>exportlibrary(video,true,thumbs,overwrite,actorthumbs)</code>
| Either opens or closes the DVD tray, depending on its current state
+
| The video library is exported to multiple files with the given options. Here thumbs, overwrite and actorthumbs are boolean values (true or false).
 +
|
 
|-
 
|-
| AlarmClock(name,command,time[,silent,loop])
+
| <code>UpdateLibrary(database,[path])</code>
| Pops up a dialog asking for the length of time for the alarm (unless the parameter time is specified), and starts a timer. When the timer runs out, it'll execute the <span class="nobr">built-in</span> command (the parameter command) if it is specified, otherwise it'll pop up an alarm notice. Add silent to hide the alarm notification. Add loop for the alarm to execute the command each time the specified time interval expires.
+
| Takes either "video" or "music" as a parameter to begin updating the corresponding database. For "video" you can additionally specify a specific path to be scanned.  
 +
|
 
|-
 
|-
| CancelAlarm(name[,silent])
+
| <code>VideoLibrary.Search</code>
| Cancel a running alarm. Set silent to true to hide the alarm notification. only available in trunk >r35674
+
| Brings up a search dialog which will search the library
 +
|
 
|-
 
|-
| Action
+
|}
| Executes an action for the active window (same as in keymap)
+
 
 +
=== Optical container built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| Notification(header,message[,time,image])
+
| <code>EjectTray()</code>
| Will display a notification dialog with the specified header and message, in addition you can set the length of time it displays in milliseconds and a icon image.
+
| Either opens or closes the DVD tray, depending on its current state
 +
|
 
|-
 
|-
| PlayDVD
+
| <code>RipCD</code>
| Will play the inserted CD or DVD media from the <span class="nobr">DVD-ROM</span> drive.
+
| Will rip the inserted CD from the DVD-ROM drive.  
 +
|
 
|-
 
|-
| RipCD
+
|}
| Will rip the inserted CD from the <span class="nobr">DVD-ROM</span> drive.
+
 
 +
=== Picture built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| Skin.ToggleSetting(setting)
+
| <code>RecursiveSlideShow(dir)</code>
| Toggles the skin setting ?setting? for use with [[Conditional Visibility|conditional visibility tags]] containing Skin.HasSetting(setting).
+
| Run a slideshow from the specified directory, including all subdirs
 +
|  
 
|-
 
|-
| Skin.SetString(string[,value])
+
| <code>ShowPicture(picture)</code>
| Pops up a keyboard dialog and allows the user to input a string which can be used in a label control elsewhere in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the value parameter is specified, then the keyboard dialog does not pop up, and the string is set directly.
+
| Show a picture by its file path/url.
 +
| {{nowrap|v13 Addition}}
 
|-
 
|-
| Skin.SetNumeric(numeric[,value])
+
| <code>SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"])</code>
| Pops up a keyboard dialog and allows the user to input a numerical.
+
| Starts a slideshow of pictures in the folder dir. Optional parameters are 'recursive', 'random' or 'notrandom', 'pause' and 'beginslide="/path/to/some/image.jpg"' parameters. The "recursive" parameter starts a recursive slideshow, adding images from sub-folders. The "random" and "notrandom" parameters override the Randomize setting found in the pictures media window. The "pause" parameter will start the slideshow paused. "beginslide" will start the slideshow with the specified image.
 +
|
 
|-
 
|-
| Skin.SetPath(string[,value])
+
|}
| Pops up a folder browser and allows the user to select a folder of images to be used in a multi image control else where in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the path is set directly.
+
 
 +
=== Player built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
! style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| Skin.Theme
+
| <code>PlayDisc(param)</code>
| Cycles the skin theme. Skin.theme(-1) will go backwards.
+
| Will play the inserted CD or DVD media from the DVD-ROM drive.  
 +
|
 
|-
 
|-
| Skin.SetImage(string[,value])
+
| <code>PlayerControl(command)</code>
| Pops up a file browser and allows the user to select an image file to be used in an image control elsewhere in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the image path is set directly.
+
| Allows control of music and videos. The command may be one of Play, Stop, Forward, Rewind, Next, Previous, BigSkipForward, BigSkipBackward, SmallSkipForward, SmallSkipBackward, FrameAdvance(#), TempoUp, TempoDown, Random, RandomOn, RandomOff, Repeat, RepeatOne, RepeatAll, RepeatOff, Partymode(music) or Partymode(video) or Partymode(path to .xsp file) or Reset.
 +
Play will either pause, resume, or stop ffwding or rewinding. Random toggles random playback and Repeat cycles through the repeat modes (these both take an optional second parameter, Notify, that notifies the user of the new state). Partymode(music/video) toggles the appropriate partymode, defaults to music if no parameter is given, besides the default music or video partymode you can also pass a path to a custom smartplaylist (.xsp) as parameter. Reset only applies to games and will reset the currently playing game.
 +
|
 
|-
 
|-
| Skin.SetLargeImage(string[,value])
+
| <code>PlayerResolutionSelect</code>
| Pops up a file browser and allows the user to select an large image file to be used in an image control else where in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the image path is set directly.
+
| Select a different resolution
 +
| v18
 
|-
 
|-
| Skin.SetFile(string,mask,folderpath)
+
| <code>Playlist.Clear</code>
| Pops up a folder browser and allows the user to select a file off the hard-disk to be used else where in the skin via the [[InfoLabels|info tag]] Skin.String(string). If the mask parameter is specified, then the file browser will only search for the extension specified (.avi,.mp3,.m3u,.png,.bmp,etc.,etc.). To use multiple extensions separate them using "|" minus quotes. If the folderpath parameter is set the file browser will start in that folder.
+
| Clear the current playlist
 +
|  
 
|-
 
|-
| Skin.SetAddon(string,type)
+
| <code>Playlist.PlayOffset</code>
| Pops up a select dialog and allows the user to select an add-on of the given type to be used elsewhere in the skin via the info tag Skin.String(string). The most common types are ''xbmc.addon.video'', ''xbmc.addon.audio'', ''xbmc.addon.image'' and ''xbmc.addon.executable''.
+
| Start playing from a particular offset in the playlist
 +
|
 
|-
 
|-
| Skin.SetBool(setting)
+
| <code>PlayMedia(media[,isdir][,1],[playoffset=xx],[resume],[noresume])</code>
| Sets the skin setting ?setting? to true, for use with the [[Conditional Visibility|conditional visibility tags]] containing Skin.HasSetting(setting). The settings are saved <span class="nobr">per-skin</span> in settings.xml just like all the other XBMC settings.
+
| Plays the media. This can be a playlist, music, or video file, directory, plugin or a url. The optional parameter ",isdir" can be used for playing a directory. ",1" will start the media without switching to fullscreen. If media is a playlist, you can use playoffset=xx where xx is the position to start playback from. Set "resume" to force resuming. Set "noresume" to force not resuming.
 +
|
 
|-
 
|-
| Skin.Reset(setting)
+
| <code>PlayWith()</code>
| Resets the skin setting ?setting?. If ?setting? is a bool setting (i.e. set via SetBool or ToggleSetting) then the setting is reset to false. If ?setting? is a string (Set via SetString, SetImage, or SetPath) then it is set to empty.
+
| Play the selected item with the specified player core.  
 +
|
 
|-
 
|-
| Skin.ResetSettings
+
| <code>Seek(seconds)</code>
| Resets all the above skin settings to their defaults (toggles all set to false, strings all set to empty.)
+
| Seeks to the specified relative amount of seconds within the current playing media. A negative value will seek backward and a positive value forward.
 +
| {{nowrap|v15 Addition}}
 
|-
 
|-
| Mute
+
|}
| Mutes (or unmutes) the volume.
+
 
 +
=== Profile built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| SetVolume(percent[,showvolumebar])
+
| <code>LoadProfile(profilename,[prompt])</code>
| Sets the volume to the percentage specified. Optionally, show the Volume Dialog in XBMC when setting the volume.
+
| Load the specified profile. If prompt is not specified, and a password would be required for the requested profile, this command will silently fail. If promp' is specified and a password is required, a password dialog will be shown.  
 +
|
 
|-
 
|-
| Dialog.Close(dialog[,force])
+
| <code>Mastermode</code>
| Close a dialog. Set force to true to bypass animations. Use (all,true) to close all opened dialogs at once.
+
| Runs Kodi in master mode
 +
|  
 
|-
 
|-
| System.LogOff
+
| <code>System.LogOff</code>
| Log off current user.
+
| Log off current user.  
 +
|
 
|-
 
|-
| System.Exec
+
|}
| Execute shell commands.
+
 
 +
=== PVR built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| System.ExecWait
+
| <code>PVR.SearchMissingChannelIcons</code>
| Execute shell commands and freezes XBMC until shell is closed.
+
| Will start a search for missing channel icons
 +
| {{nowrap|v16 Addition}}
 
|-
 
|-
| Resolution
+
| <code>PVR.ToggleRecordPlayingChannel</code>
| Change XBMC's Resolution.
+
| Will toggle recording on playing channel, if any
 +
| v18
 
|-
 
|-
| SetFocus(id,position)
+
| <code>PVR.SeekPercentage</code>
| Will make a list with the "id" specified in the command gain focus at "position" number in its list. Alias SetFocus(id,position)
+
| Performs a seek to the given percentage in timeshift buffer, if timeshifting is supported
 +
|
 +
|}
 +
 
 +
=== Skin built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| UpdateLibrary(database,[path])
+
| <code>ReloadSkin()</code>
| Takes either "video" or "music" as a parameter to begin updating the corresponding database. For "video" you can additionally specify a specific path to be scanned.
+
| Reloads the current skin – useful for Skinners to use after they upload modified skin files (saves power cycling)
 +
|
 
|-
 
|-
| CleanLibrary(database)
+
| <code>Skin.Reset(setting)</code>
| This funtion will perform a number of 'cleanup' tasks on your video database and can be run if you have moved, deleted or renamed files. Takes either "video" or "music" as a parameter to begin cleaning the corresponding database.
+
| Resets the skin setting ?setting?. If ?setting? is a bool setting (i.e. set via SetBool or ToggleSetting) then the setting is reset to false. If ?setting? is a string (Set via SetString, SetImage, or SetPath) then it is set to empty.  
 +
|
 
|-
 
|-
| exportlibrary(music,false,filepath)
+
| <code>Skin.ResetSettings</code>
| The music library will be exported to a single file stored at filepath location.
+
| Resets all the above skin settings to their defaults (toggles all set to false, strings all set to empty.)  
 +
|  
 
|-
 
|-
| exportlibrary(video,true,thumbs,overwrite,actorthumbs)
+
| <code>Skin.SelectBool(header, label1&#124;setting1, label2&#124;setting2)</code>
| The video library is exported to multiple files with the given options. Here thumbs, overwrite and actorthumbs are boolean values (true or false).
+
| Pops up select dialog to select between multiple skin setting options. Skin.SelectBool(424, 31411&#124;RecentWidget, 31412&#124;RandomWidget, 31413&#124;InProgressWidget)
 +
|
 
|-
 
|-
| PageDown
+
| <code>Skin.SetAddon(string,type)</code>
| Send a page down event to the pagecontrol with given id.
+
| Pops up a select dialog and allows the user to select an add-on of the given type to be used elsewhere in the skin via the info tag Skin.String(string). The most common types are xbmc.addon.video, xbmc.addon.audio, xbmc.addon.image, xbmc.addon.executable and kodi.gameclient.
 +
|
 
|-
 
|-
| PageUp
+
| <code>Skin.SetBool(setting)</code>
| Send a page up event to the pagecontrol with given id.
+
| Sets the skin setting ?setting? to true, for use with the conditional visibility tags containing Skin.HasSetting(setting). The settings are saved per-skin in settings.xml just like all the other Kodi settings.  
|-{{frodo row}}
+
|  
| <s>LastFM.Love</s>
 
| <s>All songs that can be submitted to Last.fm can be loved, optional parameter (false) = direct loving without confirmationdialog.</s> '''([[:Category:Frodo feature|Future Frodo removal]])'''
 
|-{{frodo row}}
 
| <s>LastFM.Ban</s>
 
| <s>Only songs that are playing on last.fm radio can be banned, optional parameter (false) = direct banning without confirmationdialog.</s> '''([[:Category:Frodo feature|Future Frodo removal]])'''
 
 
|-
 
|-
| Container.Refresh
+
| <code>Skin.SetFile(string,mask,folderpath)</code>
| Refresh current listing.
+
| Pops up a folder browser and allows the user to select a file off the hard-disk to be used else where in the skin via the info tag Skin.String(string). If the mask parameter is specified, then the file browser will only search for the extension specified (.avi,.mp3,.m3u,.png,.bmp,etc.,etc.). To use multiple extensions separate them using "<nowiki>|</nowiki>" (minus quotes). If the folderpath parameter is set the file browser will start in that folder.
 +
|
 
|-
 
|-
| Container.Update
+
| <code>Skin.SetImage(string[,value,path])</code>
| Update current listing. Send Container.Update(path,replace) to reset the path history.
+
| Pops up a file browser and allows the user to select an image file to be used in an image control elsewhere in the skin via the info tag Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the image path is set directly. the path option allows you to open the file browser in the specified folder.  
 +
|
 
|-
 
|-
| Container.NextViewMode
+
| <code>Skin.SetNumeric(numeric[,value])</code>
| Select the next view mode.
+
| Pops up a keyboard dialog and allows the user to input a numerical.  
 +
|
 
|-
 
|-
| Container.PreviousViewMode
+
| <code>Skin.SetPath(string[,folderpath])</code>
| Select the previous view mode.
+
| Pops up a folder browser and allows the user to select a folder of images to be used in a multi image control else where in the skin via the info tag Skin.String(string). If the folderpath parameter is set the file browser will start in that folder.  
 +
|
 
|-
 
|-
| Container.SetViewMode(id)
+
| <code>Skin.SetString(string[,value])</code>
| Set the current view mode (list, icons etc.) to the given container id.
+
| Pops up a keyboard dialog and allows the user to input a string which can be used in a label control elsewhere in the skin via the info tag Skin.String(string). If the value parameter is specified, then the keyboard dialog does not pop up, and the string is set directly.  
 +
|
 
|-
 
|-
| Container.NextSortMethod
+
| <code>Skin.Theme(1)</code>
| Change to the next sort method.
+
| Cycles the skin theme. Skin.Theme(-1) will go backwards.
 +
|
 
|-
 
|-
| Container.PreviousSortMethod
+
| <code>Skin.ToggleDebug</code>
| Change to the previous sort method.
+
| Toggles skin debug info on/off
 +
|  
 
|-
 
|-
| Container.SetSortMethod
+
| <code>Skin.ToggleSetting(setting)</code>
| Change to the specified sort method.
+
| Toggles the skin setting ?setting? for use with conditional visibility tags containing Skin.HasSetting(setting).
 +
|
 
|-
 
|-
| Container.SortDirection
+
| <code>UnloadSkin()</code>
| Toggle the sort direction.
+
| Unloads the current skin
 +
|
 
|-
 
|-
| Control.Move(id,offset)
+
|}
| Will make a Container with the "id" specified in the command move focus by "offset".
+
 
 +
=== System built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| Control.SetFocus(id,position)
+
| <code>ActivateScreensaver</code>
| Will make a list with the "id" specified in the command gain focus at "position" number in its list. Alias SetFocus(id,position)
+
| Starts the screensaver
 +
| {{nowrap|v13 Addition}}
 
|-
 
|-
| Control.Message(id,message,[windowid])
+
| <code>Hibernate</code>
| Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.
+
| Hibernate (S4) the System
 +
|  
 
|-
 
|-
| SendClick(windowid,id)
+
| <code>InhibitIdleShutdown(true/false)</code>
| Sends a click to a control in a given window (or active window if omitted).
+
| Prevent the system to shutdown on idle.
 +
| {{nowrap|v12 Addition}}
 
|-
 
|-
| LoadProfile(profilename,[prompt])
+
| <code>Minimize</code>
| Load the specified profile. If prompt is not specified, and a password would be required for the requested profile, this command will silently fail. If promp' is specified and a password is required, a password dialog will be shown.
+
| Minimizes Kodi
 +
|  
 
|-
 
|-
| SetProperty(key,value[,id])
+
| <code>Powerdown</code>
| Sets a window property for the current window (key,value), or the specified window (key,value,id).
+
| Powerdown system
 +
|  
 
|-
 
|-
| ClearProperty(key[,id])
+
| <code>Quit</code>
| Clears a window property for the current focused window/dialog(key), or the specified window (key,id).
+
| Quits Kodi
 +
|  
 
|-
 
|-
| PlayWith()
+
| <code>Reboot</code>
| Play the selected item with the specified player core.
+
| Cold reboots the system (power cycle)  
 +
|  
 
|-
 
|-
| WakeOnLan(mac)
+
| <code>Reset</code>
| Sends the wake-up packet to the broadcast address for the specified MAC address (Format: FF:FF:FF:FF:FF:FF or FF-FF-FF-FF-FF-FF).
+
| Reset the system (same as reboot)  
|-{{gotham row}}
+
|  
| LCD.Suspend
 
| Suspends LCDproc. '''([[:Category:Gotham feature|Future Gotham removal]])'''
 
|-{{gotham row}}
 
| LCD.Resume
 
| Resumes LCDproc. '''([[:Category:Gotham feature|Future Gotham removal]])'''
 
 
|-
 
|-
| Addon.Default.OpenSettings
+
| <code>RestartApp</code>
| Open a settings dialog for the default addon of the given type
+
| Restarts Kodi (only implemented under Windows and Linux)
 +
|  
 
|-
 
|-
| Addon.Default.Set
+
| <code>ShutDown</code>
| Open a select dialog to allow choosing the default addon of the given type
+
| Trigger default Shutdown action defined in System Settings
 +
|
 
|-
 
|-
| Addon.OpenSettings(id)
+
| <code>Suspend</code>
| Open a settings dialog for the addon of the given id
+
| Suspends (S3 / S1 depending on bios setting) the System
 +
|  
 
|-
 
|-
| UpdateAddonRepos
+
| <code>System.Exec(exec)</code>
| Triggers a forced update of enabled add-on repositories.
+
| Execute shell commands. The full path to the script has to be placed inside the parentheses.
 +
|
 
|-
 
|-
| UpdateLocalAddons
+
| <code>System.ExecWait(exec)</code>
| Triggers a scan of local add-on directories.
+
| Execute shell commands and freezes Kodi until shell is closed. As well as for "System.Exec(exec)", the full path to the script has to be placed inside the parentheses.
 +
|
 
|-
 
|-
| ToggleDPMS
+
|}
| Toggle DPMS mode manually
+
 
 +
=== Weather built-in's ===
 +
 
 +
{| class="prettytable sort sortable" style="width: 100%;"
 +
!  style="width: 29%"| Function
 +
!  style="width: 66%"| Description
 +
!  style="width: 5%"| Version
 
|-
 
|-
| CECToggleState
+
| <code>Weather.LocationNext</code>
| Toggle state of playing device via a CEC peripheral
+
| Switch to next weather location
 +
|  
 
|-
 
|-
| CECActivateSource
+
| <code>Weather.LocationPrevious</code>
| Wake up playing device via a CEC peripheral
+
| Switch to previous weather location
 +
|  
 
|-
 
|-
| CECStandby
+
| <code>Weather.LocationSet</code>
| Put playing device on standby via a CEC peripheral
+
| Switch to given weather location (parameter can be 1-3)
 +
|  
 
|-
 
|-
| Weather.Refresh
+
| <code>Weather.Refresh</code>
 
| Force weather data refresh
 
| Force weather data refresh
 +
|
 +
|}
 +
<section end="functions" />
 +
<section end="main content" />
 +
 +
 +
== Removed functions ==
 +
* <code>LastFM.Love</code> - Removed in v13 Gotham
 +
* <code>LastFM.Ban</code> - Removed in v13 Gotham
 +
* <code>LCD.Suspend</code> - Removed in v13 Gotham
 +
* <code>LCD.Resume</code> - Removed in v13 Gotham
 +
* <code>AllowIdleShutdown</code>
 +
* <code>Help</code>
 +
* <code>LIRC.Send(command)</code>
 +
* <code>LIRC.Start</code>
 +
* <code>LIRC.Stop</code>
 +
* <code>StartPVRManager</code>
 +
* <code>StereoModeToMono</code>
 +
* <code>StopPVRManager</code>
 +
 +
 +
 +
== List of sort methods ==
 +
These ID's can be used with the Container.SetSortMethod(id) function as listed [https://github.com/xbmc/xbmc/blob/75b31098a8800da653b373cd99a025b483029cfc/xbmc/utils/SortUtils.h#L49-L164 here]:
 +
{| class="prettytable"
 +
! ID
 +
! Description
 +
|-
 +
| <code>1</code>
 +
| Name
 +
|-
 +
| <code>2</code>
 +
| Date
 +
|-
 +
| <code>3</code>
 +
| Size
 +
|-
 +
| <code>4</code>
 +
| File
 +
|-
 +
| <code>5</code>
 +
| Path
 +
|-
 +
| <code>6</code>
 +
| DriveType
 +
|-
 +
| <code>7</code>
 +
| Title
 +
|-
 +
| <code>8</code>
 +
| TrackNumber
 +
|-
 +
| <code>9</code>
 +
| Time
 +
|-
 +
| <code>10</code>
 +
| Artist
 +
|-
 +
| <code>11</code>
 +
| ArtistThenYear
 
|-
 
|-
| Weather.LocationNext
+
| <code>12</code>
| Switch to next weather location
+
| Album
 
|-
 
|-
| Weather.LocationPrevious
+
| <code>13</code>
| Switch to previous weather location
+
| AlbumType
 
|-
 
|-
| Weather.LocationSet
+
| <code>14</code>
| Switch to given weather location (parameter can be 1-3)
+
| Genre
 
|-
 
|-
| LIRC.Stop
+
| <code>15</code>
| Removes XBMC as a LIRC client.
+
| Country
 
|-
 
|-
| LIRC.Start
+
| <code>16</code>
| Adds XBMC as a LIRC client.
+
| Year
 
|-
 
|-
| LIRC.Send(command)
+
| <code>17</code>
| Sends a command to LIRC, syntax is the lirc protocol without the newline.<br />Example: LIRC.Send(SEND_ONCE Onkyo_RC-453S2 volup)
+
| Rating
 
|-
 
|-
| VideoLibrary.Search
+
| <code>18</code>
| Brings up a search dialog which will search the library
+
| UserRating
 
|-
 
|-
| ToggleDebug
+
| <code>19</code>
| Enables/disables debug mode
+
| Votes
 +
|-
 +
| <code>20</code>
 +
| Top250
 +
|-
 +
| <code>21</code>
 +
| ProgramCount
 +
|-
 +
| <code>22</code>
 +
| PlaylistOrder
 +
|-
 +
| <code>23</code>
 +
| EpisodeNumber
 +
|-
 +
| <code>24</code>
 +
| Season
 +
|-
 +
| <code>25</code>
 +
| NumberOfEpisodes
 +
|-
 +
| <code>26</code>
 +
| NumberOfWatchedEpisodes
 +
|-
 +
| <code>27</code>
 +
| TvShowStatus
 +
|-
 +
| <code>28</code>
 +
| TvShowTitle
 +
|-
 +
| <code>29</code>
 +
| SortTitle
 +
|-
 +
| <code>30</code>
 +
| ProductionCode
 +
|-
 +
| <code>31</code>
 +
| MPAA
 +
|-
 +
| <code>32</code>
 +
| VideoResolution
 +
|-
 +
| <code>33</code>
 +
| VideoCodec
 +
|-
 +
| <code>34</code>
 +
| VideoAspectRatio
 +
|-
 +
| <code>35</code>
 +
| AudioChannels
 +
|-
 +
| <code>36</code>
 +
| AudioCodec
 +
|-
 +
| <code>37</code>
 +
| AudioLanguage
 +
|-
 +
| <code>38</code>
 +
| SubtitleLanguage
 +
|-
 +
| <code>39</code>
 +
| Studio
 +
|-
 +
| <code>40</code>
 +
| DateAdded
 +
|-
 +
| <code>41</code>
 +
| LastPlayed
 +
|-
 +
| <code>42</code>
 +
| Playcount
 +
|-
 +
| <code>43</code>
 +
| Listeners
 +
|-
 +
| <code>44</code>
 +
| Bitrate
 +
|-
 +
| <code>45</code>
 +
| Random
 +
|-
 +
| <code>46</code>
 +
| Channel
 +
|-
 +
| <code>47</code>
 +
| ChannelNumber
 +
|-
 +
| <code>48</code>
 +
| DateTaken
 +
|-
 +
| <code>49</code>
 +
| Relevance
 
|-
 
|-
| StartPVRManager
+
| <code>50</code>
| (Re)Starts the PVR manager
+
| InstallDate
 
|-
 
|-
| StopPVRManager
+
| <code>51</code>
| Stops the PVR manager
+
| LastUpdated
 
|-
 
|-
| StartAndroidActivity(package,[intent,dataType,dataURI])
+
| <code>52</code>
| Launch an Android native app with the given package name.  Optional parms (in order): intent, dataType, dataURI.
+
| LastUsed
 
|}
 
|}
 +
{{updated|18}}
  
 +
== See also ==
 +
* [[Action IDs]]
  
 
[[Category:Python]]
 
[[Category:Python]]
[[Category:Addon Development]]
+
[[Category:Add-on development]]
[[Category:Skin Development]]
+
[[Category:Skin development]]

Latest revision as of 12:59, 13 September 2020

Home icon grey.png   ▶ Python development
▶ Add-on development
▶ Skinning
▶ Built-in scripting ▶ List of built-in functions

Skins can use built-in functions with the <onclick> or <onfocus> tag. Scripts can call built-in functions with xbmc.executebuiltin(function, block).

The latest up-to-date list of built-in functions can be found in the source code files in [1].

In addition to the following list, for most <onclick> and <onfocus> button actions in the skin you can also use the functions from Keyboard.xml.

Example:
<onclick>VolumeUp</onclick>
<onclick>VolumeDown</onclick>

You can use parameters with all media windows, as can be seen here:

1 List of functions


1.1 Add-on built-in's

Function Description Version
Addon.Default.OpenSettings(extensionpoint) Open a settings dialog for the default addon of the given type (extensionpoint)
Addon.Default.Set(extensionpoint) Open a select dialog to allow choosing the default addon of the given type (extensionpoint)
Addon.OpenSettings(id) Open a settings dialog for the addon of the given id
EnableAddon(id) Enables the specified plugin/script v19 addition
InstallAddon(id) Will install the addon with the given id.
InstallFromZip Opens the "Install from zip"-dialog if "Unknown sources" is enabled. Prompts the warning message if not.
RunAddon(id) Runs the specified plugin/script
RunAppleScript(script[,args]*) Run the specified AppleScript command
RunPlugin(plugin) Runs the plugin. Full path must be specified. Does not work for folder plugins
RunScript(script[,args]*) Runs the python script. You must specify the add-on id of the script. As of 2007/02/24, all extra parameters are passed to the script as arguments and can be accessed by python using sys.argv
StopScript(id) Stop the script by ID or path, if running v12 Addition
UpdateAddonRepos Triggers a forced update of enabled add-on repositories.
UpdateLocalAddons Triggers a scan of local add-on directories.

1.2 Android built-in's

Function Description Version
StartAndroidActivity(package,[intent,dataType,dataURI]) Launch an Android native app with the given package name. Optional parms (in order): intent, dataType, dataURI. example: StartAndroidActivity(com.android.chrome,android.intent.action.VIEW,,http://kodi.tv/) v13 Addition

1.3 Application built-in's

Function Description Version
Extract(archive_url[, destination]) Extracts a specified archive to an optionally specified 'absolute' path.
Mute Mutes (or unmutes) the volume.
NotifyAll(sender, data [, json]) Notify all connected clients v13 Addition
SetVolume(percent[,showvolumebar]) Sets the volume to the percentage specified. Optionally, show the Volume Dialog in Kodi when setting the volume.
ToggleDebug Enables/disables debug mode v12 Addition
ToggleDPMS Toggle DPMS (VESA Display Power Management Signaling) mode manually
WakeOnLan(mac) Sends the wake-up packet to the broadcast address for the specified MAC address (Format: FF:FF:FF:FF:FF:FF or FF-FF-FF-FF-FF-FF).

1.4 CEC built-in's

Function Description Version
CECActivateSource Wake up playing device via a CEC peripheral v13 Addition
CECStandby Put playing device on standby via a CEC peripheral v13 Addition
CECToggleState Toggle state of playing device via a CEC peripheral v13 Addition

1.5 GUI built-in's

Function Description Version
Action(action[,window]) Executes an action (same as in keymap) for the given window or the active window if the parameter window is omitted. The parameter window can either be the window's id, or in the case of a standard window, the window's name. See Action IDs for a list of available actions.
ActivateWindow(window[,dir,return]) Opens the given window. The parameter window can either be the window's id, or in the case of a standard window, the window's name. See Window IDs for a list of window names, and their respective ids. If, furthermore, the window is Music, Video, Pictures, or Program files, then the optional dir parameter specifies which folder Kodi should default to once the window is opened. This must be a source as specified in sources.xml, or a subfolder of a valid source. For some windows (MusicLibrary and VideoLibrary), the return parameter may be specified, which indicates that Kodi should use this folder as the "root" of the level, and thus the "parent directory" action from within this folder will return the user to where they were prior to the window activating.
ActivateWindowAndFocus(id1, id2,item1, id3,item2) Activate window with id1, first focus control id2 and then focus control id3. if either of the controls is a container, you can specify which item to focus (else, set it to 0). v12 Addition
AlarmClock(name,command,time[,silent,loop]) Pops up a dialog asking for the length of time (mm:ss) for the alarm (unless the parameter time is specified), and starts a timer. When the timer runs out, it'll execute the built-in command (the parameter command) if it is specified, otherwise it'll pop up an alarm notice. Add silent to hide the alarm notification. Add loop for the alarm to execute the command each time the specified time interval expires.
CancelAlarm(name[,silent]) Cancel a running alarm. Set silent to true to hide the alarm notification.
ClearProperty(key[,id]) Clears a window property for the current focused window/dialog(key), or the specified window (key,id).
Dialog.Close(dialog[,force]) Close a dialog. Set force to true to bypass animations. Use (all,true) to close all opened dialogs at once.
NextChannelGroup Navigate to the next PVR channel group (in DialogPVRChannelsOSD.xml) v13 Addition
NextStereoMode Changes the stereo mode of the GUI to the next available mode. v13 Addition
Notification(header,message[,time,image]) Will display a notification dialog with the specified header and message, in addition you can set the length of time it displays in milliseconds and a icon image.
PreviousChannelGroup Navigate to the previous PVR channel group (in DialogPVRChannelsOSD.xml) v13 Addition
PreviousStereoMode Changes the stereo mode of the GUI to the previous available mode. v13 Addition
RefreshRSS Reload RSS feeds from RSSFeeds.xml
ReplaceWindow(window,dir) Replaces the current window with the given window. This is the same as ActivateWindow() but it doesn't update the window history list, so when you go back from the new window it will not return to the previous window, rather will return to the previous window's previous window.
ReplaceWindowAndFocus(id1, id2,item1, id3,item2) Replace window with id1, first focus control id2 and then focus control id3. if either of the controls is a container, you can specify which item to focus (else, set it to 0). v13 Addition
Resolution Change Kodi's Resolution.
SetGUILanguage(value) Set GUI Language, 'value' is the language file to use. SetGUILanguage(resource.language.de_de) v13 Addition
SetProperty(key,value[,id]) Sets a window property for the current window (key,value), or the specified window (key,value,id).
SetStereoMode Changes the stereo mode of the GUI. Params can be: toggle, next, previous, select, tomono or any of the supported stereomodes (off, split_vertical, split_horizontal, row_interleaved, hardware_based, anaglyph_cyan_red, anaglyph_green_magenta, monoscopic) v13 Addition
settingslevelchange Toggles the visible settings (in SettingsCategory.xml) between 'basic', 'standard', 'advanced and 'expert' v13 Addition
TakeScreenshot([filenameandpath,sync]) Takes a Screenshot. You can optionally specify the filename (including the path). Note: only .png files are supported. Add "sync" parameter to run synchronously (slow).
ToggleDirtyRegionVisualization makes dirty regions visible for debugging proposes. v16 Addition
ToggleStereoMode Toggle the stereoscopic mode of the GUI (on/off). v13 Addition

1.6 GUI container built-in's

Function Description Version
Container.NextSortMethod Change to the next sort method.
Container.NextViewMode Select the next view mode.
Container.PreviousSortMethod Change to the previous sort method.
Container.PreviousViewMode Select the previous view mode.
Container.Refresh Refresh current listing.
Container.SetSortMethod(id) Change to the specified sort method. (For list of ID's see [list of sort methods])
Container.SetViewMode(id) Set the current view mode (list, icons etc.) to the given container id.
Container.SetSortDirection Toggle the sort direction.
Container.Update Update current listing. Send Container.Update(path,replace) to reset the path history.

1.7 GUI control built-in's

Function Description Version
Control.Message(id,message,[windowid]) Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.
Control.Move(id,offset) Will make a Container with the "id" specified in the command move focus by "offset".
Control.SetFocus(id,position[,absolute]) Will make a list with the "id" specified in the command gain focus at "position" number in its list. Set absolute to focus the first listitem of a container instead of the first visible listitem. Alias SetFocus(id,position)
PageDown Send a page down event to the pagecontrol with given id.
PageUp Send a page up event to the pagecontrol with given id.
SendClick(windowid,id) Sends a click to a control in a given window (or active window if omitted).
SetFocus(id,position[,absolute]) Will make a list with the "id" specified in the command gain focus at "position" number in its list. Set absolute to focus the first listitem of a container instead of the first visible listitem. Alias Control.SetFocus(id,position)

1.8 Library built-in's

Function Description Version
CleanLibrary(database) This funtion will perform a number of 'cleanup' tasks on your video database and can be run if you have moved, deleted or renamed files. Takes either "video" or "music" as a parameter to begin cleaning the corresponding database.
exportlibrary(music,false,filepath) The music library will be exported to a single file stored at filepath location.
exportlibrary(video,true,thumbs,overwrite,actorthumbs) The video library is exported to multiple files with the given options. Here thumbs, overwrite and actorthumbs are boolean values (true or false).
UpdateLibrary(database,[path]) Takes either "video" or "music" as a parameter to begin updating the corresponding database. For "video" you can additionally specify a specific path to be scanned.
VideoLibrary.Search Brings up a search dialog which will search the library

1.9 Optical container built-in's

Function Description Version
EjectTray() Either opens or closes the DVD tray, depending on its current state
RipCD Will rip the inserted CD from the DVD-ROM drive.

1.10 Picture built-in's

Function Description Version
RecursiveSlideShow(dir) Run a slideshow from the specified directory, including all subdirs
ShowPicture(picture) Show a picture by its file path/url. v13 Addition
SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"]) Starts a slideshow of pictures in the folder dir. Optional parameters are 'recursive', 'random' or 'notrandom', 'pause' and 'beginslide="/path/to/some/image.jpg"' parameters. The "recursive" parameter starts a recursive slideshow, adding images from sub-folders. The "random" and "notrandom" parameters override the Randomize setting found in the pictures media window. The "pause" parameter will start the slideshow paused. "beginslide" will start the slideshow with the specified image.

1.11 Player built-in's

Function Description Version
PlayDisc(param) Will play the inserted CD or DVD media from the DVD-ROM drive.
PlayerControl(command) Allows control of music and videos. The command may be one of Play, Stop, Forward, Rewind, Next, Previous, BigSkipForward, BigSkipBackward, SmallSkipForward, SmallSkipBackward, FrameAdvance(#), TempoUp, TempoDown, Random, RandomOn, RandomOff, Repeat, RepeatOne, RepeatAll, RepeatOff, Partymode(music) or Partymode(video) or Partymode(path to .xsp file) or Reset.

Play will either pause, resume, or stop ffwding or rewinding. Random toggles random playback and Repeat cycles through the repeat modes (these both take an optional second parameter, Notify, that notifies the user of the new state). Partymode(music/video) toggles the appropriate partymode, defaults to music if no parameter is given, besides the default music or video partymode you can also pass a path to a custom smartplaylist (.xsp) as parameter. Reset only applies to games and will reset the currently playing game.

PlayerResolutionSelect Select a different resolution v18
Playlist.Clear Clear the current playlist
Playlist.PlayOffset Start playing from a particular offset in the playlist
PlayMedia(media[,isdir][,1],[playoffset=xx],[resume],[noresume]) Plays the media. This can be a playlist, music, or video file, directory, plugin or a url. The optional parameter ",isdir" can be used for playing a directory. ",1" will start the media without switching to fullscreen. If media is a playlist, you can use playoffset=xx where xx is the position to start playback from. Set "resume" to force resuming. Set "noresume" to force not resuming.
PlayWith() Play the selected item with the specified player core.
Seek(seconds) Seeks to the specified relative amount of seconds within the current playing media. A negative value will seek backward and a positive value forward. v15 Addition

1.12 Profile built-in's

Function Description Version
LoadProfile(profilename,[prompt]) Load the specified profile. If prompt is not specified, and a password would be required for the requested profile, this command will silently fail. If promp' is specified and a password is required, a password dialog will be shown.
Mastermode Runs Kodi in master mode
System.LogOff Log off current user.

1.13 PVR built-in's

Function Description Version
PVR.SearchMissingChannelIcons Will start a search for missing channel icons v16 Addition
PVR.ToggleRecordPlayingChannel Will toggle recording on playing channel, if any v18
PVR.SeekPercentage Performs a seek to the given percentage in timeshift buffer, if timeshifting is supported

1.14 Skin built-in's

Function Description Version
ReloadSkin() Reloads the current skin – useful for Skinners to use after they upload modified skin files (saves power cycling)
Skin.Reset(setting) Resets the skin setting ?setting?. If ?setting? is a bool setting (i.e. set via SetBool or ToggleSetting) then the setting is reset to false. If ?setting? is a string (Set via SetString, SetImage, or SetPath) then it is set to empty.
Skin.ResetSettings Resets all the above skin settings to their defaults (toggles all set to false, strings all set to empty.)
Skin.SelectBool(header, label1|setting1, label2|setting2) Pops up select dialog to select between multiple skin setting options. Skin.SelectBool(424, 31411|RecentWidget, 31412|RandomWidget, 31413|InProgressWidget)
Skin.SetAddon(string,type) Pops up a select dialog and allows the user to select an add-on of the given type to be used elsewhere in the skin via the info tag Skin.String(string). The most common types are xbmc.addon.video, xbmc.addon.audio, xbmc.addon.image, xbmc.addon.executable and kodi.gameclient.
Skin.SetBool(setting) Sets the skin setting ?setting? to true, for use with the conditional visibility tags containing Skin.HasSetting(setting). The settings are saved per-skin in settings.xml just like all the other Kodi settings.
Skin.SetFile(string,mask,folderpath) Pops up a folder browser and allows the user to select a file off the hard-disk to be used else where in the skin via the info tag Skin.String(string). If the mask parameter is specified, then the file browser will only search for the extension specified (.avi,.mp3,.m3u,.png,.bmp,etc.,etc.). To use multiple extensions separate them using "|" (minus quotes). If the folderpath parameter is set the file browser will start in that folder.
Skin.SetImage(string[,value,path]) Pops up a file browser and allows the user to select an image file to be used in an image control elsewhere in the skin via the info tag Skin.String(string). If the value parameter is specified, then the file browser dialog does not pop up, and the image path is set directly. the path option allows you to open the file browser in the specified folder.
Skin.SetNumeric(numeric[,value]) Pops up a keyboard dialog and allows the user to input a numerical.
Skin.SetPath(string[,folderpath]) Pops up a folder browser and allows the user to select a folder of images to be used in a multi image control else where in the skin via the info tag Skin.String(string). If the folderpath parameter is set the file browser will start in that folder.
Skin.SetString(string[,value]) Pops up a keyboard dialog and allows the user to input a string which can be used in a label control elsewhere in the skin via the info tag Skin.String(string). If the value parameter is specified, then the keyboard dialog does not pop up, and the string is set directly.
Skin.Theme(1) Cycles the skin theme. Skin.Theme(-1) will go backwards.
Skin.ToggleDebug Toggles skin debug info on/off
Skin.ToggleSetting(setting) Toggles the skin setting ?setting? for use with conditional visibility tags containing Skin.HasSetting(setting).
UnloadSkin() Unloads the current skin

1.15 System built-in's

Function Description Version
ActivateScreensaver Starts the screensaver v13 Addition
Hibernate Hibernate (S4) the System
InhibitIdleShutdown(true/false) Prevent the system to shutdown on idle. v12 Addition
Minimize Minimizes Kodi
Powerdown Powerdown system
Quit Quits Kodi
Reboot Cold reboots the system (power cycle)
Reset Reset the system (same as reboot)
RestartApp Restarts Kodi (only implemented under Windows and Linux)
ShutDown Trigger default Shutdown action defined in System Settings
Suspend Suspends (S3 / S1 depending on bios setting) the System
System.Exec(exec) Execute shell commands. The full path to the script has to be placed inside the parentheses.
System.ExecWait(exec) Execute shell commands and freezes Kodi until shell is closed. As well as for "System.Exec(exec)", the full path to the script has to be placed inside the parentheses.

1.16 Weather built-in's

Function Description Version
Weather.LocationNext Switch to next weather location
Weather.LocationPrevious Switch to previous weather location
Weather.LocationSet Switch to given weather location (parameter can be 1-3)
Weather.Refresh Force weather data refresh



2 Removed functions

  • LastFM.Love - Removed in v13 Gotham
  • LastFM.Ban - Removed in v13 Gotham
  • LCD.Suspend - Removed in v13 Gotham
  • LCD.Resume - Removed in v13 Gotham
  • AllowIdleShutdown
  • Help
  • LIRC.Send(command)
  • LIRC.Start
  • LIRC.Stop
  • StartPVRManager
  • StereoModeToMono
  • StopPVRManager


3 List of sort methods

These ID's can be used with the Container.SetSortMethod(id) function as listed here:

ID Description
1 Name
2 Date
3 Size
4 File
5 Path
6 DriveType
7 Title
8 TrackNumber
9 Time
10 Artist
11 ArtistThenYear
12 Album
13 AlbumType
14 Genre
15 Country
16 Year
17 Rating
18 UserRating
19 Votes
20 Top250
21 ProgramCount
22 PlaylistOrder
23 EpisodeNumber
24 Season
25 NumberOfEpisodes
26 NumberOfWatchedEpisodes
27 TvShowStatus
28 TvShowTitle
29 SortTitle
30 ProductionCode
31 MPAA
32 VideoResolution
33 VideoCodec
34 VideoAspectRatio
35 AudioChannels
36 AudioCodec
37 AudioLanguage
38 SubtitleLanguage
39 Studio
40 DateAdded
41 LastPlayed
42 Playcount
43 Listeners
44 Bitrate
45 Random
46 Channel
47 ChannelNumber
48 DateTaken
49 Relevance
50 InstallDate
51 LastUpdated
52 LastUsed

4 See also