News:

VoxCommando works with Amazon Echo, Domoticz, EventGhost, Google Assistant, IFTTT, iTunes, J.River Media Center, Kodi, MediaMonkey, Nest, Philips Hue, Vera, Wemo, and the list keeps growing!

Main Menu

XJSON api for XBMC quick questions.

Started by thesystemera, May 07, 2013, 06:11:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thesystemera

Wondering if the following is possible. 

1. Request the band bio text.  when in XBMC pressing I over an artist or album will get relevant information about that band.  I want the text to use with TTS.

2. Save to favourites.  What track or podcast is currently playing, send a request via XJSON do so. 

3. This one is interesting.  Increase or decrease the rating of a track, as to say "I like this song" the rating goes up a notch if applicable and vice versa as in "I don't like this song"

thesystemera

I'm starting to understand the wiki and it seems no.1 is possible.  YAY!

thesystemera


jitterjames

#3
Quote from: thesystemera on May 07, 2013, 06:11:10 AM

3. This one is interesting.  Increase or decrease the rating of a track, as to say "I like this song" the rating goes up a notch if applicable and vice versa as in "I don't like this song"

I don't personally find this useful, I like to say "set rating X", but that doesn't matter. Here are the two commands you need.  Add your own phrases etc...

<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="XJSON Adjust rating" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="888" name="Increase Rating" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"increaserating"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="905" name="Decrease Rating" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"decreaserating"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
</commandGroup>

jitterjames

#4
Quote from: thesystemera on May 07, 2013, 06:11:10 AM
1. Request the band bio text.  when in XBMC pressing I over an artist or album will get relevant information about that band.  I want the text to use with TTS.

In this case we need to use infolabels: http://wiki.xbmc.org/index.php?title=InfoLabels

<?xml version="1.0" encoding="utf-16"?>
<command id="497" name="Tell me about this artist" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>XBMC.GetInfoBooleans&amp;&amp;"booleans": ["Container.Content(artists)"]</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <if ifBlockDisabled="False" ifNot="False">
   <ifType>(A)Contains(B)</ifType>
   <ifParams>{LastResult}&amp;&amp;true</ifParams>
   <then>
     <action>
       <cmdType>XJson.Raw</cmdType>
       <cmdString>XBMC.GetInfoLabels&amp;&amp;"labels": ["ListItem.Property(Artist_Description)"]</cmdString>
       <cmdRepeat>1</cmdRepeat>
     </action>
     <action>
       <cmdType>XJson.ParseTokens</cmdType>
       <cmdString>{[0]}</cmdString>
       <cmdRepeat>1</cmdRepeat>
     </action>
     <action>
       <cmdType>OSD.ShowText</cmdType>
       <cmdString>{LastResult}&amp;&amp;3000&amp;&amp;-5</cmdString>
       <cmdRepeat>1</cmdRepeat>
     </action>
     <action>
       <cmdType>VC.StopMacro</cmdType>
       <cmdString />
       <cmdRepeat>1</cmdRepeat>
     </action>
   </then>
   <else />
 </if>
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>XBMC.GetInfoBooleans&amp;&amp;"booleans": ["Container.Content(albums)"]</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <if ifBlockDisabled="False" ifNot="False">
   <ifType>(A)Contains(B)</ifType>
   <ifParams>{LastResult}&amp;&amp;true</ifParams>
   <then>
     <action>
       <cmdType>XJson.Raw</cmdType>
       <cmdString>XBMC.GetInfoLabels&amp;&amp;"labels": ["ListItem.Property(Album_Description)"]</cmdString>
       <cmdRepeat>1</cmdRepeat>
     </action>
     <action>
       <cmdType>XJson.ParseTokens</cmdType>
       <cmdString>{[0]}</cmdString>
       <cmdRepeat>1</cmdRepeat>
     </action>
     <action>
       <cmdType>OSD.ShowText</cmdType>
       <cmdString>{LastResult}&amp;&amp;3000&amp;&amp;-5</cmdString>
       <cmdRepeat>1</cmdRepeat>
     </action>
     <action>
       <cmdType>VC.StopMacro</cmdType>
       <cmdString />
       <cmdRepeat>1</cmdRepeat>
     </action>
   </then>
   <else />
 </if>
 <phrase>Tell me about this</phrase>
 <phrase>band, artist, group</phrase>
</command>

jitterjames

Quote from: thesystemera on May 07, 2013, 06:11:10 AM

2. Save to favourites.  What track or podcast is currently playing, send a request via XJSON do so. 

I don't think this one is possible yet, but maybe in the next version.  See the link:

https://github.com/xbmc/xbmc/pull/2600

thesystemera

For demonstration purposes its not necessaries, but otherwise good to know...