VoxCommando

VoxNastics (User Guides and Mods) => XML Exchange => Topic started by: jitterjames on March 04, 2015, 04:54:57 PM

Title: Kodi - Play TV episode by asking for a season number, episode number
Post by: jitterjames on March 04, 2015, 04:54:57 PM
In this Super command, we can ask for "Play show Game of Thrones, season 2, episode 4".

It will immediately play the requested episode.

If we don't have that episode, it still browses to the correct season.

If we don't have that season either, it will still browse to the TV show we asked for.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="325" name="Play show {1} season {2} episode {3}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <params>
      <param>VideoLibrary.GetEpisodes</param>
      <param>"tvshowid":{1}, "season":{2}, "properties":["episode","title"]</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RegExTool.Open</cmdType>
    <params>
      <param>True</param>
    </params>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;"total": 0</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>Sorry, I can't seem to find Season {2} - of {PF.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>Gui.ActivateWindow</param>
          <param>"window":"video","parameters":["videodb://2/2/{1}/"]</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>Results.RegExSingle</cmdType>
    <params>
      <param>"episode":\s{3},.*?"episodeid":\s*(\d*?),.*?"title":\s*"(.*?)"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{#M}&amp;&amp;1</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>Sorry, I found Season {2} but not episode {3} - of {PF.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>Gui.ActivateWindow</param>
          <param>"window":"video","parameters":["videodb://2/2/{1}/{2}/"]</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>Now playing {Pf.1} : {Match.1.2}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>Now playing {Pf.1} : {Match.1.2}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>Player.Open</param>
          <param>"item":{"episodeid":{match.1.1}}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>Play show</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">XbmcPayloads\xbmcTvShowTitles.xml</payloadFromXML>
  <phrase>season</phrase>
  <payloadRange>1,10</payloadRange>
  <phrase>episode</phrase>
  <payloadRange>1,26</payloadRange>
</command>
Title: Re: Kodi - Play TV episode by asking for a season number, episode number
Post by: Mace on March 05, 2015, 07:20:59 AM
Now that is Awesome!!

No more words need be said.