Plugin XJson

From VoxCommando
Jump to: navigation, search

Go to the main Plugins page.

Go to the complete Plugin List.


Plugin Description

Actions for interacting with XBMC version 12 - Frodo (or later).

Most actions communicate with XBMC through the JSON protocol. Some simple actions use the event client (UDP). Some actions require the installation of the XBMC addon called VoxTools.

Actions for the XJson plugin

Btn.KB

XJson.Btn.KB
Sends the keycode <Button> to XBMC's event client.

For a reference of keycodes and their mappings see:

http://kodi.wiki/view/List_of_XBMC_keynames
or
https://github.com/xbmc/xbmc/blob/master/system/keymaps/keyboard.xml


  • Parameters: 1
  1. Button : Keycode of button to send [string]

Connect

XJson.Connect
Connects to XBMC to listen for JSON notifications on TCP socket. Uses parameters defined in the plugin options (IP, port).

Disconnect

XJson.Disconnect
Disconnects from XBMC and stops listening for JSON notifications.

SetConnection

XJson.SetConnection
Connect to a new XBMC host, overriding the default connection options defined in the XJson plugin settings.

  • Parameters: 2-4
  1. IP : [string]
  2. Port : [string]
  3. Username : [string]
  4. Password : [string]

ExecBuiltin

XJson.ExecBuiltin
Perfoms XBMC's built in functions.

For valid parameters see: http://wiki.xbmc.org/index.php?title=List_of_built-in_functions

  • Parameters: 1
  1. CmdString : [string]

GenXml

XJson.GenXml
Generates all the standard payload xml files by querying XBMC via JSON API. This action is limited (by the JSON API).

If possible, use the xSQL plugin instead.

GenXmlCustom

XJson.GenXmlCustom
Generate a custom payload XML file by querying XBMC via JSON.
All parameters are required, but "Json Params" may be left blank. This action is difficult to use and quite limited (by the JSON API).

If possible, use the xSQL plugin instead.

  • Parameters: 7
  1. Json Action : eg:AudioLibrary.GetArtists [string]
  2. Json Params : eg: [string]
  3. XmlFileOut : eg: xbmcArtists.xml [string]
  4. ResultsArray : eg: artists [string]
  5. ValueTag : eg: artistid [string]
  6. PhraseTag : eg: label [string]
  7. UseSubset : Use subset matching? eg: True [boolean]

GetVol

XJson.GetVol
Returns the current XBMC volume value (ranging from 0 to 100).

SetVol

XJson.SetVol
Sets XBMC volume to a value from 0 to 100. Requires XBMC to have the VoxTools addon installed.

The volume will change gradually if "Use smooth volume changes" is checked in the XJson plugin settings.

  • Parameters: 1
  1. Volume : 0-100 [integer]

SoftMute

XJson.SoftMute
Reduces volume to a percentage of the current volume. The volume will change gradually if "Use smooth volume changes" is checked in the XJson plugin settings.

  • Parameters: 1
  1. Vol % : [integer]

SoftUnMute

XJson.SoftUnMute
Restores volume to unmuted value. The volume will change gradually if "Use smooth volume changes" is checked in the XJson plugin settings.

ParseTokens

XJson.ParseTokens
String format where items in { } get replaced by tokens from the last Raw result returned by XBMC JSON API (retrieved using the Raw action).

For advanced users. Requires an understanding of JSON and the results generated by XBMC. For more information see: XJson.ParseTokens on the wiki.

Examples:
Album name is: {item.album}, and the first listed artist is {item.artists[0]}.

There are {item.genres#} genres associated with this song.

Use double square brackets to concatenate an array of values, using whatever is between them as the delimiter, e.g. "All artists for this song: {item.artistsand }"

  • Parameters: 1
  1. Format : [string]
  2. Data : Override the Json data to parse [string]

VoxTools

XJson.VoxTools
Requires the installation of the XBMC addon called VoxTools. Currently permits one particular command, which is a youtube search within XBMC.

param 1 param 2

youtube.search [insert your search term here]

  • Parameters: 2
  1. Command : [string]
  2. Param1 : [string]

Raw

XJson.Raw
Sends a JSON command to XBMC. See the default XBMC JSON configuration for examples. For more information see: http://wiki.xbmc.org/?title=JSON-RPC_API

  • Parameters: 1-2
  1. Method : JSON method [string]
  2. Params : Optional parameters [string]

Raw/

XJson.Raw/
Sends a JSON command to XBMC. See the default XBMC JSON configuration for examples.

Note: Raw/ is the same as the Raw action but converts backslashes '\' in <Params> to forward slashes '/' before sending to XBMC.

  • Parameters: 1-2
  1. Method : JSON method [string]
  2. Params : Optional parameters [string]

SmartPL

XJson.SmartPL
Loads a smartplaylist template from an XSP file, replaces variables, then sends the smart playlist to the VoxTools addon. Once received, the addon will save the updated file to the location: special://profile/playlists/mixed/voxsmart.xsp

Note: VoxTools addon for XBMC must be installed.

  • Parameters: 1+
  1. FileIn : Path to an xsp template file [string]
  2. Var1 : value that will replace {1} in template [string]
  3. Var2 : value that will replace {2} in template [string]
  4. Var3 : value that will replace {3} in template [string]