List of built-in functions: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
Ronie (talk | contribs)
Hitcher (talk | contribs)
 
(32 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{mininav| [[Python development]] {{l2| [[Add-on development]] }} {{l2| [[Skinning]] }} | [[Built-in scripting]] }}
{{mininav| [[Python development]] {{l2| [[Add-on development]] }} {{l2| [[Skinning]] }} | [[Built-in scripting]] }}
<section begin="main content" />
<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>.
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>.
Line 15: Line 16:
'''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]]
* [[Opening Windows and Dialogs]]


== List of functions ==
== List of functions ==
Line 28: Line 31:
| <code>Addon.Default.OpenSettings(extensionpoint)</code>
| <code>Addon.Default.OpenSettings(extensionpoint)</code>
| Open a settings dialog for the default addon of the given type (extensionpoint)
| Open a settings dialog for the default addon of the given type (extensionpoint)
|  
|
|-
|-
| <code>Addon.Default.Set(extensionpoint)</code>
| <code>Addon.Default.Set(extensionpoint)</code>
| Open a select dialog to allow choosing the default addon of the given type (extensionpoint)
| Open a select dialog to allow choosing the default addon of the given type (extensionpoint)
|  
|
|-
|-
| <code>Addon.OpenSettings(id)</code>
| <code>Addon.OpenSettings(id)</code>
| Open a settings dialog for the addon of the given id  
| 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>
| <code>InstallAddon(id)</code>
| Will install the addon with the given id.
| Will install the addon with the given id.
|  
|
|-
|-
| <code>InstallFromZip</code>
| <code>InstallFromZip</code>
Line 48: Line 55:
| <code>RunAddon(id)</code>
| <code>RunAddon(id)</code>
| Runs the specified plugin/script  
| Runs the specified plugin/script  
|  
|
|-
|-
| <code>RunAppleScript(script[,args]*)</code>
| <code>RunAppleScript(script[,args]*)</code>
| Run the specified AppleScript command  
| Run the specified AppleScript command  
|  
|
|-
|-
| <code>RunPlugin(plugin)</code>
| <code>RunPlugin(plugin)</code>
| Runs the plugin. Full path must be specified. Does not work for folder plugins  
| Runs the plugin. Full path must be specified. Does not work for folder plugins  
|  
|
|-
|-
| <code>RunScript(script[,args]*)</code>
| <code>RunScript(script[,args]*)</code>
| Runs the python script. You must specify the full path to the script. One way to specify the full path is through the [[Special protocol|special protocol]]. 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  
| 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>
| <code>StopScript(id)</code>
Line 68: Line 75:
| <code>UpdateAddonRepos</code>
| <code>UpdateAddonRepos</code>
| Triggers a forced update of enabled add-on repositories.  
| Triggers a forced update of enabled add-on repositories.  
|  
|
|-
|-
| <code>UpdateLocalAddons</code>
| <code>UpdateLocalAddons</code>
| Triggers a scan of local add-on directories.  
| Triggers a scan of local add-on directories.  
|  
|
|-
|-
|}
|}
Line 98: Line 105:
| <code>Extract(archive_url[, destination])</code>
| <code>Extract(archive_url[, destination])</code>
| Extracts a specified archive to an optionally specified 'absolute' path.  
| Extracts a specified archive to an optionally specified 'absolute' path.  
|  
|
|-
|-
| <code>Mute</code>
| <code>Mute</code>
| Mutes (or unmutes) the volume.  
| Mutes (or unmutes) the volume.  
|  
|
|-
|-
| <code>NotifyAll(sender, data [, json])</code>
| <code>NotifyAll(sender, data [, json])</code>
Line 110: Line 117:
| <code>SetVolume(percent[,showvolumebar])</code>
| <code>SetVolume(percent[,showvolumebar])</code>
| Sets the volume to the percentage specified. Optionally, show the Volume Dialog in Kodi when setting the volume.  
| Sets the volume to the percentage specified. Optionally, show the Volume Dialog in Kodi when setting the volume.  
|  
|
|-
|-
| <code>ToggleDebug</code>
| <code>ToggleDebug</code>
Line 118: Line 125:
| <code>ToggleDPMS</code>
| <code>ToggleDPMS</code>
| Toggle DPMS (VESA Display Power Management Signaling) mode manually  
| Toggle DPMS (VESA Display Power Management Signaling) mode manually  
|  
|
|-
|-
| <code>WakeOnLan(mac)</code>
| <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).  
| 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).  
|  
|
|-
|-
|}
|}
Line 145: Line 152:
| {{nowrap|v13 Addition}}
| {{nowrap|v13 Addition}}
|-
|-
|}
=== EPG built-in's ===
{| class="prettytable sort sortable" style="width: 100%;"
!  style="width: 29%"| Function
!  style="width: 66%"| Description
!  style="width: 5%"| Version
|-
| <code>PVR.EpgGridControl(command)</code>
| supported commands: firstprogramme  (jump to the first programme) / currentprogramme  (jump to the current programme) / lastprogramme  (jump to the last programme) / selectdate  (jump to the selected date & time) / +XX  (jump XX hours forward) / -XX  (jump XX hours back) / firstchannel  (jump to the first channel) / playingchannel  (jump to the currently playing channel) / lastchannel  (jump to the last channel) / previousgroup  (switch the epg to the previous group) / nextgroup  (switch the epg to the next group) / selectgroup  (select a group)
| {{nowrap|v19 Addition}}
|}
|}


Line 156: Line 175:
| <code>Action(action[,window])</code>
| <code>Action(action[,window])</code>
| 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.  
| 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.  
|  
|
|-
|-
| <code>ActivateWindow(window[,dir,return])</code>
| <code>ActivateWindow(window[,dir,return])</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. 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.  
| 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.  
|  
|
|-
|-
| <code>ActivateWindowAndFocus(id1, id2,item1, id3,item2)</code>
| <code>ActivateWindowAndFocus(id1, id2,item1, id3,item2)</code>
Line 166: Line 185:
| {{nowrap|v12 Addition}}
| {{nowrap|v12 Addition}}
|-
|-
| <code>AlarmClock(name,command,time[,silent,loop])</code>
| <code>AlarmClock(name,command,[time,silent,loop])</code>
| 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.  
| 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. If defining the last optional parameters (silent and loop) both have to be defined for any to take effect. The parameter "time" accepts an integer value (in minutes) or a timestring in the format "hh:mm:ss" or "mm min".
|  
|
|-
|-
| <code>CancelAlarm(name[,silent])</code>
| <code>CancelAlarm(name[,silent])</code>
| Cancel a running alarm. Set silent to true to hide the alarm notification.  
| Cancel a running alarm. Set silent to true to hide the alarm notification.  
|  
|
|-
|-
| <code>ClearProperty(key[,id])</code>
| <code>ClearProperty(key[,id])</code>
| Clears a window property for the current focused window/dialog(key), or the specified window (key,id).  
| Clears a window property for the current focused window/dialog(key), or the specified window (key,id).  
|  
|
|-
|-
| <code>Dialog.Close(dialog[,force])</code>
| <code>Dialog.Close(dialog[,force])</code>
| Close a dialog. Set force to true to bypass animations. Use (all,true) to close all opened dialogs at once.  
| Close a dialog. Set force to true to bypass animations. Use (all,true) to close all opened dialogs at once.  
|  
|
|-
|-
| <code>NextChannelGroup</code>
| <code>NextChannelGroup</code>
Line 192: Line 211:
| <code>Notification(header,message[,time,image])</code>
| <code>Notification(header,message[,time,image])</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.  
| 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.  
|  
|
|-
|-
| <code>PreviousChannelGroup</code>
| <code>PreviousChannelGroup</code>
Line 204: Line 223:
| <code>RefreshRSS</code>
| <code>RefreshRSS</code>
| Reload RSS feeds from RSSFeeds.xml  
| Reload RSS feeds from RSSFeeds.xml  
|  
|
|-
|-
| <code>ReplaceWindow(window,dir)</code>
| <code>ReplaceWindow(window,dir)</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.  
| 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.  
|  
|
|-
|-
| <code>ReplaceWindowAndFocus(id1, id2,item1, id3,item2)</code>
| <code>ReplaceWindowAndFocus(id1, id2,item1, id3,item2)</code>
Line 216: Line 235:
| <code>Resolution</code>
| <code>Resolution</code>
| Change Kodi's Resolution.  
| Change Kodi's Resolution.  
|  
|
|-
|-
| <code>SetGUILanguage(value)</code>
| <code>SetGUILanguage(value)</code>
Line 224: Line 243:
| <code>SetProperty(key,value[,id])</code>
| <code>SetProperty(key,value[,id])</code>
| Sets a window property for the current window (key,value), or the specified window (key,value,id).  
| Sets a window property for the current window (key,value), or the specified window (key,value,id).  
|  
|
|-
|-
| <code>SetStereoMode</code>
| <code>SetStereoMode</code>
Line 230: Line 249:
| {{nowrap|v13 Addition}}
| {{nowrap|v13 Addition}}
|-
|-
| <code>settingslevelchange</code>
| <code>SettingsLevelChange</code>
| Toggles the visible settings (in SettingsCategory.xml) between 'basic', 'standard', 'advanced and 'expert'
| Toggles the visible settings (in SettingsCategory.xml) between 'basic', 'standard', 'advanced and 'expert'
| {{nowrap|v13 Addition}}
| {{nowrap|v13 Addition}}
Line 236: Line 255:
| <code>TakeScreenshot([filenameandpath,sync])</code>
| <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).
| 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>
| <code>ToggleDirtyRegionVisualization</code>
Line 257: Line 276:
| <code>Container.NextSortMethod</code>
| <code>Container.NextSortMethod</code>
| Change to the next sort method.  
| Change to the next sort method.  
|  
|
|-
|-
| <code>Container.NextViewMode</code>
| <code>Container.NextViewMode</code>
| Select the next view mode.  
| Select the next view mode.  
|  
|
|-
|-
| <code>Container.PreviousSortMethod</code>
| <code>Container.PreviousSortMethod</code>
| Change to the previous sort method.  
| Change to the previous sort method.  
|  
|
|-
|-
| <code>Container.PreviousViewMode</code>
| <code>Container.PreviousViewMode</code>
| Select the previous view mode.  
| Select the previous view mode.  
|  
|
|-
|-
| <code>Container.Refresh</code>
| <code>Container.Refresh</code>
| Refresh current listing.  
| Refresh current listing.  
|  
|
|-
| <code>Container.SetSortDirection</code>
| Toggle the sort direction.
|
|-
|-
| <code>Container.SetSortMethod(id)</code>
| <code>Container.SetSortMethod(id)</code>
| Change to the specified sort method. (For list of ID's see List of sort methods below)  
| 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>
| <code>Container.SetViewMode(id)</code>
| Set the current view mode (list, icons etc.) to the given container id.  
| Set the current view mode (list, icons etc.) to the given container id.  
|  
|
|-
|-
| <code>Container.SetSortDirection</code>
| <code>Container.SortDirection</code>
| Toggle the sort direction.
| Toggle the sort direction
|  
|
|-
|-
 
 
| <code>Container.Update</code>
| <code>Container.Update</code>
| Update current listing. Send Container.Update(path,replace) to reset the path history.  
| Update current listing. Send Container.Update(path,replace) to reset the path history.  
|  
|
|-
|}
|}


Line 302: Line 328:
| <code>Control.Message(id,message,[windowid])</code>
| <code>Control.Message(id,message,[windowid])</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.  
| Sends a given message to a control in a given window (or active window if omitted). Messages can be movedown, moveup, pagedown, pageup, click.  
|  
|
|-
|-
| <code>Control.Move(id,offset)</code>
| <code>Control.Move(id,offset)</code>
| Will make a Container with the "id" specified in the command move focus by "offset".  
| Will make a Container with the "id" specified in the command move focus by "offset".  
|  
|
|-
|-
| <code>Control.SetFocus(id,position[,absolute])</code>
| <code>Control.SetFocus(id,position[,absolute])</code>
| 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)  
| 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)  
|  
|
|-
|  <code>Control.SetVisible(controlId)</code>
|  Set the control id to visible
'''Parameters'''
:[in] controlId ID of control.
'''Parameters'''
:[in] controlId ID of control.
'''Parameters'''
:[in] controlId ID of control.
|
|-
|-
| <code>PageDown</code>
| <code>PageDown</code>
| Send a page down event to the pagecontrol with given id.  
| Send a page down event to the pagecontrol with given id.  
|  
|
|-
|-
| <code>PageUp</code>
| <code>PageUp</code>
| Send a page up event to the pagecontrol with given id.  
| Send a page up event to the pagecontrol with given id.  
|  
|
|-
|-
| <code>SendClick(windowid,id)</code>
| <code>SendClick(windowid,id)</code>
| Sends a click to a control in a given window (or active window if omitted).  
| Sends a click to a control in a given window (or active window if omitted).  
|  
|
|-
|-
| <code>SetFocus(id,position[,absolute])</code>
| <code>SetFocus(id,position[,absolute])</code>
| 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)  
| 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)  
|  
|
|-
|}
|}


Line 340: Line 375:
| <code>CleanLibrary(database)</code>
| <code>CleanLibrary(database)</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.  
| 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.  
|  
|
|-
|-
| <code>exportlibrary(music,false,filepath)</code>
| <code>ExportLibrary(music,false,filepath)</code>
| The music library will be exported to a single file stored at filepath location.  
| The music library will be exported to a single file stored at filepath location.  
|  
|
|-
|-
| <code>exportlibrary(video,true,thumbs,overwrite,actorthumbs)</code>
| <code>ExportLibrary(video,true,thumbs,overwrite,actorthumbs)</code>
| The video library is exported to multiple files with the given options. Here thumbs, overwrite and actorthumbs are boolean values (true or false).  
| The video library is exported to multiple files with the given options. Here thumbs, overwrite and actorthumbs are boolean values (true or false).  
|  
|
|-
|  <code>ExportLibrary2(library, exportFiletype, path [, unscraped][, overwrite][, artwork][, skipnfo] / [, albums][, albumartists][, songartists][, otherartists][, actorthumbs])</code>
|  Export the video/music library with extended parameters
'''Parameters'''
:[in] library "video" or "music".
:[in] exportFiletype "singlefile", "separate" or "library".
:[in] path Path to destination folder.
:[in] unscraped Add "unscraped" to include unscraped items.
:[in] overwrite Add "overwrite" to overwrite existing files.
:[in] artwork Add "artwork" to include images such as thumbs and fanart.
:[in] skipnfo Add "skipnfo" to not include nfo files(just art).
:[in] albums Add "ablums" to include albums.
:[in] albumartists Add "albumartists" to include album artists.
:[in] songartists Add "songartists" to include song artists.
:[in] otherartists Add "otherartists" to include other artists.
:[in] actorthumbs Add "actorthumbs" to include other actor thumbs.
|
|-
|  <code>MusicLibrary.RefreshAlbum([albumId\])</code>
|  Rescrapes additional information for a given album
'''Parameters'''
:[in] albumId Album Id.
|
|-
|  <code>MusicLibrary.RefreshArtist([artistId\])</code>
|  Rescrapes additional information for a given artist
'''Parameters'''
:[in] artistId Artist Id.
|
|-
|-
| <code>UpdateLibrary(database,[path])</code>
| <code>UpdateLibrary(database,[path])</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.  
| 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.  
|  
|
|-
|-
| <code>VideoLibrary.Search</code>
| <code>VideoLibrary.Search</code>
| Brings up a search dialog which will search the library  
| Brings up a search dialog which will search the library  
|  
|
|-
|}
|}


Line 369: Line 432:
| <code>EjectTray()</code>
| <code>EjectTray()</code>
| Either opens or closes the DVD tray, depending on its current state  
| Either opens or closes the DVD tray, depending on its current state  
|  
|
|-
|-
| <code>RipCD</code>
| <code>RipCD</code>
| Will rip the inserted CD from the DVD-ROM drive.  
| Will rip the inserted CD from the DVD-ROM drive.  
|  
|
|-
|-
|}
|}
Line 386: Line 449:
| <code>RecursiveSlideShow(dir)</code>
| <code>RecursiveSlideShow(dir)</code>
| Run a slideshow from the specified directory, including all subdirs  
| Run a slideshow from the specified directory, including all subdirs  
|  
|
|-
|-
| <code>ShowPicture(picture)</code>
| <code>ShowPicture(picture)</code>
Line 394: Line 457:
| <code>SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"])</code>
| <code>SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"])</code>
| 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.
| 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.
|  
|
|-
|-
|}
|}
Line 407: Line 470:
| <code>PlayDisc(param)</code>
| <code>PlayDisc(param)</code>
| Will play the inserted CD or DVD media from the DVD-ROM drive.  
| Will play the inserted CD or DVD media from the DVD-ROM drive.  
|  
|
|-
|  <code>PlayDVD(param)</code>
|  (deprecated) Plays the inserted disc, like CD, DVD or Blu-ray, in the disc drive.
'''Parameters'''
:[in] param "restart" to restart from resume point (optional)
|
|-
|-
| <code>PlayerControl(command)</code>
| <code>PlayerControl(command)</code>
| Allows control of music and videos. The command may be one of Play, Stop, Forward, Rewind, Next, Previous, BigSkipForward, BigSkipBackward, SmallSkipForward, SmallSkipBackward, 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. Rest only applies to games and will reset the currently playing game. For more possible commands see [[Action_IDs]].
| 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, Tempo(value), 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.
|
|-
|-
| <code>PlayerResolutionSelect</code>
| <code>PlayerResolutionSelect</code>
Line 419: Line 489:
| <code>Playlist.Clear</code>
| <code>Playlist.Clear</code>
| Clear the current playlist  
| Clear the current playlist  
|  
|
|-
|-
| <code>Playlist.PlayOffset</code>
| <code>Playlist.PlayOffset</code>
| Start playing from a particular offset in the playlist  
| Start playing from a particular offset in the playlist  
|  
|
|-
|-
| <code>PlayMedia(media[,isdir][,1],[playoffset=xx])</code>
| <code>PlayMedia(mediaPath[,isdir][,1][,playoffset=xx][,resume][,noresume][,playlist_type_hint=x])</code>
| 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 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.  
| 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.
|  
 
{{note|Following parameters are available from Kodi v20.}}
If media is a playlist (e.g. STRM), you can set the type of playlist with "playlist_type_hint=x" where x can be 0 for music playlist or 1 for video playlist, if not set will be used music playlist.
|
|-
|  <code>PlaysDisc(parm)</code>
|  &nbsp;
|
|-
|-
| <code>PlayWith()</code>
| <code>PlayWith()</code>
| Play the selected item with the specified player core.  
| Play the selected item with the specified player core.  
|  
|
|-
|  <code>QueueMedia(media[,isdir][,1][,playnext],[playoffset=xx])</code>
|  Queues the given media. This can be a playlist, music, or video file, directory, plugin, disc image stack, video file stack or an URL. The optional parameter <code>,isdir</code> can be used for playing a directory. <code>,1</code> will start the media without switching to fullscreen. If media is a playlist or a disc image stack or a video file stack, you can use playoffset=xx where xx is the position to start playback from. where xx is the position to start playback from.
'''Parameters'''
:[in] media URL of media to queue.
:[in] isdir Set <code>isdir</code> if media is a directory (optional).
:[in] 1 Set <code>1</code> to start playback without switching to fullscreen (optional).
:[in] resume Set <code>resume</code> to force resuming (optional).
:[in] noresume Set <code>noresume</code> to force not resuming (optional).
:[in] playoffset Set <code>playoffset=<offset></code> to start playback from a given position in a playlist or stack (optional).
:[in] playnext Set <code>playnext</code> to play the media right after the currently playing item, if player is currently playing. If player is not playing, append media to current playlist (optional).
|
|-
|-
| <code>Seek(seconds)</code>
| <code>Seek(seconds)</code>
Line 437: Line 526:
| {{nowrap|v15 Addition}}
| {{nowrap|v15 Addition}}
|-
|-
| <code>QueueMedia()</code> <ref>https://github.com/xbmc/xbmc/pull/22048</ref>
| Queues the given 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 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.
* @param[in] media                URL of media to queue.
* @param[in] isdir                Set "isdir" if media is a directory (optional).
* @param[in] 1                    Set "1" to start playback without switching to fullscreen (optional).
* @param[in] resume                Set "resume" to force resuming (optional).
* @param[in] noresume              Set "noresume" to force not resuming (optional).
* @param[in] playeroffset          Set "playoffset=<offset>" to start playback from a given position in a playlist (optional).
* @param[in] playnext              Set "playnext" to play the media right after the currently playing item, if player is currently playing. If player is not playing, append media to current playlist (optional).
|
|}
|}


=== Porfile built-in's ===
=== Profile built-in's ===


{| class="prettytable sort sortable" style="width: 100%;"
{| class="prettytable sort sortable" style="width: 100%;"
Line 448: Line 547:
| <code>LoadProfile(profilename,[prompt])</code>
| <code>LoadProfile(profilename,[prompt])</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.  
| 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.  
|  
|
|-
|-
| <code>Mastermode</code>
| <code>Mastermode</code>
| Runs Kodi in master mode  
| Runs Kodi in master mode  
|  
|
|-
|-
| <code>System.LogOff</code>
| <code>System.LogOff</code>
| Log off current user.  
| Log off current user.  
|  
|
|-
|-
|}
|}
Line 470: Line 569:
| Will start a search for missing channel icons
| Will start a search for missing channel icons
| {{nowrap|v16 Addition}}
| {{nowrap|v16 Addition}}
|-
| <code>PVR.ToggleRecordPlayingChannel</code>
| Will toggle recording on playing channel, if any
|
|-
|-
| <code>PVR.SeekPercentage</code>
| <code>PVR.SeekPercentage</code>
| Performs a seek to the given percentage in timeshift buffer, if timeshifting is supported  
| Performs a seek to the given percentage in timeshift buffer, if timeshifting is supported  
|
|
|-
|-
|-
| <code>PVR.ToggleRecordPlayingChannel</code>
| <code>PVR.ToggleRecordPlayingChannel</code>
| Star recording the current channel
| Will toggle recording on playing channel, if any
| v18
| v18
 
|}
|}


Line 491: Line 589:
!  style="width: 66%"| Description
!  style="width: 66%"| Description
!  style="width: 5%"| Version
!  style="width: 5%"| Version
|-
|  <code>LoadSkin(skinId)</code>
|  Loads the skin passed as a parameter
'''Parameters'''
:[in] skinId Addon skin id of the skin.
|
|-
|-
| <code>ReloadSkin()</code>
| <code>ReloadSkin()</code>
| Reloads the current skin – useful for Skinners to use after they upload modified skin files (saves power cycling)  
| Reloads the current skin – useful for Skinners to use after they upload modified skin files (saves power cycling)  
|  
|
|-
|-
| <code>Skin.Reset(setting)</code>
| <code>Skin.Reset(setting)</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.  
| Resets the skin setting <code>(setting)</code>. If <code>(setting)</code> is a bool setting (i.e. set via SetBool or ToggleSetting) then the setting is reset to false. If <code>(setting)</code> is a string (Set via SetString, SetImage, or SetPath) then it is set to empty.  
|  
|
|-
|-
| <code>Skin.ResetSettings</code>
| <code>Skin.ResetSettings</code>
| Resets all the above skin settings to their defaults (toggles all set to false, strings all set to empty.)  
| Resets all the above skin settings to their defaults (toggles all set to false, strings all set to empty.)  
|  
|
|-
|-
| <code>Skin.SelectBool(header, label1&#124;setting1, label2&#124;setting2)</code>
| <code>Skin.SelectBool(header, label1&#124;setting1, label2&#124;setting2)</code>
| Pops up select dialog to select between multiple skin setting options. Skin.SelectBool(424, 31411&#124;RecentWidget, 31412&#124;RandomWidget, 31413&#124;InProgressWidget)
| Pops up select dialog to select between multiple skin setting options. Skin.SelectBool(424, 31411&#124;RecentWidget, 31412&#124;RandomWidget, 31413&#124;InProgressWidget)
|  
|
|-
|-
| <code>Skin.SetAddon(string,type)</code>
| <code>Skin.SetAddon(string,type)</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, xbmc.addon.executable and kodi.gameclient.  
| 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.  
|  
|
|-
|-
| <code>Skin.SetBool(setting)</code>
| <code>Skin.SetBool(setting)</code>
| 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.  
| Sets the skin setting <code>(setting)</code> 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.
|  
|
|-
|  <code>Skin.SetColor(string,header[,colorfile,selectedcolor])</code>
|  Pops up a color selection dialog and allows the user to select a color to be used to define the color of a label control or as a colordiffuse value for a texture elsewhere in the skin via the info tag <code>Skin.String(string)</code>. Skinners can optionally set the color that needs to be preselected in the dialog by specifying the hex value of this color. Also optionally, skinners can include their own color definition file. If not specified, the default colorfile included with Kodi will be used.
'''Parameters'''
:[in] string Name of skin setting.
:[in] string Dialog header text.
:[in] string Hex value of the color to preselect (optional), example: FF00FF00.
:[in] string Filepath of the color definition file (optional).
'''Parameters'''
:[in] numeric Name of skin setting.
:[in] value Value of skin setting (optional).
|
|-
|-
| <code>Skin.SetFile(string,mask,folderpath)</code>
| <code>Skin.SetFile(string,mask,folderpath)</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 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.  
| 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.  
|  
|
|-
|-
| <code>Skin.SetImage(string[,value,path])</code>
| <code>Skin.SetImage(string[,value,path])</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 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.  
| 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.  
|  
|
|-
|-
| <code>Skin.SetNumeric(numeric[,value])</code>
| <code>Skin.SetNumeric(numeric[,value])</code>
| Pops up a keyboard dialog and allows the user to input a numerical.  
| Pops up a keyboard dialog and allows the user to input a numerical.  
|  
|
|-
|-
| <code>Skin.SetPath(string[,folderpath])</code>
| <code>Skin.SetPath(string[,folderpath])</code>
| 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.  
| 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.  
|  
|
|-
|-
| <code>Skin.SetString(string[,value])</code>
| <code>Skin.SetString(string[,value])</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 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.  
| 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.  
|  
|
|-
|-
| <code>Skin.Theme(1)</code>
| <code>Skin.Theme(1)</code>
| Cycles the skin theme. Skin.Theme(-1) will go backwards.  
| Cycles the skin theme. Skin.Theme(-1) will go backwards.  
|  
|
|-
|  <code>Skin.TimerStart(timer)</code>
|  Starts the timer with name <code>timer</code>
'''Parameters'''
:[in] timer The name of the timer
'''Parameters'''
:[in] timer The name of the timer
|
|-
|-
| <code>Skin.ToggleDebug</code>
| <code>Skin.ToggleDebug</code>
| Toggles skin debug info on/off  
| Toggles skin debug info on/off  
|  
|
|-
|-
| <code>Skin.ToggleSetting(setting)</code>
| <code>Skin.ToggleSetting(setting)</code>
| Toggles the skin setting ?setting? for use with conditional visibility tags containing Skin.HasSetting(setting).  
| Toggles the skin setting <code>(setting)</code> for use with conditional visibility tags containing Skin.HasSetting(setting).  
|  
|
|-
|-
| <code>UnloadSkin()</code>
| <code>UnloadSkin()</code>
| Unloads the current skin  
| Unloads the current skin  
|  
|
|-
|}
|}


Line 567: Line 690:
| <code>Hibernate</code>
| <code>Hibernate</code>
| Hibernate (S4) the System  
| Hibernate (S4) the System  
|  
|
|-
|-
| <code>InhibitIdleShutdown(true/false)</code>
| <code>InhibitIdleShutdown(true/false)</code>
| Prevent the system to shutdown on idle.
| Prevent the system to shutdown on idle.
| {{nowrap|v12 Addition}}
| {{nowrap|v12 Addition}}
|-
| <code>InhibitScreensaver(true/false)</code>
| Prevent activation of the screensaver.
| {{nowrap|v19 Addition}}
|-
|-
| <code>Minimize</code>
| <code>Minimize</code>
| Minimizes Kodi  
| Minimizes Kodi  
|  
|
|-
|-
| <code>Powerdown</code>
| <code>Powerdown</code>
| Powerdown system  
| Powerdown system  
|  
|
|-
|-
| <code>Quit</code>
| <code>Quit</code>
| Quits Kodi  
| Quits Kodi  
|  
|
|-
|-
| <code>Reboot</code>
| <code>Reboot</code>
| Cold reboots the system (power cycle)  
| Cold reboots the system (power cycle)  
|  
|
|-
|-
| <code>Reset</code>
| <code>Reset</code>
| Reset the system (same as reboot)  
| Reset the system (same as reboot)  
|  
|
|-
|  <code>Restart</code>
|  Restart the system (same as reboot)
|
|-
|-
| <code>RestartApp</code>
| <code>RestartApp</code>
| Restarts Kodi (only implemented under Windows and Linux)  
| Restarts Kodi (only implemented under Windows and Linux)  
|  
|
|-
|-
| <code>ShutDown</code>
| <code>ShutDown</code>
| Trigger default Shutdown action defined in System Settings  
| Trigger default Shutdown action defined in System Settings  
|  
|
|-
|-
| <code>Suspend</code>
| <code>Suspend</code>
| Suspends (S3 / S1 depending on bios setting) the System  
| Suspends (S3 / S1 depending on bios setting) the System  
|  
|
|-
|-
| <code>System.Exec(exec)</code>
| <code>System.Exec(exec)</code>
| Execute shell commands. The full path to the script has to be placed inside the parentheses.
| Execute shell commands. The full path to the script has to be placed inside the parentheses.
|  
|
|-
|-
| <code>System.ExecWait(exec)</code>
| <code>System.ExecWait(exec)</code>
| 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.
| 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.
|  
|
|-
|}
|}


=== Weather built-in's ===
=== Weather built-in's ===
{| class="prettytable sort sortable" style="width: 100%;"
{| class="prettytable sort sortable" style="width: 100%;"
!  style="width: 29%"| Function
!  style="width: 29%"| Function
Line 624: Line 753:
| <code>Weather.LocationNext</code>
| <code>Weather.LocationNext</code>
| Switch to next weather location  
| Switch to next weather location  
|  
|
|-
|-
| <code>Weather.LocationPrevious</code>
| <code>Weather.LocationPrevious</code>
| Switch to previous weather location  
| Switch to previous weather location  
|  
|
|-
|-
| <code>Weather.LocationSet</code>
| <code>Weather.LocationSet</code>
| Switch to given weather location (parameter can be 1-3)  
| Switch to given weather location (parameter can be 1-3)  
|  
|
|-
|-
| <code>Weather.Refresh</code>
| <code>Weather.Refresh</code>
| Force weather data refresh
| Force weather data refresh
|  
|
|}
|}
<section end="functions" />
<section end="functions" />
<section end="main content" />
<section end="main content" />


Line 659: Line 789:


== List of sort methods ==
== List of sort methods ==
These ID's can be used with the Container.SetSortMethod(id) function as listed [https://github.com/xbmc/xbmc/blob/master/xbmc/utils/SortUtils.cpp#L529-L577 here]:
These ID's can be used with the Container.SetSortMethod(id) function.
 
The underlying mapping is defined in the Kodi C++ source file https://github.com/xbmc/xbmc/blob/master/xbmc/utils/SortUtils.h#L55-L180.
 
{| class="prettytable"
{| class="prettytable"
! ID
! ID
Line 819: Line 952:
| <code>52</code>
| <code>52</code>
| LastUsed
| LastUsed
|-
| <code>53</code>
| ClientChannelOrder
|-
| <code>54</code>
| TotalDiscs
|-
| <code>55</code>
| OriginalDate
|-
| <code>56</code>
| BPM
|-
| <code>57</code>
| OriginalTitle
|-
| <code>58</code>
| Provider
|-
| <code>59</code>
| UserPreference
|}
|}
{{updated|18}}


== See also ==
== See also ==
* [[Action IDs]]
* [[Action IDs]]
== References ==
<references />
{{updated|20}}


[[Category:Python]]
[[Category:Python]]
[[Category:Add-on development]]
[[Category:Add-on development]]
[[Category:Skin development]]
[[Category:Skin development]]

Latest revision as of 14:57, 22 June 2026

  ▶ 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:


List of functions


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.

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

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).

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

EPG built-in's

Function Description Version
PVR.EpgGridControl(command) supported commands: firstprogramme (jump to the first programme) / currentprogramme (jump to the current programme) / lastprogramme (jump to the last programme) / selectdate (jump to the selected date & time) / +XX (jump XX hours forward) / -XX (jump XX hours back) / firstchannel (jump to the first channel) / playingchannel (jump to the currently playing channel) / lastchannel (jump to the last channel) / previousgroup (switch the epg to the previous group) / nextgroup (switch the epg to the next group) / selectgroup (select a group) v19 Addition

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. If defining the last optional parameters (silent and loop) both have to be defined for any to take effect. The parameter "time" accepts an integer value (in minutes) or a timestring in the format "hh:mm:ss" or "mm min".
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

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.SetSortDirection Toggle the sort direction.
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.SortDirection Toggle the sort direction
Container.Update Update current listing. Send Container.Update(path,replace) to reset the path history.

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)
Control.SetVisible(controlId) Set the control id to visible

Parameters

[in] controlId ID of control.

Parameters

[in] controlId ID of control.

Parameters

[in] controlId ID of control.
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)

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).
ExportLibrary2(library, exportFiletype, path [, unscraped][, overwrite][, artwork][, skipnfo] / [, albums][, albumartists][, songartists][, otherartists][, actorthumbs]) Export the video/music library with extended parameters

Parameters

[in] library "video" or "music".
[in] exportFiletype "singlefile", "separate" or "library".
[in] path Path to destination folder.
[in] unscraped Add "unscraped" to include unscraped items.
[in] overwrite Add "overwrite" to overwrite existing files.
[in] artwork Add "artwork" to include images such as thumbs and fanart.
[in] skipnfo Add "skipnfo" to not include nfo files(just art).
[in] albums Add "ablums" to include albums.
[in] albumartists Add "albumartists" to include album artists.
[in] songartists Add "songartists" to include song artists.
[in] otherartists Add "otherartists" to include other artists.
[in] actorthumbs Add "actorthumbs" to include other actor thumbs.
MusicLibrary.RefreshAlbum([albumId\]) Rescrapes additional information for a given album

Parameters

[in] albumId Album Id.
MusicLibrary.RefreshArtist([artistId\]) Rescrapes additional information for a given artist

Parameters

[in] artistId Artist Id.
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

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.

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.

Player built-in's

Function Description Version
PlayDisc(param) Will play the inserted CD or DVD media from the DVD-ROM drive.
PlayDVD(param) (deprecated) Plays the inserted disc, like CD, DVD or Blu-ray, in the disc drive.

Parameters

[in] param "restart" to restart from resume point (optional)
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, Tempo(value), 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(mediaPath[,isdir][,1][,playoffset=xx][,resume][,noresume][,playlist_type_hint=x]) 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.

Note: Following parameters are available from Kodi v20. If media is a playlist (e.g. STRM), you can set the type of playlist with "playlist_type_hint=x" where x can be 0 for music playlist or 1 for video playlist, if not set will be used music playlist.

PlaysDisc(parm)  
PlayWith() Play the selected item with the specified player core.
QueueMedia(media[,isdir][,1][,playnext],[playoffset=xx]) Queues the given media. This can be a playlist, music, or video file, directory, plugin, disc image stack, video file stack or an 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 or a disc image stack or a video file stack, you can use playoffset=xx where xx is the position to start playback from. where xx is the position to start playback from.

Parameters

[in] media URL of media to queue.
[in] isdir Set isdir if media is a directory (optional).
[in] 1 Set 1 to start playback without switching to fullscreen (optional).
[in] resume Set resume to force resuming (optional).
[in] noresume Set noresume to force not resuming (optional).
[in] playoffset Set playoffset=<offset> to start playback from a given position in a playlist or stack (optional).
[in] playnext Set playnext to play the media right after the currently playing item, if player is currently playing. If player is not playing, append media to current playlist (optional).
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
QueueMedia() [1] Queues the given 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 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.
  • @param[in] media URL of media to queue.
  • @param[in] isdir Set "isdir" if media is a directory (optional).
  • @param[in] 1 Set "1" to start playback without switching to fullscreen (optional).
  • @param[in] resume Set "resume" to force resuming (optional).
  • @param[in] noresume Set "noresume" to force not resuming (optional).
  • @param[in] playeroffset Set "playoffset=<offset>" to start playback from a given position in a playlist (optional).
  • @param[in] playnext Set "playnext" to play the media right after the currently playing item, if player is currently playing. If player is not playing, append media to current playlist (optional).

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.

PVR built-in's

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



Skin built-in's

Function Description Version
LoadSkin(skinId) Loads the skin passed as a parameter

Parameters

[in] skinId Addon skin id of the skin.
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.SetColor(string,header[,colorfile,selectedcolor]) Pops up a color selection dialog and allows the user to select a color to be used to define the color of a label control or as a colordiffuse value for a texture elsewhere in the skin via the info tag Skin.String(string). Skinners can optionally set the color that needs to be preselected in the dialog by specifying the hex value of this color. Also optionally, skinners can include their own color definition file. If not specified, the default colorfile included with Kodi will be used.

Parameters

[in] string Name of skin setting.
[in] string Dialog header text.
[in] string Hex value of the color to preselect (optional), example: FF00FF00.
[in] string Filepath of the color definition file (optional).

Parameters

[in] numeric Name of skin setting.
[in] value Value of skin setting (optional).
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.TimerStart(timer) Starts the timer with name timer

Parameters

[in] timer The name of the timer

Parameters

[in] timer The name of the timer
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

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
InhibitScreensaver(true/false) Prevent activation of the screensaver. v19 Addition
Minimize Minimizes Kodi
Powerdown Powerdown system
Quit Quits Kodi
Reboot Cold reboots the system (power cycle)
Reset Reset the system (same as reboot)
Restart Restart 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.

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



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


List of sort methods

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

The underlying mapping is defined in the Kodi C++ source file https://github.com/xbmc/xbmc/blob/master/xbmc/utils/SortUtils.h#L55-L180.

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
53 ClientChannelOrder
54 TotalDiscs
55 OriginalDate
56 BPM
57 OriginalTitle
58 Provider
59 UserPreference

See also


References