Author Topic: XJSON api for XBMC quick questions.  (Read 1561 times)

0 Members and 1 Guest are viewing this topic.

thesystemera

  • $upporter
  • Sr. Member
  • *****
  • Posts: 125
  • Karma: 0
    • View Profile
XJSON api for XBMC quick questions.
« on: May 07, 2013, 06:11:10 AM »
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

  • $upporter
  • Sr. Member
  • *****
  • Posts: 125
  • Karma: 0
    • View Profile
Re: XJSON api for XBMC quick questions.
« Reply #1 on: May 07, 2013, 06:17:40 AM »
I'm starting to understand the wiki and it seems no.1 is possible.  YAY!

thesystemera

  • $upporter
  • Sr. Member
  • *****
  • Posts: 125
  • Karma: 0
    • View Profile
Re: XJSON api for XBMC quick questions.
« Reply #2 on: May 07, 2013, 06:42:16 AM »
I take that back I'm so confused.. 

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7712
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XJSON api for XBMC quick questions.
« Reply #3 on: May 07, 2013, 08:47:16 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...

Code: [Select]
<?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>
« Last Edit: May 07, 2013, 10:08:48 AM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7712
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XJSON api for XBMC quick questions.
« Reply #4 on: May 07, 2013, 10:34:29 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

Code: [Select]
<?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>
« Last Edit: May 07, 2013, 10:48:08 AM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7712
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XJSON api for XBMC quick questions.
« Reply #5 on: May 07, 2013, 10:46:24 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

  • $upporter
  • Sr. Member
  • *****
  • Posts: 125
  • Karma: 0
    • View Profile
Re: XJSON api for XBMC quick questions.
« Reply #6 on: May 08, 2013, 03:08:55 AM »
For demonstration purposes its not necessaries, but otherwise good to know...