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

Movie Details

Started by bp_pbs, February 02, 2013, 09:35:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bp_pbs

Alright Team right now I can't figure out the JSON code to pull movie details. Need some help please

jitterjames

what details are you looking for, specifically?

jitterjames

for example, if you want the title and the plot only you can do something like this:

<?xml version="1.0" encoding="utf-16"?>
<command id="548" name="Tell me about this movie" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Player.GetItem&amp;&amp;"playerid":1,  "properties": ["title","plot"]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.ParseTokens</cmdType>
    <cmdString>Now playing {item.title}. {CR} {item.plot}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.SoftMute</cmdType>
    <cmdString>60</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.SpeakSync</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.SoftUnMute</cmdType>
    <cmdString />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Tell me about this movie</phrase>
</command>

bp_pbs

James thanks for your help. I was looking for a command that will Smart display the movie and tell me the plot without playing the movie. I had 2 command on Eden that used this: 1) Plot details 2) Featured Movie (which picked a random movie and told you the plot)

jitterjames

So you actually want movie details about the currently displayed (highlighted, selected) movie, not the currently playing movie, which is what I provided in my previous post. Is that correct?

As for the other one, the plot of a random movie. It might be helpful to see the Eden version of the command.

jitterjames

This command will give you information about the currently highlighted movie.  If no movie is highlighted, it will tell you that.

I am using results.regex instead of XJson.ParseTokens, because the parsetokens command only works for certain formats and I need to work on it.

Here is what the json request returns, and I think ParseTokens can't handle the . in the variable names:


{
  "Listitem.Label": "Adam's Rib",
  "Listitem.Plot": "Spencer Tracy and Katharine Hepburn play Adam and Amanda Bonner, a husband-and-wife attorney team, both drawn to a case of attempted murder."
}



And here is the actual command which you can copy into your tree to test:

<?xml version="1.0" encoding="utf-16"?>
<command id="453" name="Tell me about this movie (info label)" 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(movies)"]</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.Label","Listitem.Plot"]</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>System.SetClipboardText</cmdType>
        <cmdString>{LastResult}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegEx</cmdType>
        <cmdString>":\s"(.*)"</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <cmdString>{match.1} {CR} {match.2}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <cmdString>No Movie is selected.</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>Tell me about this movie</phrase>
</command>

bp_pbs

 ;D AWESOME!!!!!!!!!!! Just Awesome!!!!!!!!!!!


Thanks for your help

jitterjames

If you just want a random movie you can create a smart playlist that selects one movie at random.  (see attached).

then you can create a command that opens it and reads the plot info.

jitterjames

this'll do it, but you need the xsp file from my previous post in your xbmc playlists/video folder

example folder: C:\Users\USERNAME\AppData\Roaming\XBMC\userdata\playlists\video

<?xml version="1.0" encoding="utf-16"?>
<command id="472" name="Suggest a movie" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>GUI.ActivateWindow&amp;&amp;"window": "video", "parameters": [ "special://profile/playlists/video/Random Movie.xsp" ]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>XBMC.GetInfoLabels&amp;&amp;"labels": ["Listitem.Label","Listitem.Plot"]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>System.SetClipboardText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <cmdString>":\s"(.*)"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>{match.1} {CR} {match.2}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Suggest a movie</phrase>
</command>

bp_pbs

Wow you work fast. I was still amazed with the plot. :yay

jitterjames

 :biglaugh

I hope that'll do you for now.  Bed time!