Author Topic: Movie Details  (Read 4124 times)

0 Members and 2 Guests are viewing this topic.

bp_pbs

  • Contributor
  • ***
  • Posts: 94
  • Karma: 1
    • View Profile
Movie Details
« on: February 02, 2013, 09:35:24 PM »
Alright Team right now I can't figure out the JSON code to pull movie details. Need some help please

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #1 on: February 05, 2013, 07:59:27 PM »
what details are you looking for, specifically?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #2 on: February 05, 2013, 08:04:40 PM »
for example, if you want the title and the plot only you can do something like this:

Code: [Select]
<?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

  • Contributor
  • ***
  • Posts: 94
  • Karma: 1
    • View Profile
Re: Movie Details
« Reply #3 on: February 05, 2013, 08:28:08 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #4 on: February 05, 2013, 09:25:22 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #5 on: February 05, 2013, 09:51:16 PM »
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:

Code: [Select]
{
  "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:

Code: [Select]
<?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

  • Contributor
  • ***
  • Posts: 94
  • Karma: 1
    • View Profile
Re: Movie Details
« Reply #6 on: February 05, 2013, 09:55:36 PM »
 ;D AWESOME!!!!!!!!!!! Just Awesome!!!!!!!!!!!


Thanks for your help

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #7 on: February 05, 2013, 10:02:36 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #8 on: February 05, 2013, 10:08:37 PM »
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

Code: [Select]
<?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

  • Contributor
  • ***
  • Posts: 94
  • Karma: 1
    • View Profile
Re: Movie Details
« Reply #9 on: February 05, 2013, 10:32:48 PM »
Wow you work fast. I was still amazed with the plot. :yay

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Movie Details
« Reply #10 on: February 05, 2013, 10:35:32 PM »
 :biglaugh

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