News:

There is now a ChangeLog page on the wiki
New developments are added at the bottom of the page.

Main Menu

Pulling cast from a tv show or movie.

Started by DexDeadly, April 10, 2016, 03:21:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DexDeadly

I want to say I heard this work when I maybe first installed this but now it doesn't seem to work.  When I'm saying "What Movie is this" it states the movie then says staring and then nothing.  I thought it would say the 3 main stars of the movie / tv show.currently this is what it looks like. 



Now if I do a test in postman to see how the cast comes back it looks like the following:
http://10.1.1.70:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem","params":{"playerid":1,"properties":["cast"]}, "id": "VideoGetItem"}

information is returned as the following:

{
  "id": "VideoGetItem",
  "jsonrpc": "2.0",
  "result": {
    "item": {
      "cast": [
        {
          "name": "Jeremy Clarkson",
          "order": 1,
          "role": "himself",
          "thumbnail": "image://http%3a%2f%2f10.1.1.25%3a8096%2femby%2fItems%2f21c34fd934fe6d5bd8b286539b7f84d2%2fImages%2fPrimary%3fMaxWidth%3d400%26MaxHeight%3d400%26Index%3d0%26Tag%3d358f4d9b42d2568103ad79db8a3dddb4/"
        },
        {
          "name": "Jonathan Palmer",
          "order": 2,
          "role": "Himself",
          "thumbnail": "image://http%3a%2f%2f10.1.1.25%3a8096%2femby%2fItems%2f97da624e6b257227ddf03bf7f292d0d3%2fImages%2fPrimary%3fMaxWidth%3d400%26MaxHeight%3d400%26Index%3d0%26Tag%3da6ec76a7621a7dab137ff5426d34d884/"
        },
        {
          "name": "Russ Swift",
          "order": 3,
          "role": "Himself",
          "thumbnail": "image://http%3a%2f%2f10.1.1.25%3a8096%2femby%2fItems%2f312d155e42d314bd7c0b563a859eb655%2fImages%2fPrimary%3fMaxWidth%3d400%26MaxHeight%3d400%26Index%3d0%26Tag%3d31dcd3dd6134011a954ae409648923a2/"
        }
      ],
      "id": 46,
      "label": "Clarkson: No Limits",
      "type": "movie"
    }
  }
}


if I change {lastresult} to {item.cast} it'll start speaking everything there.  Is there anyway to parse just the name out when it is returned back so that I can just here the names and not it trying to read every single item between the cast brackets?  I've been programming so much in this thing giving me a lot of info from Kodi and it's been great. 

Any input would be greatly appreciated.

nime5ter

#1
It looks like your version of the command was accidentally edited, and the most important action was removed.

In the default configuration that comes with VC, the command is:

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.4-->
<command id="540" name="What movie is this" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <params>
      <param>Player.GetItem</param>
      <param>"playerid":1,  "properties": ["title","cast"]</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>"name".*?"(.*)"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.MatchConcat</cmdType>
    <params>
      <param>, </param>
      <param>3</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.ParseTokens</cmdType>
    <params>
      <param>Now playing {item.title} starring {lastresult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.SoftMute</cmdType>
    <params>
      <param>60</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.SpeakSync</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.SoftUnMute</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>What Movie is this</phrase>
</command>


The Results.RegEx line is required to capture the "name" json items from the result returned from Kodi.

In fact, if you roll over the line
XJson.Raw:Player.GetItem&&"playerid":1,  "properties": ["title","cast"]
in your history window in VC, you'll see the same json result that you saw.

This is also captured in the VC log, if it's running. However, very recently Kodi has changed something on its end, which is causing a log jam in VC that we are trying to address for a future VC release.

So using the Vox Log to monitor Kodi behaviours is not advisable right now.

By the way, in general, we copy and paste commands from our command trees onto the forum, rather than using screen captures, as that makes it easier for others to test our commands if discussing a problem (or just use them if they're of interest).
http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum#Posting_Your_Code_to_the_Forum
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

In this case, almost all of the actions are important! ;)

nime5ter

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

DexDeadly

#4
Hello,

Thanks for the information I'll give this a try.   I thought I might of but when I installed a new version on a different pc to compare it also did not have that line.   Not sure what that is about.   Anyway next time I'll go ahead and post the xml and apologize about that. Knowing about the RegExid a nice piece for future reference as well.  I showed this program off recently at a hackerspace meeting and what I've done with it.  Everyone was very impressed.  I've made a ton of new commands pulling multiple items from the player such as year premiered,  show name,  episode,  plot,  etc.  Thanks for the help I'll give this a try now.   

jitterjames

You are right.  In the later versions of VC this action seems to be missing from the Kodi / Isengard configuration.  It is still present in the Kodi / Helix config though.

I'm not sure how it got deleted but thanks for letting us know.

DexDeadly

#6
Just wanted to report back that once I added this line I'm now getting back the starring cast.  No problem on reporting that to you.  I figured something was missing.  The by product of learning the command missing was RegEx I've now watched the RegEx videos posted and now have another new toy to play with and keep me up at night :).