Window IDs and Archive:Web Server HTTP API: Difference between pages

From Official Kodi Wiki
(Difference between pages)
Jump to navigation Jump to search
>Smokehead
mNo edit summary
 
>Nad
 
Line 1: Line 1:
This table cross-references Window names, Window definitions, Window ID, and the delta Window ID's (this is the delta from the home window.)  The code that performs the cross-reference is found in [http://cvs.sourceforge.net/viewcvs.py/xbmc/XBMC/xbmc/ButtonTranslator.cpp?view=markup ButtonTranslator.cpp].
==HTTPAPI DOC==


*keymap.xml uses the Window name.
This document provides information on XBMC’s Application Programming Interface (API). The API operates over the HyperText Transfer Protocol and hence is called the HTTPAPI.
*XBMC's C++ code uses the Window definitions and Window ID's.
*skin .xml files use the Delta Window ID's
*XBMC.ActivateWindow() can use either the Window name, the Window ID, or the delta Window ID.<br><br>


{| class="usertable" border="1"
The same set of commands is also available over ASP and from Python (see later section).
|- class="userrow"
 
| class="usercell" |
Apart from where indicated by a date indicating when a command was added/modified this documentation describes what's available in XBMC 2.0.0.
<div class="indent">'''NAME''' </div>
 
| class="usercell" |
===Getting started===
<div class="indent">'''DEFINITION''' </div>
 
| class="usercell" |
The XBMC HTTP API provides a mechanism for a networked device (e.g. a PC or a PDA with WiFi) to interact with XBMC. The API provides access to XBMC status information and control of XBMC functions.
<div class="indent">'''WINDOW ID''' </div>
 
| class="usercell" |
The API can be called from and results displayed in a standard web browser which is probably the easiest way to experiment with these commands. Fire up your browser and enter the following into the address field:
<div class="indent">'''DELTA WINDOW ID''' </div>
 
| class="usercell" |
<pre><nowiki>
<div class="indent">'''SOURCE XML FILE''' </div>
http://xbox/xbmcCmds/xbmcHttp?command=getcurrentlyplaying
|- class="userrow"
</nowiki></pre>
| class="usercell" |
 
<div class="indent">home </div>
Information about the media currently being played by XBMC will be displayed, if nothing is being played then "[Nothing Playing]" will be displayed.
| class="usercell" |
 
<div class="indent">WINDOW_HOME </div>
If you want to control the volume of XBMC enter the following into your browser’s address field:
| class="usercell" |
 
<div class="indent">10000 </div>
<pre><nowiki>
| class="usercell" |
http://xbox/xbmcCmds/xbmcHttp?command=setvolume&parameter=80
<div class="indent">0 </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">Home.xml</div>
"OK" will be displayed and the volume will be set to 80% which you will probably find is rather quiet.
|- class="userrow"
 
| class="usercell" |
If you find that the above commands don’t work then check that:
<div class="indent">myprograms </div>
 
| class="usercell" |
* The address "xbox" is understood by your browser to point to your Xbox’s address. You may need to enter the full IP address e.g. 192.168.0.1
<div class="indent">WINDOW_PROGRAMS </div>
* The XBMC web server has been turned on. This setting can be found in Settings, Network, Server.
| class="usercell" |
* You didn’t mistype the command.
<div class="indent">10001 </div>
 
| class="usercell" |
 
<div class="indent">1 </div>
Note: If you are a Windows user, you can configure a name for your Xbox's IP address.
| class="usercell" |
Edit with your favorite text editor the file “hosts” inside C:\WINDOWS\system32\drivers\etc\ and add a line at the end with your xbox ip address.
<div class="indent">MyPrograms.xml</div>
 
|- class="userrow"
<pre><nowiki>
| class="usercell" |
192.168.0.1 xbox
<div class="indent">mypictures </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">WINDOW_PICTURES </div>
Save it (don't need to restart) and test if the command “ping xbox” works. You should now resolve your Xbox IP address
| class="usercell" |
 
<div class="indent">10002 </div>
If you still can’t get them working, try:
| class="usercell" |
 
<div class="indent">2 </div>
<pre><nowiki>
| class="usercell" |
http://xbox
<div class="indent">MyPics.xml</div>
</nowiki></pre>
|- class="userrow"
 
| class="usercell" |
This should display the default XBMC web page. If this does not work then check out other XBMC documentation on the web server and come back when it is working.
<div class="indent">myfiles </div>
 
| class="usercell" |
Once you have the above working we can look at the structure of the http command line.
<div class="indent">WINDOW_FILES </div>
 
| class="usercell" |
All API commands start with the following:
<div class="indent">10003 </div>
 
| class="usercell" |
<pre><nowiki>
<div class="indent">3 </div>
http://xbox/xbmcCmds/xbmcHttp?command=
| class="usercell" |
</nowiki></pre>
<div class="indent">FileManager.xml</div>
 
|- class="userrow"
(Remember you may need to swap “xbox” for the IP address.)
| class="usercell" |
 
<div class="indent">settings </div>
The next part of the line is the command itself, which in the two examples above are "getCurrentlyPlaying" and "setVolume". The command is not case sensitive: "SetVolume", "setvolume" and "SETVOLUME" can also be used.
| class="usercell" |
 
<div class="indent">WINDOW_SETTINGS_MENU </div>
If the command takes parameters then "&parameter=" is added after the command.
| class="usercell" |
 
<div class="indent">10004 </div>
Finally comes the parameter values. If there are multiple parameters then each value is separated by a semi-colon ";". The following is an example of a command with 4 parameters.
| class="usercell" |
 
<div class="indent">4 </div>
<pre><nowiki>
| class="usercell" |
http://xbox/xbmcCmds/xbmcHttp?command=takescreenshot&parameter=test.jpg;300;200;90
<div class="indent">Settings.xml </div>
</nowiki></pre>
|- class="userrow"
 
| class="usercell" |
To pass a semi-colon as a parameter (rather than a seperator) use two semi-colons ";;".
<div class="indent">mymusic </div>
 
| class="usercell" |
To pass an empty paramter insert a space between the semi-colons "; ;".
<div class="indent">WINDOW_MUSIC </div>
 
| class="usercell" |
To pass an empty parameter as the last (right most) parameter use "%20" (if just a space is appended to the end, the browser will remove it and xbmc will not detect the final parameter).
<div class="indent">10005 </div>
 
| class="usercell" |
As of 18th Nov 2006 a more usual function calling syntax is also available. Instead of using the "&parameter" syntax to specify parameters the parameters can be enclosed within brackets. Note that the parameters must still be separated by semic-colons. The above example takescreenshot command would be presented in the new syntax as:
<div class="indent">5 </div>
 
| class="usercell" |
<pre><nowiki>
<div class="indent">None – this is just a wrapper for the current My Music view (who's IDs are 501 and 502) </div>
http://xbox/xbmcCmds/xbmcHttp?command=takescreenshot(test.jpg;300;200;90)
|- class="userrow"
</nowiki></pre>
| class="usercell" |
 
<div class="indent">myvideo </div>
The rest of this document uses the original "&parameter" syntax which of course is still supported.
| class="usercell" |
 
<div class="indent">WINDOW_VIDEOS </div>
===Response Structure===
| class="usercell" |
 
<div class="indent">10006 </div>
The API returns information in a consistent form but which is dependent on the type of information returned. Those commands which:
| class="usercell" |
 
<div class="indent">6 </div>
* don’t return a value e.g. SetVolume return the standard response OK
| class="usercell" |
* return a single value e.g. GetVolume return just the value
<div class="indent">None – this is just a wrapper for the current My Video view (who's IDs are 21-25)  </div>
* return multiple values e.g. GetCurrentlyPlaying return multiple lines with each line having the format
|- class="userrow"
** name:value
| class="usercell" |
 
<div class="indent">systeminfo </div>
An error in the execution of a command, for example a missing parameter, is indicated by the response:
| class="usercell" |
 
<div class="indent">WINDOW_SYSTEM_INFORMATION </div>
<pre><nowiki>
| class="usercell" |
Error[:Reason]
<div class="indent">10007 </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">7 </div>
i.e. all errors are indicated by returning "Error" and depending on the error there may be additional information provided.
| class="usercell" |
 
<div class="indent">SettingsSystemInfo.xml </div>
e.g.
|- class="userrow"
<pre><nowiki>
| class="usercell" |
Error:Missing parameter
<div class="indent">guicalibration </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">WINDOW_UI_CALIBRATION </div>
The following is the default response format. To change the format see the command SetResponseFormat.
| class="usercell" |
 
<div class="indent">10010 </div>
Every line in the response is prefixed by the HTML tag <nowiki><li></nowiki>. The only exception to this is the GetThumb command where a prefix is not included. The use of this prefix means that the responses are displayed clearly within a browser but the <nowiki><li></nowiki> tag does not require a corresponding close tag i.e. <nowiki></li></nowiki> is not required.
| class="usercell" |
 
<div class="indent">10 </div>
Finally, and to create a valid HTML response, the whole response is top and tailed with the web server’s default header and footer.
| class="usercell" |
 
<div class="indent">SettingsUICalibration.xml </div>
 
|- class="userrow"
===Sample Code===
| class="usercell" |
 
<div class="indent">screencalibration </div>
Probably the easiest way to get up to speed with a new API is to have a look at code. Several of the applications that can be found here: [http://sourceforge.net/project/showfiles.php?group_id=87054&package_id=198866 HTTPAPI client apps] come with source code. In particular look for the file XBMCHttpInterface.vb which wraps up the majority of the HTTP API within a .Net class. The file can be found within the package XBMCControl. There are also examples that show how to call the HTTP API from an Excel spreadsheet and from Visual Basic 6.
| class="usercell" |
 
<div class="indent">WINDOW_MOVIE_CALIBRATION </div>
==ASP==
| class="usercell" |
 
<div class="indent">10011 </div>
The commands are also available as ASP commands using the command "xbmcAPI" just as the current "xbmcCommand" works now (see default.asp in the XBMC web directory). All xbmcAPI commands have an identical name and the same parameters as the commands listed in the document. The response structure is also identical apart from the web server’s default header and footer which will not be present.
| class="usercell" |
 
<div class="indent">11 </div>
e.g.
| class="usercell" |
<pre><nowiki>
<div class="indent">SettingsScreenCalibration.xml </div>
Response = xbmcAPI("GetCurrentlyPlaying");
|- class="userrow"
</nowiki></pre>
| class="usercell" |
 
<div class="indent">mypicturessettings </div>
 
| class="usercell" |
==Python==
<div class="indent">WINDOW_SETTINGS_MYPICTURES </div>
 
| class="usercell" |
The commands are also callable from Python scripts through the function executehttpapi imported from the xbmc module. All xbmcAPI commands have an identical name and the same parameters as the commands listed in the document. The response structure is also identical apart from the web server’s default header and footer which will not be present.
<div class="indent">10012 </div>
 
| class="usercell" |
e.g.
<div class="indent">12 </div>
 
| class="usercell" |
<pre><nowiki>
<div class="indent">SettingsCategory.xml </div>
import xbmc
|- class="userrow"
 
| class="usercell" |
response = xbmc.executehttpapi("TakeScreenShot(q:\\test.jpg,0,false,200,-1,90)")
<div class="indent">myprogramssettings </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">WINDOW_SETTINGS_MYPROGRAMS </div>
==Broadcast==
| class="usercell" |
 
<div class="indent">10013 </div>
Added 18th Nov 2006
| class="usercell" |
 
<div class="indent">13 </div>
The Broadcast functionality is not strictly speaking part of the HttpApi in that it does not use the HTTP protocol. However, it is controlled via HttpApi commands and would typically be used as an adjunct to the HttpApi and so is presented here.
| class="usercell" |
 
<div class="indent"> SettingsCategory.xml </div>
The HttpApi is a “pull” architecture – HttpApi interacts with XBMC by making calls to XBMC. For an HttpApi client to maintain a dynamic up-to-date display, e.g. of the currently playing song, the client needs to continually poll XBMC for its status.
|- class="userrow"
 
| class="usercell" |
The Broadcast facility provides the opposite approach – XBMC makes calls out (i.e. broadcasts or "pushes") indicating significant events to anything that just happens to be listening.
<div class="indent">myweathersettings </div>
 
| class="usercell" |
The Broadcast facility uses the UDP broadcast protocol with a default port setting of 8278. (8278 was chosen for no other reason than it was the first unregistered port that I stumbled across.) For a client to receive these broadcasts, the client must register to receive the broadcasts (the method of doing so will depend on the language/technology of the client). XBMC broadcasts on the IP address 255.255.255.255 which is the limited broadcast address. Sending a UDP datagram to this address delivers the message to any host on that broadcast network. Because routers never forward messages sent to this address, only hosts on the connected network see these broadcasts, i.e. the client will need to be on the local network to receive the broadcasts.
<div class="indent">WINDOW_SETTINGS_MYWEATHER </div>
 
| class="usercell" |
The actual broadcasts are delimited by <nowiki><b></b></nowiki> and may consist of a numerical or textual description of the event (depening on the event) followed by ";" and the level of the event (e.g. 1 or 2).
<div class="indent">10014 </div>
 
| class="usercell" |
An example Windows client (with source code), XBMC Listener, that listens to these broadcasts can be found [http://sourceforge.net/project/showfiles.php?group_id=87054&package_id=198866 here]
<div class="indent">14 </div>
 
| class="usercell" |
==The Commands==
<div class="indent"> SettingsCategory.xml </div>
 
|- class="userrow"
This section presents a complete list of HTTP API commands. In the list, after the command name is presented, the text between the parentheses is the list of semi-colon separated parameters for the command.  
| class="usercell" |
 
<div class="indent">mymusicsettings </div>
Remember to use the syntax:
| class="usercell" |
 
<div class="indent">WINDOW_SETTINGS_MYMUSIC </div>
<pre><nowiki>
| class="usercell" |
http://xbox/xbmcCmds/xbmcHttp?command=setvolume&parameter=80
<div class="indent">10015 </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">15 </div>
and not
| class="usercell" |
 
<div class="indent"> SettingsCategory.xml </div>
<pre><nowiki>
|- class="userrow"
http://xbox/xbmcCmds/xbmcHttp?command=setvolume(80)
| class="usercell" |
</nowiki></pre>
<div class="indent">systemsettings </div>
 
| class="usercell" |
 
<div class="indent">WINDOW_SETTINGS_SYSTEM </div>
A parameter in square brackets is optional. An optional parameter typically specifies an alternative to a default value.
| class="usercell" |
 
<div class="indent">10016 </div>
In the following list the Playlist parameter identifies one of the four available playlists by using the values 0..3:
| class="usercell" |
 
<div class="indent">16 </div>
<pre><nowiki>
| class="usercell" |
0. Music playlist
<div class="indent">SettingsCategory.xml </div>
1. Temporary music playlist
|- class="userrow"
2. Video playlist
| class="usercell" |
3. Temporary video playlist
<div class="indent">myvideossettings </div>
</nowiki></pre>
| class="usercell" |
 
<div class="indent">WINDOW_SETTINGS_MYVIDEOS </div>
As of 26 Nov 2006 the available playlists and identifiers have changed to:
| class="usercell" |
 
<div class="indent">10017 </div>
<pre><nowiki>
| class="usercell" |
0. Music playlist
<div class="indent">17 </div>
1. Video playlist
| class="usercell" |
</nowiki></pre>
<div class="indent"> SettingsCategory.xml </div>
 
|- class="userrow"
 
| class="usercell" |
These playlists should not be confused with:
<div class="indent">networksettings </div>
 
| class="usercell" |
The slideshow playlist. The slideshow commands implicitly refer to the latter.
<div class="indent">WINDOW_SETTINGS_NETWORK </div>
Playlist files e.g m3u files.
| class="usercell" |
 
<div class="indent">10018 </div>
 
| class="usercell" |
The commands are presented in five sections. Those commands that:
<div class="indent">18 </div>
 
| class="usercell" |
* retrieve information
<div class="indent"> SettingsCategory.xml </div>
* set/modify information
|- class="userrow"
* perform/initiate an action
| class="usercell" |
* perform an action on a file
<div class="indent">appearancesettings </div>
* don’t fit into one of the above and hence are miscellaneous
| class="usercell" |
* HTTPAPI commands and examples
<div class="indent">WINDOW_SETTINGS_APPEARANCE </div>
 
| class="usercell" |
 
<div class="indent">10019 </div>
Assuming you have XBMC running and configured appropriately, clicking on the example link should load the link in your browser window. Then edit the link (if necessary): changing ''xbox'' to your Xbox IP (e.g. 192.168.1.101). As an example:
| class="usercell" |
<div class="indent">19 </div>
http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying -> http://192.168.1.101/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying
| class="usercell" |
 
<div class="indent">SettingsCategory.xml </div>
However, the most straightforward approach is to add xbox to your hosts file as described in the Getting Started section, after which you would not need to substiture your Xbox IP for ''xbox''.
|- class="userrow"
 
| class="usercell" |
Some of the examples will work straight off, others, which for example refer to a specific file, will need you to manually modify the link to appropriate values for your environment.
<div class="indent">scripts </div>
 
| class="usercell" |
'%20' is used in some of the examples which is just an alternative way of indicating a space (' '). The reason for using %20 is just to ensure that the document formatting keeps the entire http:// string as one object. If you are typing the command in manually or using it from your own code then you can either use %20 or a space.
<div class="indent">WINDOW_SCRIPTS </div>
 
| class="usercell" |
 
<div class="indent">10020 </div>
===Retrieving information commands===
| class="usercell" |
 
<div class="indent">20 </div>
<center>
| class="usercell" |
{| border="1" cellpadding="5"
<div class="indent">MyScripts.xml </div>
!width="10%"|Command
|- class="userrow"
!width="60%"|Information
| class="usercell" |
!width="30%"|Example
<div class="indent">myvideogenres </div>
|-
| class="usercell" |
| GetMediaLocation(type; [path]; [option])
<div class="indent">WINDOW_VIDEO_GENRE </div>
| ''Type'' is one of music, video, pictures, files.
| class="usercell" |
 
<div class="indent">10021 </div>
''path'' is the path.
| class="usercell" |
 
<div class="indent">21 </div>
''option'' is one of pathsonly, showdate
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetMediaLocation&parameter=files;f:\;pathsonly
<div class="indent">MyVideoGenre.xml </div>
|-  
|- class="userrow"
| GetShares(type; [option])
| class="usercell" |
| ''Type'' is one of music, video, pictures, files.
<div class="indent">myvideoactors </div>
 
| class="usercell" |
''option'' is one of pathsonly, appendone
<div class="indent">WINDOW_VIDEO_ACTOR </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetShares&parameter=music
| class="usercell" |
|-
<div class="indent">10022 </div>
| GetCurrentPlaylist
| class="usercell" |
| Retrieves the current playlist identifier.
<div class="indent">22 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentPlaylist
| class="usercell" |
|-
<div class="indent">MyVideoActors.xml </div>
| GetCurrentlyPlaying
|- class="userrow"
| Retrieves the filename, details and status of the currently playing media.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying
<div class="indent">myvideoyears </div>
|-  
| class="usercell" |
| GetCurrentSlide
<div class="indent">WINDOW_VIDEO_YEAR </div>
| Retrieves the file name of the image currently being displayed.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentSlide
<div class="indent">10023 </div>
|-
| class="usercell" |
| GetDirectory(directory;[mask];[option])
<div class="indent">23 </div>
| Retrieves the contents of the directory specified by directory. If the option parameter = 1 then file modified dates will be appended. The mask parameter can take the following form: .mp3 returns just the matching files "*" return just folders all files and folders.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetDirectory&parameter=F:\music\;.mp3;1
<div class="indent">MyVideoYear.xml </div>
|-
|- class="userrow"
| GetGuiDescription
| class="usercell" |
| Retrieves various GUI values. (Currently just the screen resolution)
<div class="indent">myvideotitles </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetGUIDescription
| class="usercell" |
|-  
<div class="indent">WINDOW_VIDEO_TITLE </div>
| GetGuiSetting(type; name)
| class="usercell" |
| Retrieves the value of GUI setting name. ''type'' specifies whether the setting is of type integer (0), boolean (1) or float (2) which must be set correctly or could cause a crash. ''name'' is the name of the setting to get the value of. For a list of setting names see GUISettings.cpp.
<div class="indent">10025 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=getguisetting&parameter=0;system.shutdowntime
| class="usercell" |
|-
<div class="indent">25 </div>
| GetPercentage
| class="usercell" |
| Retrieves the current playing position of the currently playing media as a percentage of the media’s length.
<div class="indent">MyVideoTitle.xml </div>
| http://xbox/xbmcCmds/xbmcHttp?command=getpercentage
|- class="userrow"
|-
| class="usercell" |
| GetPlaylistContents([playlist])
<div class="indent">myvideofiles </div>
| Retrieves the contents (file names) of the current playlist or the playlist specified by ''playlist''. Playlist takes one of the following values: 0 – Music playlist, 1 – Temporary music playlist, 2 – Video playlist, 3 – Temporary video playlist. (Since 26 Nov 2006: 0 - Music playlist, 1 - Video playlist)
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetPlaylistContents&parameter=1
<div class="indent">WINDOW_VIDEO_FILES </div>
|-
| class="usercell" |
| GetPlaylistLength([playlist])
<div class="indent">10024 </div>
| Retrieves the length of the current playlist or the playlist specified by ''playlist''. [Added 27 Feb 07.]
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetPlaylistLength&parameter=0
<div class="indent">24 </div>
|-
| class="usercell" |
| GetPlaylistSong([position])
<div class="indent">MyVideos.xml </div>
| Retrieves the currently playing song number in the playlist. If the optional parameter ''position'' is provided the command will return the file name of the media at location ''position'' in the playlist.
|- class="userrow"
| http://xbox/xbmcCmds/xbmcHttp?command=GetPlaylistSong
| class="usercell" |
|-  
<div class="indent">myvideoplaylist </div>
| GetPlaySpeed
| class="usercell" |
| Retrieves the current playing speed.
<div class="indent">WINDOW_VIDEO_PLAYLIST </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetPlaySpeed
| class="usercell" |
|-
<div class="indent">10028 </div>
| GetMusicLabel(item)
| class="usercell" |
| Retrieves audio information relating to the currently playing media. The specific information to retrieve is specied by ''info'' which is an integer corresponding to one of the MUSICPLAYER_* constants that can be found in GUIInfoManager.h The example retrieves the codec currently being used. [Added  4 Nov 07.]
<div class="indent">28 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetMusicLabel&parameter=217
| class="usercell" |
|-
<div class="indent">MyVideoPlaylist.xml </div>
| GetVideoLabel(item)
|- class="userrow"
| Retrieves video information relating to the currently playing media. The specific information to retrieve is specied by ''info'' which is an integer corresponding to one of the VIDEOPLAYER_* constants that can be found in GUIInfoManager.h The example retrieves the rating of the video currently being played. [Added  4 Nov 07.]
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetVideoLabel&parameter=270
<div class="indent">LoginScreen </div>
|-  
| class="usercell" |
| GetSlideshowContents
<div class="indent">WINDOW_LOGINSCREEN </div>
| Retrieves the contents (file names) of the slideshow playlist.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetSlideshowContents
<div class="indent">10029 </div>
|-
| class="usercell" |
| GetSystemInfo(InfoIds)
<div class="indent">29 </div>
| Retrives System Information by id number(the information on the system info page in xbmc). You can supply multipal numbers if you wish to retreive a bunch at a time. This sample will get Version of XBMC & Build Date. For a full list of Id's see GUIInfoManager.h.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetSystemInfo&parameter=120;121
<div class="indent">LogonScreen.xml </div>
|-
|- class="userrow"
| GetSystemInfoByName(InfoNames)
| class="usercell" |
| Retrives System Information by name (the information on the system info page in xbmc). You can supply multipal names if you wish to retreive a bunch at a time. Go down to the "CGUIInfoManager::TranslateSingleString" section in GUIInfoManager.cpp and you will find all the InfoNames values
<div class="indent">profiles </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetSystemInfoByName&parameter=weather.location;weather.temperature
| class="usercell" |
|-  
<div class="indent">WINDOW_SETTINGS_PROFILES </div>
| GetTagFromFilename(filename)
| class="usercell" |
| Retrieves information for the audio file ''filename''
<div class="indent">10034 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetTagFromFilename&parameter=F:\music\test.mp3
| class="usercell" |
|-
<div class="indent">34 </div>
| GetThumbFilename(album;location)
| class="usercell" |
| Retrieves the file name of the corresponding thumbnail for the music media file with file name ''album'' and path ''location''
<div class="indent">SettingsProfile.xml </div>
| http://xbox/xbmcCmds/xbmcHttp?command=GetThumbFilename&parameter=test.mp3;F:\music\
|- class="userrow"
|-
| class="usercell" |
| GetVolume
<div class="indent">yesnodialog </div>
| Retrieves the current volume setting as a percentage of the maximum possible value.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=GetVolume
<div class="indent">WINDOW_DIALOG_YES_NO </div>
|-
| class="usercell" |
| QueryMusicDatabase
<div class="indent">10100 </div>
| [Added 22 Oct 06] Provides a SQL interface to the XBMC Music Database. While this command is described in this section (Retrieving Information) it is possible to use it to modify the data base.
| class="usercell" |
WARNING: The commands that modify the data base can obviously damage and/or lose information within it; but also some of the read commands can be so complex or retrieve so much data that it can impact the operation of XBMC e.g. retrieving all songs from a reasonably large data base can bring xbmc to its knees.
<div class="indent">100 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=querymusicdatabase&parameter=select%20strArtist%20from%20artist%20order%20by%20strArtist
| class="usercell" |
 
<div class="indent">DialogYesNo.xml </div>
http://xbox/xbmcCmds/xbmcHttp?command=querymusicdatabase&parameter=select%20*%20from%20artist%20where%20strArtist%20LIKE%20'%%the%%'
|- class="userrow"
|-
| class="usercell" |
| QueryVideoDatabase
<div class="indent">progressdialog </div>
| [Added 23 Feb 07] Provides a SQL interface to the XBMC Video Database. See QueryMusicDatabase for further information.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=queryvideodatabase&parameter=select%20path.strpath%20from%20path
<div class="indent">WINDOW_DIALOG_PROGRESS </div>
 
| class="usercell" |
|}
<div class="indent">10101 </div>
</center>
| class="usercell" |
 
<div class="indent">101 </div>
===Setting commands===
| class="usercell" |
 
<div class="indent">DialogProgress.xml </div>
{| border=1 cellspacing=0 cellpadding=5
|- class="userrow"
| <strong>Command</strong>
| class="usercell" |
| <strong>Information</strong>
<div class="indent">invitedialog </div>
| <strong>Example</strong>
| class="usercell" |
|-
<div class="indent">WINDOW_DIALOG_INVITE </div>
| AddToPlayList(media;[playlist];[mask])
| class="usercell" |
| Adds a file or folder (media is either a file or a folder) to the current playlist or the playlist specified by ''playlist''. To specify a file mask use ''mask'' e.g. *.mp3.  
<div class="indent">10102 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=AddToPlayList&parameter=F:/music/test2.mp3;1 
| class="usercell" |
|-
<div class="indent">102 </div>
| AddToSlideshow(media)
| class="usercell" |
| Adds a file or folder (media is either a file or a folder) to the slideshow ''playlist''. 
<div class="indent">DialogInvite.xml </div>
| http://xbox/xbmcCmds/xbmcHttp?command=AddToSlideshow&parameter=F:\apps\xbmc\media\ 
|- class="userrow"
|-
| class="usercell" |
| ClearPlayList([playlist])
<div class="indent">virtualkeyboard </div>
| Clears the current playlist or the playlist specified by ''playlist''. 
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=ClearPlayList&parameter=
<div class="indent">WINDOW_DIALOG_KEYBOARD </div>
|-
| class="usercell" |
| ClearSlideshow
<div class="indent">10103 </div>
| Clears the slideshow playlist.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=ClearSlideshow 
<div class="indent">103 </div>
|-
| class="usercell" |
| RemoveFromPlaylist(filename,[playlist])
<div class="indent">DialogKeyboard.xml </div>
| Removes the file filename from the current playlist or from playlist ''playlist''. 
|- class="userrow"
| http://xbox/xbmcCmds/xbmcHttp?command=RemoveFromPlaylist&parameter=f:\test2.mp3,1
| class="usercell" |
|-
<div class="indent">volumebar </div>
| SeekPercentage
| class="usercell" |
| Sets the playing position of the currently playing media as a percentage of the media’s length. 
<div class="indent">WINDOW_DIALOG_VOLUME_BAR </div>
| http://xbox/xbmcCmds/xbmcHttp?command=SeekPercentage&parameter=50 
| class="usercell" |
|-
<div class="indent">10104 </div>
| SeekPercentageRelative
| class="usercell" |
| Adds/Subtracts the current percentage on to the current postion in the song 
<div class="indent">104 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=SeekPercentageRelative&parameter=-10 
| class="usercell" |
|-
<div class="indent">DialogVolumeBar.xml </div>
| SetCurrentPlaylist(playlist)
|- class="userrow"
| Sets the current playlist to ''playlist''. 
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=SetCurrentPlaylist&parameter=
<div class="indent">submenu </div>
|-
| class="usercell" |
| SetGUISetting(type; name; value)
<div class="indent">WINDOW_DIALOG_SUB_MENU </div>
| Sets the value of GUI setting name to value. ''Type'' specifies whether the setting is of type integer (0), boolean (1) or float (2) which must be set correctly or could cause a crash. For a full list of setting names see GUISettings.cpp.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=SetGUISetting&parameter=0;system.shutdowntime;10
<div class="indent">10105 </div>
|-
| class="usercell" |
| SetPlaylistSong(position)
<div class="indent">105 </div>
| Sets the media at playlist position ''position'' to be the next item to be played. The example sets the position to the 6th song in the playlist
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=SetPlaylistSong&parameter=
<div class="indent">DialogSubMenu.xml </div>
|-
|- class="userrow"
| SetPlaySpeed(speed)
| class="usercell" |
| Sets the playing speed to the integer ''speed''.
<div class="indent">contextmenu </div>
| http://xbox/xbmcCmds/xbmcHttp?command=SetPlaySpeed&parameter(speed) 
| class="usercell" |
|-
<div class="indent">WINDOW_DIALOG_CONTEXT_MENU </div>
| SlideshowSelect(filename)
| class="usercell" |
| Sets the slideshow playlist position by specifying the file name of the next image to show. 
<div class="indent">10106 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=SlideshowSelect&parameter=filename
| class="usercell" |
|-
<div class="indent">106 </div>
| SetVolume
| class="usercell" |
| Sets the volume as a percentage of the maximum possible. 
<div class="indent">DialogContextMenu.xml </div>
| http://xbox/xbmcCmds/xbmcHttp?command=SetVolume&parameter=50 
|- class="userrow"
|-
| class="usercell" |
| SetAutoGetPictureThumbs
<div class="indent">infodialog </div>
| If set to True then media thumbnails will be automatically created when required. (Default: True.)
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=SetAutoGetPictureThumbs&parameter=false 
<div class="indent">WINDOW_DIALOG_KAI_TOAST </div>
|}
| class="usercell" |
 
<div class="indent">10107 </div>
===Action commands===
| class="usercell" |
 
<div class="indent">107 </div>
{| border=1 cellspacing=0 cellpadding=5
| class="usercell" |
| <strong>Command</strong>
<div class="indent">DialogKaiToast.xml </div>
| <strong>Information</strong>
|- class="userrow"
| <strong>Example</strong>
| class="usercell" |
|-  
<div class="indent">hostdialog </div>
| Action
| class="usercell" |
| Sends a raw Action ID (see key.h) to xbmc. Be careful with this one since it runs the action on the webserver thread and depending on the action could lock the GUI thread. The example sends ACTION_MOVE_DOWN. [Added 19th June 2007]
<div class="indent">WINDOW_DIALOG_HOST </div>
| http://xbox/xbmcCmds/xbmcHttp?command=Action&parameter=4
| class="usercell" |
|-
<div class="indent">10108 </div>
| Exit
| class="usercell" |
| Reboots to dashboard
<div class="indent">108 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=Exit 
| class="usercell" |
|-
<div class="indent">DialogHost.xml </div>
| Move(deltaX, deltaY)
|- class="userrow"
| Moves the currently displayed and ZOOMed (see zoom command below) image by the distance specified by deltaX and deltaY. The zoom magnification must be greater than 0 or the command has no effect.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=Move&parameter=50;20 
<div class="indent">numericinput </div>
|-
| class="usercell" |
| PlayListNext
<div class="indent">WINDOW_DIALOG_NUMERIC </div>
| Starts playing the next media in the current playlist.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=PlayListNext 
<div class="indent">10109 </div>
|-
| class="usercell" |
| PlayListPrev
<div class="indent">109 </div>
| Starts playing the previous media in the current playlist.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=PlayListPrev 
<div class="indent">DialogNumeric.xml </div>
|-
|- class="userrow"
| PlayNext
| class="usercell" |
| Starts playing/showing the next media/image in the current playlist or, if currently showing a slidshow, the slideshow playlist.
<div class="indent">gamepadinput </div>
| http://xbox/xbmcCmds/xbmcHttp?command=PlayNext 
| class="usercell" |
|-
<div class="indent">WINDOW_DIALOG_GAMEPAD </div>
| PlayPrev
| class="usercell" |
| Starts playing/showing the previous media/image in the current playlist or, if currently showing a slidshow, the slideshow playlist.
<div class="indent">10110 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=PlayPrev 
| class="usercell" |
|-
<div class="indent">110 </div>
| PlaySlideshow([directory];[recursive])
| class="usercell" |
| Starts the slideshow. Directory specifies a folder of images to add to the slideshow playlist. If recursive has a value of True then all directories beneath ''directory'' are searched for images and added to the slideshow playlist.
<div class="indent">DialogGamepad.xml </div>
| http://xbox/xbmcCmds/xbmcHttp?command=PlaySlideshow&parameter=F:\pictures;true 
|- class="userrow"
|-
| class="usercell" |
| PlayFile(filename)
<div class="indent">shutdownmenu </div>
| Starts playing the media file ''filename'' on the current playlist.
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=PlayFile&parameter=F:\music\test.mp3
<div class="indent">WINDOW_DIALOG_BUTTON_MENU </div>
|-
| class="usercell" |
| Reset
<div class="indent">10111 </div>
| Resets XBMC
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=Reset 
<div class="indent">111 </div>
|-
| class="usercell" |
| Restart
<div class="indent">DialogButtonMenu.xml </div>
| Restarts XBOX
|- class="userrow"
| http://xbox/xbmcCmds/xbmcHttp?command=Restart 
| class="usercell" |
|-
<div class="indent">scandialog </div>
| Rotate
| class="usercell" |
| Rotates the currently displayed image by 90 degree clockwise.
<div class="indent">WINDOW_DIALOG_MUSIC_SCAN </div>
| http://xbox/xbmcCmds/xbmcHttp?command=Rotate 
| class="usercell" |
|-
<div class="indent">10112 </div>
| SendKey(buttoncode;[LeftTrigger];[RightTrigger];[LeftThumbX];[LeftThumbY] ;[RightThumbX];[RightThumbY])
| class="usercell" |
| Initiates a button, key or mouse event. Buttoncode specifies the type of event and the other parameters specify additional information that is specific to each buttoncode value. See key.h for the the list of keycodes. The example raises the A button event.
<div class="indent">112 </div>
* To send a button event just set buttoncode to the appropriate value from Key.h
| class="usercell" |
* To send a keyboard event set buttoncode to F100 (hex) and add the required key’s ASCII value.
<div class="indent">DialogMusicScan.xml </div>
* (Experimental) To send a mouse event set buttoncode to EFFF (hex) , then set the following parameters:
|- class="userrow"
** LeftThumbX – mouse x position
| class="usercell" |
** LeftThumbY – mouse y position
<div class="indent">mutebug </div>
** LeftTrigger – indicates a single mouse click and takes a value of one of 1-left button, 2-right button, 3-middle button.
| class="usercell" |
** RightTrigger– indicates a double mouse click and takes a value of one of 1-left button, 2-right button, 3-middle button.
<div class="indent">WINDOW_DIALOG_MUTE_BUG </div>
| http://xbox/xbmcCmds/xbmcHttp?command=SendKey&parameter=256 
| class="usercell" |
|-
<div class="indent">10113 </div>
| ShowPicture(filename)
| class="usercell" |
| Displays the image ''filename''.
<div class="indent">113 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=ShowPicture&parameter=F:\apps\xbmc\media\splash.png 
| class="usercell" |
|-
<div class="indent">DialogMuteBug.xml </div>
| Shutdown
|- class="userrow"
| Shutdown XBOX
| class="usercell" |
| http://xbox/xbmcCmds/xbmcHttp?command=Shutdown 
<div class="indent">playercontrols </div>
|-
| class="usercell" |
| TakeScreenshot([filename];[flash];[rotation];[width];[height];[quality];[download];[imgtag]) 
<div class="indent">WINDOW_DIALOG_PLAYER_CONTROLS </div>
| Captures the current contents of the Xbox screen.
| class="usercell" |
If no parameters then the action is the same as initiating a regular screenshot command with the image being saved in the screenshot directory.
<div class="indent">10114 </div>
| class="usercell" |
If filename is provided then the image is saved to ''filename''.
<div class="indent">114 </div>
 
| class="usercell" |
If flash=True the screen will flash as the command executes.
<div class="indent">PlayerContros.xml </div>
 
|- class="userrow"
If resolution, width, height and quality are given then those values are used to define the rotation (in degrees), resolution and jpeg quality of the saved image.
| class="usercell" |
 
<div class="indent">seekbar </div>
If download = True then the image is downloaded to the client as a base64 encoded stream.
| class="usercell" |
 
<div class="indent">WINDOW_DIALOG_SEEK_BAR </div>
The command must conform to one of:
| class="usercell" |
 
<div class="indent">10115 </div>
No parameters
| class="usercell" |
 
<div class="indent">115 </div>
Filename, flash, rotation, width, height, quality
| class="usercell" |
 
<div class="indent">DialogSeekBar.xml </div>
Filename, flash, rotation, width, height, quality, download
|- class="userrow"
 
| class="usercell" |
Filename, flash, rotation, width, height, quality, download, imgtag
<div class="indent">musicosd </div>
 
| class="usercell" |
NEW: imgtag is new it will put a Convert Base64 to image tag with the Base64 code so in firefox browsers it will show the image instead of the Base64 code.
<div class="indent">WINDOW_DIALOG_MUSIC_OSD </div>
| http://xbox/xbmcCmds/xbmcHttp?command=takescreenshot&parameter=test.jpg;true;0;300;200;90;true;imgtag 
| class="usercell" |
|-
<div class="indent">10120 </div>
| Zoom(magnification)
| class="usercell" |
| Zooms the currently displayed image to a level specified by magnifaction. A magnification of 0 is the standard zoom level of none. Magnification can take values up to 8. 
<div class="indent">120 </div>
| http://xbox/xbmcCmds/xbmcHttp?command=Zoom&parameter=
| class="usercell" |
<div class="indent">MusicOSD.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">visualisationsettings </div>
| class="usercell" |
<div class="indent">WINDOW_DIALOG_VIS_SETTINGS </div>
| class="usercell" |
<div class="indent">10121 </div>
| class="usercell" |
<div class="indent">121 </div>
| class="usercell" |
<div class="indent">MusicOSDVisSettings.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">visualisationpresetlist </div>
| class="usercell" |
<div class="indent">WINDOW_DIALOG_VIS_PRESET_LIST </div>
| class="usercell" |
<div class="indent">10122 </div>
| class="usercell" |
<div class="indent">122 </div>
| class="usercell" |
<div class="indent">VisualizationPresetList.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">OSD Video Settings </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent">123 </div>
| class="usercell" |
<div class="indent">VideoOSDSettings.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">Audio OSD Settings </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent">124 </div>
| class="usercell" |
<div class="indent">VideoOSDSettings.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">Video Bookmarks </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent">125 </div>
| class="usercell" |
<div class="indent">VideoOSDBookmarks.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">File Browser </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent"> </div>
| class="usercell" |
<div class="indent">126 </div>
| class="usercell" |
<div class="indent">FileBrowser.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">ProfileSettings </div>
| class="usercell" |
<div class="indent">WINDOW_PROFILE_SETTINGS </div>
| class="usercell" |
<div class="indent">10130 </div>
| class="usercell" |
<div class="indent">130 </div>
| class="usercell" |
<div class="indent">ProfileSettings.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">LockSettings </div>
| class="usercell" |
<div class="indent">WINDOW_LOCK_SETTINGS </div>
| class="usercell" |
<div class="indent">10131 </div>
| class="usercell" |
<div class="indent">131 </div>
| class="usercell" |
<div class="indent">LockSettings.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">mymusicplaylist </div>
| class="usercell" |
<div class="indent">WINDOW_MUSIC_PLAYLIST </div>
| class="usercell" |
<div class="indent">10500 </div>
| class="usercell" |
<div class="indent">500 </div>
| class="usercell" |
<div class="indent">MyMusicPlaylist.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">mymusicfiles </div>
| class="usercell" |
<div class="indent">WINDOW_MUSIC_FILES </div>
| class="usercell" |
<div class="indent">10501 </div>
| class="usercell" |
<div class="indent">501 </div>
| class="usercell" |
<div class="indent">MyMusicSongs.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">mymusiclibrary </div>
| class="usercell" |
<div class="indent">WINDOW_MUSIC_NAV </div>
| class="usercell" |
<div class="indent">10502 </div>
| class="usercell" |
<div class="indent">502 </div>
| class="usercell" |
<div class="indent">MyMusicNav.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">mymusictop100 </div>
| class="usercell" |
<div class="indent">WINDOW_MUSIC_TOP100 </div>
| class="usercell" |
<div class="indent">10503 </div>
| class="usercell" |
<div class="indent">503 </div>
| class="usercell" |
<div class="indent"></div>
|- class="userrow"
| class="usercell" |
<div class="indent">virtualkeyboard </div>
| class="usercell" |
<div class="indent">WINDOW_VIRTUAL_KEYBOARD </div>
| class="usercell" |
<div class="indent">11000 </div>
| class="usercell" |
<div class="indent">1000 </div>
| class="usercell" |
<div class="indent">.</div>
|- class="userrow"
| class="usercell" |
<div class="indent">selectdialog </div>
| class="usercell" |
<div class="indent">WINDOW_DIALOG_SELECT </div>
| class="usercell" |
<div class="indent">12000 </div>
| class="usercell" |
<div class="indent">2000 </div>
| class="usercell" |
<div class="indent">DialogSelect.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">musicinformation </div>
| class="usercell" |
<div class="indent">WINDOW_MUSIC_INFO </div>
| class="usercell" |
<div class="indent">12001 </div>
| class="usercell" |
<div class="indent">2001 </div>
| class="usercell" |
<div class="indent">DialogAlbumInfo.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">okdialog </div>
| class="usercell" |
<div class="indent">WINDOW_DIALOG_OK </div>
| class="usercell" |
<div class="indent">12002 </div>
| class="usercell" |
<div class="indent">2002 </div>
| class="usercell" |
<div class="indent">DialogOK.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">movieinformation </div>
| class="usercell" |
<div class="indent">WINDOW_VIDEO_INFO </div>
| class="usercell" |
<div class="indent">12003 </div>
| class="usercell" |
<div class="indent">2003 </div>
| class="usercell" |
<div class="indent">DialogVideoInfo.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">scriptsdebuginfo </div>
| class="usercell" |
<div class="indent">WINDOW_SCRIPTS_INFO </div>
| class="usercell" |
<div class="indent">12004 </div>
| class="usercell" |
<div class="indent">2004 </div>
| class="usercell" |
<div class="indent">DialogScriptInfo.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">fullscreenvideo </div>
| class="usercell" |
<div class="indent">WINDOW_FULLSCREEN_VIDEO </div>
| class="usercell" |
<div class="indent">12005 </div>
| class="usercell" |
<div class="indent">2005 </div>
| class="usercell" |
<div class="indent">VideoFullScreen.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">visualisation </div>
| class="usercell" |
<div class="indent">WINDOW_VISUALISATION </div>
| class="usercell" |
<div class="indent">12006 </div>
| class="usercell" |
<div class="indent">2006 </div>
| class="usercell" |
<div class="indent">MusicVisualtization.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">slideshow </div>
| class="usercell" |
<div class="indent">WINDOW_SLIDESHOW </div>
| class="usercell" |
<div class="indent">12007 </div>
| class="usercell" |
<div class="indent">2007 </div>
| class="usercell" |
<div class="indent">SlideShow.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">filestackingdialog </div>
| class="usercell" |
<div class="indent">WINDOW_DIALOG_FILESTACKING </div>
| class="usercell" |
<div class="indent">12008 </div>
| class="usercell" |
<div class="indent">2008 </div>
| class="usercell" |
<div class="indent">DialogFileStacking.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">weather </div>
| class="usercell" |
<div class="indent">WINDOW_WEATHER </div>
| class="usercell" |
<div class="indent">12600 </div>
| class="usercell" |
<div class="indent">2600 </div>
| class="usercell" |
<div class="indent">MyWeather.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">xlinkkai </div>
| class="usercell" |
<div class="indent">WINDOW_BUDDIES </div>
| class="usercell" |
<div class="indent">12700 </div>
| class="usercell" |
<div class="indent">2700 </div>
| class="usercell" |
<div class="indent">MyBuddies.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">screensaver </div>
| class="usercell" |
<div class="indent">WINDOW_SCREENSAVER </div>
| class="usercell" |
<div class="indent">12900 </div>
| class="usercell" |
<div class="indent">2900 </div>
| class="usercell" |
<div class="indent">none </div>
|- class="userrow"
| class="usercell" |
<div class="indent">videoosd </div>
| class="usercell" |
<div class="indent">WINDOW_OSD </div>
| class="usercell" |
<div class="indent">12901 </div>
| class="usercell" |
<div class="indent">2901 </div>
| class="usercell" |
<div class="indent">VideoOSD.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">videomenu </div>
| class="usercell" |
<div class="indent">WINDOW_MEDIA_MENU </div>
| class="usercell" |
<div class="indent">12902 </div>
| class="usercell" |
<div class="indent">2902 </div>
| class="usercell" |
<div class="indent">none </div>
|- class="userrow"
| class="usercell" |
<div class="indent">startup </div>
| class="usercell" |
<div class="indent">WINDOW_STARTUP </div>
| class="usercell" |
<div class="indent">12999 </div>
| class="usercell" |
<div class="indent">2999 </div>
| class="usercell" |
<div class="indent">startup.xml </div>
|- class="userrow"
| class="usercell" |
<div class="indent">startwindow </div>
| class="usercell" |
<div class="indent">- </div>
| class="usercell" |
<div class="indent">- </div>
| class="usercell" |
<div class="indent">- </div>
| class="usercell" |
<div class="indent">shortcut to the current startwindow </div>
|}
|}


In addition, there are the following “special” windows whose id is not really a concern (and you'll notice isn't unique)
===File Commands===
{| class="usertable" border="1"
 
|- class="userrow"
{| border=1 cellspacing=0 cellpadding=5
| class="usercell" Pointer
| <strong>Command</strong>
| class="usercell" | 105
| <strong>Information</strong>
| class="usercell" | Pointer.xml
| <strong>Example</strong>
|- class="userrow"
|-
| class="usercell" VideoOverlay
| FileCopy(sourceFilename, destinationFilename)
| class="usercell" 2004
| Copies the Xbox file ''sourceFilename'' to the Xbox file ''desitinationFilename''.  
| class="usercell" | VideoOverlay.xml
| http://xbox/xbmcCmds/xbmcHttp?command=FileCopy&parameter=F:\apps\xbmc\media\splash.png;E:\pictures\ 
|- class="userrow"
|-
| class="usercell" MusicOverlay
| FileDelete(filename)
| class="usercell" | 2004
| Deletes the Xbox file ''filename''.
| class="usercell" | MusicOverlay.xml
| http://xbox/xbmcCmds/xbmcHttp?command=FileDelete&parameter=F:\pictures\kim-smith-1024x768–22677.jpg  
|- class="userrow"
|-
| class="usercell" | Python Windows
| FileDownload(filename)
| class="usercell" | 30<span class="nobr">00&ndash;309</span>9
| Download a file specified by ''filename'' from the Xbox to the client as a base64 stream.  
| class="usercell" |  none
| http://xbox/xbmcCmds/xbmcHttp?command=FileDownload&parameter=F:\apps\xbmc\default.xbe 
|-
| FileDownloadFromInternet(URL;[filename])
| Downloads the file with address ''URL'' to the client as a base64 encoded stream. If the filename parameter is present, the downloaded file is also saved on the Xbox as the file ''filename''.  
| http://xbox/xbmcCmds/xbmcHttp?command=FileDownloadFromInternet&parameter=http://wallpapers.skins.be/kim-smith/kim-smith-1024x768–22677.jpg;F:\pictures\kim-smith-1024x768–22677.jpg <br>
To test quickly: http://xbox/xbmcCmds/xbmcHttp?command=ShowPicture&parameter=F:\pictures\kim-smith-1024x768–22677.jpg  
|-
| FileExists(filename)
| Returns True if the Xbox file ''filename'' exists otherwise returns False.  
| http://xbox/xbmcCmds/xbmcHttp?command=FileExists&parameter=F:\pictures\kim-smith-1024x768–22677.jpg 
|-
| FileSize(filename)
| Returns the file size of ''filename''.  
| http://xbox/xbmcCmds/xbmcHttp?command=FileSize&parameter=F:\pictures\kim-smith-1024x768–22677.jpg 
|-
| FileUpload(filename, contents)
| Uploads a file encoded as a base64 string ''contents'' to the file ''filename'' on the Xbox. The example creates on the xbox the file f:\test.txt with the contents ''hello''.
| http://xbox/xbmcCmds/xbmcHttp?command=fileUpload&parameter=f:\test.txt;aGVsbG8%3d
|}
|}
===Miscellaneous commands===
{| border=1 cellspacing=0 cellpadding=5
| <strong>Command</strong>
| <strong>Information</strong>
| <strong>Example</strong>
|- 
| ChooseAlbum(URL)
| Retrieves the cover image and review text of the album with URL ''URL'' as returned by the LookupAlbum command. The URL must be encoded using the standard %xx format([http://www.rfc-editor.org/rfc/rfc1738.txt RFC1738]) before being passed to the API. The example here is passing the URL http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:7vz1z87a6yvn
| http://xbox/xbmcCmds/xbmcHttp?command=choosealbum&parameter=http%3a%2f%2fwww%2eallmusic%2ecom%2fcg%2famg%2edll%3fp%3damg%26sql%3d10%3a7r6cmpea9f8o 
|-
| Config(command; parameters)
| Provides access to the ASP configuration commands. ''command'' is the ASP command and ''parameters'' is a semi-colon separated list of parameters to accompany the command. ''command'' is one of bookmarksize, getbookmark, addbookmark, savebookmark, removebookmark. For further information see: XBMCConfiguration.cpp. Note that the WebServer must be running to use this command. [Since 10 Nov 2007 the WebServer does not need to be running]
| http://xbox/xbmcCmds/xbmcHttp?command=Config(bookmarksize;20)
http://xbox/xbmcCmds/xbmcHttp?command=Config(getbookmark;music;name;1)
http://xbox/xbmcCmds/xbmcHttp?command=Config(getbookmark;music;path;1) 
|-
| ExecBuiltIn(function)
| Executes the XBMC ‘built-in’ function ''function''. For the list of available functions see: [[List_of_Built_In_Functions]] OR ExecBuiltIn Functions
| http://xbox/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=Notification(WARNING,SHUTTING%20DOWN%20SYSTEM!) 
|-
| Help
| Displays a list of some (NOT ALL) of the HTTPApi commands
| http://xbox/xbmcCmds/xbmcHttp?command=Help 
|-
| LookupAlbum(album[;artist;boolRelevance])
| [the form with the optional parameters added 11 Aug 07]
Looks up the album with name ''album'' on an Internet music site and returns the resulting matches as a list with the format: album_name<@@>album_URL
If boolRelevance has a value of ''1'' a relevance score (ranging from 1 (perfect) to 0) will also be returned with the following format: album_name<@@>album_URL<@@@>score
When requesting releveance scores it is best to include a value for the artist but it is not necessary.
| http://xbox/xbmcCmds/xbmcHttp?command=lookupalbum&parameter=On%20an%20Island
http://xbox/xbmcCmds/xbmcHttp?command=lookupalbum&parameter=On%20an%20Island;david%20gilmour;1
|-
|SetResponseFormat(format; value) 
|Sets the format of the response from HTTPApi. Format takes one of the following:
WebHeader – if True then the default web server header will be prepended to the response (ignored for Python and ASP responses).
WebFooter – if True then the default web server footer will be appended (ignored for Python and ASP responses).
Header – A user definable string that will be added after the WebHeader (if present) and before the main body of the response.
Footer – A user definable string that will be before after the WebFooter (if present) and after the main body of the response.
OpenTag – A user definable string that will be inserted before each element of the main response.
CloseTag – A user definable string that will be inserted after each element of the main response. Whether to insert this tag after the final element is defined by the CloseFinalTag setting.
CloseFinalTag – if True then the final element will have a closing tag.
The default format values are:
WebHeader=True
WebFooter=True
Header=<nowiki>””</nowiki>
Footer=<nowiki>””</nowiki>
OpenTag<nowiki>=”<li>”</nowiki>
CloseTag=[carriage return]
CloseFinalTag=False
[Added 22 Oct 2006]
Additional tags added and their default values (formats the response from the QueryMusicDatabase command):
OpenRecordSet=<nowiki>””</nowiki>
CloseRecordSet=<nowiki>””</nowiki>
OpenRecord=<nowiki>””</nowiki>
CloseRecord=<nowiki>””</nowiki>
OpenField=<nowiki>”<li>”</nowiki>
CloseField=<nowiki>””</nowiki>
It is now possible to specify multiple formats in a single call to SetResponseFormat.
SetResponseFormat without any parameters returns the formatting to the default values (as would restarting xbmc).
| http://xbox/xbmcCmds/xbmcHttp?command=SetResponseFormat&parameter=WebHeader;False
[[Added 22 Oct 2006]
The following sets up an XML formatted response (if viewing the output in a browser you will neeed to use the view source command to see the xml tags).
<nowiki>http://xbox/xbmcCmds/xbmcHttp?command=setresponseformat&parameter=webheader;false;webfooter;false;header;<xml>;footer;</xml>;opentag;<tag>;closetag;</tag>;closefinaltag;true</nowiki>
Then the same for the QueryMusicDatabase response:
<nowiki>http://xbox/xbmcCmds/xbmcHttp?command=setresponseformat&parameter=openRecordSet;<recordset>;closeRecordSet;</recordset>;openRecord;<record>;closeRecord;</record>;openField;<field>;closeField;</field></nowiki>
Now set everything back to the default:
http://xbox/xbmcCmds/xbmcHttp?command=SetResponseFormat
|-
| getXBETitle(path)
| [Added 16 Jan 07] Return the Title/Description of the specifed XBE
| http://xbox/xbmcCmds/xbmcHttp?command=getxbetitle&parameter=Q:\default.xbe
|-
| getXBEid(path)
| [Added 16 Jan 07] Returns the id of a specifed XBE
| http://xbox/xbmcCmds/xbmcHttp?command=getxbeid&parameter=Q:\default.xbe
|}
===Broadcast Commands===
{| border=1 cellspacing=0 cellpadding=5
| <strong>Command</strong>
| <strong>Information</strong>
| <strong>Example</strong>
|- 
| Broadcast(message;port)
| Not sure if there is much point to this command - probably could be used to test a client listening for broadcasts. If the port parameter is not specified then the currently set default port will be used.
| http://xbox/xbmcCmds/xbmcHttp?command=Broadcast&parameter=hello_from_xbmc
|-
| SetBroadcast(level;port)
| Sets the brodcast level and port. Level currently only takes three values: 0 - no broadcasts, 1 - media playback and startup & shutdown events, 2 - "OnAction" events (e.g. buttons) as well as level 1 events. Port is optional and if specified sets the default broadcast port value.
| http://xbox/xbmcCmds/xbmcHttp?command=SetBroadcast&parameter=1
|-
| GetBroadcast()
| Returns the current level and port settings.
| http://xbox/xbmcCmds/xbmcHttp?command=GetBroadcast
|}
===Name Changes===
To make the names of the commands more logical some have been changed. The old names are still recognised but it is strongly advised that the new names are now used.
{| border=1 cellspacing=0 cellpadding=5
| <strong>Old Name</strong>
| <strong>New Name</strong>
|-
| CopyFile
| FileCopy
|-
| DeleteFile
| FileDelete
|-
| GetInternetFile
| FileDownloadFromInternet
|-
| GetThumb
| FileDownload
|-
| GUISetting
| SetGUISetting, GetGUISetting
|-
| SetFile
| FileUpload
|-
| SetKey
| SendKey
|}
[[Category:Inner Workings]]
[[Category:Development]]
[[category:Python]]
[[category:Skin Development]]

Revision as of 20:54, 17 November 2007

HTTPAPI DOC

This document provides information on XBMC’s Application Programming Interface (API). The API operates over the HyperText Transfer Protocol and hence is called the HTTPAPI.

The same set of commands is also available over ASP and from Python (see later section).

Apart from where indicated by a date indicating when a command was added/modified this documentation describes what's available in XBMC 2.0.0.

Getting started

The XBMC HTTP API provides a mechanism for a networked device (e.g. a PC or a PDA with WiFi) to interact with XBMC. The API provides access to XBMC status information and control of XBMC functions.

The API can be called from and results displayed in a standard web browser which is probably the easiest way to experiment with these commands. Fire up your browser and enter the following into the address field:

http://xbox/xbmcCmds/xbmcHttp?command=getcurrentlyplaying

Information about the media currently being played by XBMC will be displayed, if nothing is being played then "[Nothing Playing]" will be displayed.

If you want to control the volume of XBMC enter the following into your browser’s address field:

http://xbox/xbmcCmds/xbmcHttp?command=setvolume&parameter=80

"OK" will be displayed and the volume will be set to 80% which you will probably find is rather quiet.

If you find that the above commands don’t work then check that:

  • The address "xbox" is understood by your browser to point to your Xbox’s address. You may need to enter the full IP address e.g. 192.168.0.1
  • The XBMC web server has been turned on. This setting can be found in Settings, Network, Server.
  • You didn’t mistype the command.


Note: If you are a Windows user, you can configure a name for your Xbox's IP address. Edit with your favorite text editor the file “hosts” inside C:\WINDOWS\system32\drivers\etc\ and add a line at the end with your xbox ip address.

192.168.0.1 xbox

Save it (don't need to restart) and test if the command “ping xbox” works. You should now resolve your Xbox IP address

If you still can’t get them working, try:

http://xbox

This should display the default XBMC web page. If this does not work then check out other XBMC documentation on the web server and come back when it is working.

Once you have the above working we can look at the structure of the http command line.

All API commands start with the following:

http://xbox/xbmcCmds/xbmcHttp?command=

(Remember you may need to swap “xbox” for the IP address.)

The next part of the line is the command itself, which in the two examples above are "getCurrentlyPlaying" and "setVolume". The command is not case sensitive: "SetVolume", "setvolume" and "SETVOLUME" can also be used.

If the command takes parameters then "&parameter=" is added after the command.

Finally comes the parameter values. If there are multiple parameters then each value is separated by a semi-colon ";". The following is an example of a command with 4 parameters.

http://xbox/xbmcCmds/xbmcHttp?command=takescreenshot&parameter=test.jpg;300;200;90

To pass a semi-colon as a parameter (rather than a seperator) use two semi-colons ";;".

To pass an empty paramter insert a space between the semi-colons "; ;".

To pass an empty parameter as the last (right most) parameter use "%20" (if just a space is appended to the end, the browser will remove it and xbmc will not detect the final parameter).

As of 18th Nov 2006 a more usual function calling syntax is also available. Instead of using the "&parameter" syntax to specify parameters the parameters can be enclosed within brackets. Note that the parameters must still be separated by semic-colons. The above example takescreenshot command would be presented in the new syntax as:

http://xbox/xbmcCmds/xbmcHttp?command=takescreenshot(test.jpg;300;200;90)

The rest of this document uses the original "&parameter" syntax which of course is still supported.

Response Structure

The API returns information in a consistent form but which is dependent on the type of information returned. Those commands which:

  • don’t return a value e.g. SetVolume return the standard response OK
  • return a single value e.g. GetVolume return just the value
  • return multiple values e.g. GetCurrentlyPlaying return multiple lines with each line having the format
    • name:value

An error in the execution of a command, for example a missing parameter, is indicated by the response:

Error[:Reason]

i.e. all errors are indicated by returning "Error" and depending on the error there may be additional information provided.

e.g.

Error:Missing parameter

The following is the default response format. To change the format see the command SetResponseFormat.

Every line in the response is prefixed by the HTML tag <li>. The only exception to this is the GetThumb command where a prefix is not included. The use of this prefix means that the responses are displayed clearly within a browser but the <li> tag does not require a corresponding close tag i.e. </li> is not required.

Finally, and to create a valid HTML response, the whole response is top and tailed with the web server’s default header and footer.


Sample Code

Probably the easiest way to get up to speed with a new API is to have a look at code. Several of the applications that can be found here: HTTPAPI client apps come with source code. In particular look for the file XBMCHttpInterface.vb which wraps up the majority of the HTTP API within a .Net class. The file can be found within the package XBMCControl. There are also examples that show how to call the HTTP API from an Excel spreadsheet and from Visual Basic 6.

ASP

The commands are also available as ASP commands using the command "xbmcAPI" just as the current "xbmcCommand" works now (see default.asp in the XBMC web directory). All xbmcAPI commands have an identical name and the same parameters as the commands listed in the document. The response structure is also identical apart from the web server’s default header and footer which will not be present.

e.g.

Response = xbmcAPI("GetCurrentlyPlaying");


Python

The commands are also callable from Python scripts through the function executehttpapi imported from the xbmc module. All xbmcAPI commands have an identical name and the same parameters as the commands listed in the document. The response structure is also identical apart from the web server’s default header and footer which will not be present.

e.g.

import xbmc

response = xbmc.executehttpapi("TakeScreenShot(q:\\test.jpg,0,false,200,-1,90)") 

Broadcast

Added 18th Nov 2006

The Broadcast functionality is not strictly speaking part of the HttpApi in that it does not use the HTTP protocol. However, it is controlled via HttpApi commands and would typically be used as an adjunct to the HttpApi and so is presented here.

The HttpApi is a “pull” architecture – HttpApi interacts with XBMC by making calls to XBMC. For an HttpApi client to maintain a dynamic up-to-date display, e.g. of the currently playing song, the client needs to continually poll XBMC for its status.

The Broadcast facility provides the opposite approach – XBMC makes calls out (i.e. broadcasts or "pushes") indicating significant events to anything that just happens to be listening.

The Broadcast facility uses the UDP broadcast protocol with a default port setting of 8278. (8278 was chosen for no other reason than it was the first unregistered port that I stumbled across.) For a client to receive these broadcasts, the client must register to receive the broadcasts (the method of doing so will depend on the language/technology of the client). XBMC broadcasts on the IP address 255.255.255.255 which is the limited broadcast address. Sending a UDP datagram to this address delivers the message to any host on that broadcast network. Because routers never forward messages sent to this address, only hosts on the connected network see these broadcasts, i.e. the client will need to be on the local network to receive the broadcasts.

The actual broadcasts are delimited by <b></b> and may consist of a numerical or textual description of the event (depening on the event) followed by ";" and the level of the event (e.g. 1 or 2).

An example Windows client (with source code), XBMC Listener, that listens to these broadcasts can be found here

The Commands

This section presents a complete list of HTTP API commands. In the list, after the command name is presented, the text between the parentheses is the list of semi-colon separated parameters for the command.

Remember to use the syntax:

http://xbox/xbmcCmds/xbmcHttp?command=setvolume&parameter=80

and not

http://xbox/xbmcCmds/xbmcHttp?command=setvolume(80)


A parameter in square brackets is optional. An optional parameter typically specifies an alternative to a default value.

In the following list the Playlist parameter identifies one of the four available playlists by using the values 0..3:

0. Music playlist
1. Temporary music playlist
2. Video playlist
3. Temporary video playlist

As of 26 Nov 2006 the available playlists and identifiers have changed to:

0. Music playlist
1. Video playlist


These playlists should not be confused with:

The slideshow playlist. The slideshow commands implicitly refer to the latter. Playlist files e.g m3u files.


The commands are presented in five sections. Those commands that:

  • retrieve information
  • set/modify information
  • perform/initiate an action
  • perform an action on a file
  • don’t fit into one of the above and hence are miscellaneous
  • HTTPAPI commands and examples


Assuming you have XBMC running and configured appropriately, clicking on the example link should load the link in your browser window. Then edit the link (if necessary): changing xbox to your Xbox IP (e.g. 192.168.1.101). As an example:

http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying -> http://192.168.1.101/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying

However, the most straightforward approach is to add xbox to your hosts file as described in the Getting Started section, after which you would not need to substiture your Xbox IP for xbox.

Some of the examples will work straight off, others, which for example refer to a specific file, will need you to manually modify the link to appropriate values for your environment.

'%20' is used in some of the examples which is just an alternative way of indicating a space (' '). The reason for using %20 is just to ensure that the document formatting keeps the entire http:// string as one object. If you are typing the command in manually or using it from your own code then you can either use %20 or a space.


Retrieving information commands

Command Information Example
GetMediaLocation(type; [path]; [option]) Type is one of music, video, pictures, files.

path is the path.

option is one of pathsonly, showdate

http://xbox/xbmcCmds/xbmcHttp?command=GetMediaLocation&parameter=files;f:\;pathsonly
GetShares(type; [option]) Type is one of music, video, pictures, files.

option is one of pathsonly, appendone

http://xbox/xbmcCmds/xbmcHttp?command=GetShares&parameter=music
GetCurrentPlaylist Retrieves the current playlist identifier. http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentPlaylist
GetCurrentlyPlaying Retrieves the filename, details and status of the currently playing media. http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying
GetCurrentSlide Retrieves the file name of the image currently being displayed. http://xbox/xbmcCmds/xbmcHttp?command=GetCurrentSlide
GetDirectory(directory;[mask];[option]) Retrieves the contents of the directory specified by directory. If the option parameter = 1 then file modified dates will be appended. The mask parameter can take the following form: .mp3 returns just the matching files "*" return just folders all files and folders. http://xbox/xbmcCmds/xbmcHttp?command=GetDirectory&parameter=F:\music\;.mp3;1
GetGuiDescription Retrieves various GUI values. (Currently just the screen resolution) http://xbox/xbmcCmds/xbmcHttp?command=GetGUIDescription
GetGuiSetting(type; name) Retrieves the value of GUI setting name. type specifies whether the setting is of type integer (0), boolean (1) or float (2) which must be set correctly or could cause a crash. name is the name of the setting to get the value of. For a list of setting names see GUISettings.cpp. http://xbox/xbmcCmds/xbmcHttp?command=getguisetting&parameter=0;system.shutdowntime
GetPercentage Retrieves the current playing position of the currently playing media as a percentage of the media’s length. http://xbox/xbmcCmds/xbmcHttp?command=getpercentage
GetPlaylistContents([playlist]) Retrieves the contents (file names) of the current playlist or the playlist specified by playlist. Playlist takes one of the following values: 0 – Music playlist, 1 – Temporary music playlist, 2 – Video playlist, 3 – Temporary video playlist. (Since 26 Nov 2006: 0 - Music playlist, 1 - Video playlist) http://xbox/xbmcCmds/xbmcHttp?command=GetPlaylistContents&parameter=1
GetPlaylistLength([playlist]) Retrieves the length of the current playlist or the playlist specified by playlist. [Added 27 Feb 07.] http://xbox/xbmcCmds/xbmcHttp?command=GetPlaylistLength&parameter=0
GetPlaylistSong([position]) Retrieves the currently playing song number in the playlist. If the optional parameter position is provided the command will return the file name of the media at location position in the playlist. http://xbox/xbmcCmds/xbmcHttp?command=GetPlaylistSong
GetPlaySpeed Retrieves the current playing speed. http://xbox/xbmcCmds/xbmcHttp?command=GetPlaySpeed
GetMusicLabel(item) Retrieves audio information relating to the currently playing media. The specific information to retrieve is specied by info which is an integer corresponding to one of the MUSICPLAYER_* constants that can be found in GUIInfoManager.h The example retrieves the codec currently being used. [Added 4 Nov 07.] http://xbox/xbmcCmds/xbmcHttp?command=GetMusicLabel&parameter=217
GetVideoLabel(item) Retrieves video information relating to the currently playing media. The specific information to retrieve is specied by info which is an integer corresponding to one of the VIDEOPLAYER_* constants that can be found in GUIInfoManager.h The example retrieves the rating of the video currently being played. [Added 4 Nov 07.] http://xbox/xbmcCmds/xbmcHttp?command=GetVideoLabel&parameter=270
GetSlideshowContents Retrieves the contents (file names) of the slideshow playlist. http://xbox/xbmcCmds/xbmcHttp?command=GetSlideshowContents
GetSystemInfo(InfoIds) Retrives System Information by id number(the information on the system info page in xbmc). You can supply multipal numbers if you wish to retreive a bunch at a time. This sample will get Version of XBMC & Build Date. For a full list of Id's see GUIInfoManager.h. http://xbox/xbmcCmds/xbmcHttp?command=GetSystemInfo&parameter=120;121
GetSystemInfoByName(InfoNames) Retrives System Information by name (the information on the system info page in xbmc). You can supply multipal names if you wish to retreive a bunch at a time. Go down to the "CGUIInfoManager::TranslateSingleString" section in GUIInfoManager.cpp and you will find all the InfoNames values http://xbox/xbmcCmds/xbmcHttp?command=GetSystemInfoByName&parameter=weather.location;weather.temperature
GetTagFromFilename(filename) Retrieves information for the audio file filename http://xbox/xbmcCmds/xbmcHttp?command=GetTagFromFilename&parameter=F:\music\test.mp3
GetThumbFilename(album;location) Retrieves the file name of the corresponding thumbnail for the music media file with file name album and path location http://xbox/xbmcCmds/xbmcHttp?command=GetThumbFilename&parameter=test.mp3;F:\music\
GetVolume Retrieves the current volume setting as a percentage of the maximum possible value. http://xbox/xbmcCmds/xbmcHttp?command=GetVolume
QueryMusicDatabase [Added 22 Oct 06] Provides a SQL interface to the XBMC Music Database. While this command is described in this section (Retrieving Information) it is possible to use it to modify the data base.

WARNING: The commands that modify the data base can obviously damage and/or lose information within it; but also some of the read commands can be so complex or retrieve so much data that it can impact the operation of XBMC e.g. retrieving all songs from a reasonably large data base can bring xbmc to its knees.

http://xbox/xbmcCmds/xbmcHttp?command=querymusicdatabase&parameter=select%20strArtist%20from%20artist%20order%20by%20strArtist

http://xbox/xbmcCmds/xbmcHttp?command=querymusicdatabase&parameter=select%20*%20from%20artist%20where%20strArtist%20LIKE%20'%%the%%'

QueryVideoDatabase [Added 23 Feb 07] Provides a SQL interface to the XBMC Video Database. See QueryMusicDatabase for further information. http://xbox/xbmcCmds/xbmcHttp?command=queryvideodatabase&parameter=select%20path.strpath%20from%20path

Setting commands

Command Information Example
AddToPlayList(media;[playlist];[mask]) Adds a file or folder (media is either a file or a folder) to the current playlist or the playlist specified by playlist. To specify a file mask use mask e.g. *.mp3. http://xbox/xbmcCmds/xbmcHttp?command=AddToPlayList&parameter=F:/music/test2.mp3;1
AddToSlideshow(media) Adds a file or folder (media is either a file or a folder) to the slideshow playlist. http://xbox/xbmcCmds/xbmcHttp?command=AddToSlideshow&parameter=F:\apps\xbmc\media\
ClearPlayList([playlist]) Clears the current playlist or the playlist specified by playlist. http://xbox/xbmcCmds/xbmcHttp?command=ClearPlayList&parameter=1
ClearSlideshow Clears the slideshow playlist. http://xbox/xbmcCmds/xbmcHttp?command=ClearSlideshow
RemoveFromPlaylist(filename,[playlist]) Removes the file filename from the current playlist or from playlist playlist. http://xbox/xbmcCmds/xbmcHttp?command=RemoveFromPlaylist&parameter=f:\test2.mp3,1
SeekPercentage Sets the playing position of the currently playing media as a percentage of the media’s length. http://xbox/xbmcCmds/xbmcHttp?command=SeekPercentage&parameter=50
SeekPercentageRelative Adds/Subtracts the current percentage on to the current postion in the song http://xbox/xbmcCmds/xbmcHttp?command=SeekPercentageRelative&parameter=-10
SetCurrentPlaylist(playlist) Sets the current playlist to playlist. http://xbox/xbmcCmds/xbmcHttp?command=SetCurrentPlaylist&parameter=1
SetGUISetting(type; name; value) Sets the value of GUI setting name to value. Type specifies whether the setting is of type integer (0), boolean (1) or float (2) which must be set correctly or could cause a crash. For a full list of setting names see GUISettings.cpp. http://xbox/xbmcCmds/xbmcHttp?command=SetGUISetting&parameter=0;system.shutdowntime;10
SetPlaylistSong(position) Sets the media at playlist position position to be the next item to be played. The example sets the position to the 6th song in the playlist http://xbox/xbmcCmds/xbmcHttp?command=SetPlaylistSong&parameter=5
SetPlaySpeed(speed) Sets the playing speed to the integer speed. http://xbox/xbmcCmds/xbmcHttp?command=SetPlaySpeed&parameter(speed)
SlideshowSelect(filename) Sets the slideshow playlist position by specifying the file name of the next image to show. http://xbox/xbmcCmds/xbmcHttp?command=SlideshowSelect&parameter=filename
SetVolume Sets the volume as a percentage of the maximum possible. http://xbox/xbmcCmds/xbmcHttp?command=SetVolume&parameter=50
SetAutoGetPictureThumbs If set to True then media thumbnails will be automatically created when required. (Default: True.) http://xbox/xbmcCmds/xbmcHttp?command=SetAutoGetPictureThumbs&parameter=false

Action commands

Command Information Example
Action Sends a raw Action ID (see key.h) to xbmc. Be careful with this one since it runs the action on the webserver thread and depending on the action could lock the GUI thread. The example sends ACTION_MOVE_DOWN. [Added 19th June 2007] http://xbox/xbmcCmds/xbmcHttp?command=Action&parameter=4
Exit Reboots to dashboard http://xbox/xbmcCmds/xbmcHttp?command=Exit
Move(deltaX, deltaY) Moves the currently displayed and ZOOMed (see zoom command below) image by the distance specified by deltaX and deltaY. The zoom magnification must be greater than 0 or the command has no effect. http://xbox/xbmcCmds/xbmcHttp?command=Move&parameter=50;20
PlayListNext Starts playing the next media in the current playlist. http://xbox/xbmcCmds/xbmcHttp?command=PlayListNext
PlayListPrev Starts playing the previous media in the current playlist. http://xbox/xbmcCmds/xbmcHttp?command=PlayListPrev
PlayNext Starts playing/showing the next media/image in the current playlist or, if currently showing a slidshow, the slideshow playlist. http://xbox/xbmcCmds/xbmcHttp?command=PlayNext
PlayPrev Starts playing/showing the previous media/image in the current playlist or, if currently showing a slidshow, the slideshow playlist. http://xbox/xbmcCmds/xbmcHttp?command=PlayPrev
PlaySlideshow([directory];[recursive]) Starts the slideshow. Directory specifies a folder of images to add to the slideshow playlist. If recursive has a value of True then all directories beneath directory are searched for images and added to the slideshow playlist. http://xbox/xbmcCmds/xbmcHttp?command=PlaySlideshow&parameter=F:\pictures;true
PlayFile(filename) Starts playing the media file filename on the current playlist. http://xbox/xbmcCmds/xbmcHttp?command=PlayFile&parameter=F:\music\test.mp3
Reset Resets XBMC http://xbox/xbmcCmds/xbmcHttp?command=Reset
Restart Restarts XBOX http://xbox/xbmcCmds/xbmcHttp?command=Restart
Rotate Rotates the currently displayed image by 90 degree clockwise. http://xbox/xbmcCmds/xbmcHttp?command=Rotate
SendKey(buttoncode;[LeftTrigger];[RightTrigger];[LeftThumbX];[LeftThumbY] ;[RightThumbX];[RightThumbY]) Initiates a button, key or mouse event. Buttoncode specifies the type of event and the other parameters specify additional information that is specific to each buttoncode value. See key.h for the the list of keycodes. The example raises the A button event.
  • To send a button event just set buttoncode to the appropriate value from Key.h
  • To send a keyboard event set buttoncode to F100 (hex) and add the required key’s ASCII value.
  • (Experimental) To send a mouse event set buttoncode to EFFF (hex) , then set the following parameters:
    • LeftThumbX – mouse x position
    • LeftThumbY – mouse y position
    • LeftTrigger – indicates a single mouse click and takes a value of one of 1-left button, 2-right button, 3-middle button.
    • RightTrigger– indicates a double mouse click and takes a value of one of 1-left button, 2-right button, 3-middle button.
http://xbox/xbmcCmds/xbmcHttp?command=SendKey&parameter=256
ShowPicture(filename) Displays the image filename. http://xbox/xbmcCmds/xbmcHttp?command=ShowPicture&parameter=F:\apps\xbmc\media\splash.png
Shutdown Shutdown XBOX http://xbox/xbmcCmds/xbmcHttp?command=Shutdown
TakeScreenshot([filename];[flash];[rotation];[width];[height];[quality];[download];[imgtag]) Captures the current contents of the Xbox screen.

If no parameters then the action is the same as initiating a regular screenshot command with the image being saved in the screenshot directory.

If filename is provided then the image is saved to filename.

If flash=True the screen will flash as the command executes.

If resolution, width, height and quality are given then those values are used to define the rotation (in degrees), resolution and jpeg quality of the saved image.

If download = True then the image is downloaded to the client as a base64 encoded stream.

The command must conform to one of:

No parameters

Filename, flash, rotation, width, height, quality

Filename, flash, rotation, width, height, quality, download

Filename, flash, rotation, width, height, quality, download, imgtag

NEW: imgtag is new it will put a Convert Base64 to image tag with the Base64 code so in firefox browsers it will show the image instead of the Base64 code.

http://xbox/xbmcCmds/xbmcHttp?command=takescreenshot&parameter=test.jpg;true;0;300;200;90;true;imgtag
Zoom(magnification) Zooms the currently displayed image to a level specified by magnifaction. A magnification of 0 is the standard zoom level of none. Magnification can take values up to 8. http://xbox/xbmcCmds/xbmcHttp?command=Zoom&parameter=4

File Commands

Command Information Example
FileCopy(sourceFilename, destinationFilename) Copies the Xbox file sourceFilename to the Xbox file desitinationFilename. http://xbox/xbmcCmds/xbmcHttp?command=FileCopy&parameter=F:\apps\xbmc\media\splash.png;E:\pictures\
FileDelete(filename) Deletes the Xbox file filename. http://xbox/xbmcCmds/xbmcHttp?command=FileDelete&parameter=F:\pictures\kim-smith-1024x768–22677.jpg
FileDownload(filename) Download a file specified by filename from the Xbox to the client as a base64 stream. http://xbox/xbmcCmds/xbmcHttp?command=FileDownload&parameter=F:\apps\xbmc\default.xbe
FileDownloadFromInternet(URL;[filename]) Downloads the file with address URL to the client as a base64 encoded stream. If the filename parameter is present, the downloaded file is also saved on the Xbox as the file filename. http://xbox/xbmcCmds/xbmcHttp?command=FileDownloadFromInternet&parameter=http://wallpapers.skins.be/kim-smith/kim-smith-1024x768–22677.jpg;F:\pictures\kim-smith-1024x768–22677.jpg

To test quickly: http://xbox/xbmcCmds/xbmcHttp?command=ShowPicture&parameter=F:\pictures\kim-smith-1024x768–22677.jpg

FileExists(filename) Returns True if the Xbox file filename exists otherwise returns False. http://xbox/xbmcCmds/xbmcHttp?command=FileExists&parameter=F:\pictures\kim-smith-1024x768–22677.jpg
FileSize(filename) Returns the file size of filename. http://xbox/xbmcCmds/xbmcHttp?command=FileSize&parameter=F:\pictures\kim-smith-1024x768–22677.jpg
FileUpload(filename, contents) Uploads a file encoded as a base64 string contents to the file filename on the Xbox. The example creates on the xbox the file f:\test.txt with the contents hello. http://xbox/xbmcCmds/xbmcHttp?command=fileUpload&parameter=f:\test.txt;aGVsbG8%3d

Miscellaneous commands

Command Information Example
ChooseAlbum(URL) Retrieves the cover image and review text of the album with URL URL as returned by the LookupAlbum command. The URL must be encoded using the standard %xx format(RFC1738) before being passed to the API. The example here is passing the URL http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:7vz1z87a6yvn http://xbox/xbmcCmds/xbmcHttp?command=choosealbum&parameter=http%3a%2f%2fwww%2eallmusic%2ecom%2fcg%2famg%2edll%3fp%3damg%26sql%3d10%3a7r6cmpea9f8o
Config(command; parameters) Provides access to the ASP configuration commands. command is the ASP command and parameters is a semi-colon separated list of parameters to accompany the command. command is one of bookmarksize, getbookmark, addbookmark, savebookmark, removebookmark. For further information see: XBMCConfiguration.cpp. Note that the WebServer must be running to use this command. [Since 10 Nov 2007 the WebServer does not need to be running] http://xbox/xbmcCmds/xbmcHttp?command=Config(bookmarksize;20)

http://xbox/xbmcCmds/xbmcHttp?command=Config(getbookmark;music;name;1)

http://xbox/xbmcCmds/xbmcHttp?command=Config(getbookmark;music;path;1)

ExecBuiltIn(function) Executes the XBMC ‘built-in’ function function. For the list of available functions see: List_of_Built_In_Functions OR ExecBuiltIn Functions http://xbox/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=Notification(WARNING,SHUTTING%20DOWN%20SYSTEM!)
Help Displays a list of some (NOT ALL) of the HTTPApi commands http://xbox/xbmcCmds/xbmcHttp?command=Help
LookupAlbum(album[;artist;boolRelevance]) [the form with the optional parameters added 11 Aug 07]

Looks up the album with name album on an Internet music site and returns the resulting matches as a list with the format: album_name<@@>album_URL

If boolRelevance has a value of 1 a relevance score (ranging from 1 (perfect) to 0) will also be returned with the following format: album_name<@@>album_URL<@@@>score

When requesting releveance scores it is best to include a value for the artist but it is not necessary.

http://xbox/xbmcCmds/xbmcHttp?command=lookupalbum&parameter=On%20an%20Island

http://xbox/xbmcCmds/xbmcHttp?command=lookupalbum&parameter=On%20an%20Island;david%20gilmour;1

SetResponseFormat(format; value) Sets the format of the response from HTTPApi. Format takes one of the following:

WebHeader – if True then the default web server header will be prepended to the response (ignored for Python and ASP responses).

WebFooter – if True then the default web server footer will be appended (ignored for Python and ASP responses).

Header – A user definable string that will be added after the WebHeader (if present) and before the main body of the response.

Footer – A user definable string that will be before after the WebFooter (if present) and after the main body of the response.

OpenTag – A user definable string that will be inserted before each element of the main response.

CloseTag – A user definable string that will be inserted after each element of the main response. Whether to insert this tag after the final element is defined by the CloseFinalTag setting.

CloseFinalTag – if True then the final element will have a closing tag.


The default format values are:

WebHeader=True

WebFooter=True

Header=””

Footer=””

OpenTag=”<li>”

CloseTag=[carriage return]

CloseFinalTag=False


[Added 22 Oct 2006]

Additional tags added and their default values (formats the response from the QueryMusicDatabase command):

OpenRecordSet=””

CloseRecordSet=””

OpenRecord=””

CloseRecord=””

OpenField=”<li>”

CloseField=””

It is now possible to specify multiple formats in a single call to SetResponseFormat.

SetResponseFormat without any parameters returns the formatting to the default values (as would restarting xbmc).

http://xbox/xbmcCmds/xbmcHttp?command=SetResponseFormat&parameter=WebHeader;False

[[Added 22 Oct 2006]

The following sets up an XML formatted response (if viewing the output in a browser you will neeed to use the view source command to see the xml tags).

http://xbox/xbmcCmds/xbmcHttp?command=setresponseformat&parameter=webheader;false;webfooter;false;header;<xml>;footer;</xml>;opentag;<tag>;closetag;</tag>;closefinaltag;true

Then the same for the QueryMusicDatabase response:

http://xbox/xbmcCmds/xbmcHttp?command=setresponseformat&parameter=openRecordSet;<recordset>;closeRecordSet;</recordset>;openRecord;<record>;closeRecord;</record>;openField;<field>;closeField;</field>

Now set everything back to the default:

http://xbox/xbmcCmds/xbmcHttp?command=SetResponseFormat

getXBETitle(path) [Added 16 Jan 07] Return the Title/Description of the specifed XBE http://xbox/xbmcCmds/xbmcHttp?command=getxbetitle&parameter=Q:\default.xbe
getXBEid(path) [Added 16 Jan 07] Returns the id of a specifed XBE http://xbox/xbmcCmds/xbmcHttp?command=getxbeid&parameter=Q:\default.xbe

Broadcast Commands

Command Information Example
Broadcast(message;port) Not sure if there is much point to this command - probably could be used to test a client listening for broadcasts. If the port parameter is not specified then the currently set default port will be used. http://xbox/xbmcCmds/xbmcHttp?command=Broadcast&parameter=hello_from_xbmc
SetBroadcast(level;port) Sets the brodcast level and port. Level currently only takes three values: 0 - no broadcasts, 1 - media playback and startup & shutdown events, 2 - "OnAction" events (e.g. buttons) as well as level 1 events. Port is optional and if specified sets the default broadcast port value. http://xbox/xbmcCmds/xbmcHttp?command=SetBroadcast&parameter=1
GetBroadcast() Returns the current level and port settings. http://xbox/xbmcCmds/xbmcHttp?command=GetBroadcast

Name Changes

To make the names of the commands more logical some have been changed. The old names are still recognised but it is strongly advised that the new names are now used.

Old Name New Name
CopyFile FileCopy
DeleteFile FileDelete
GetInternetFile FileDownloadFromInternet
GetThumb FileDownload
GUISetting SetGUISetting, GetGUISetting
SetFile FileUpload
SetKey SendKey