Author Topic: Tivo control over Network  (Read 4048 times)

0 Members and 2 Guests are viewing this topic.

JasonFox

  • $upporter
  • Jr. Member
  • *****
  • Posts: 27
  • Karma: 4
    • View Profile
Tivo control over Network
« on: March 21, 2014, 02:31:03 AM »
Hopefully it will be helpful to others. I dabbled with this month ago after discovering it on the Tivo Community forums here: http://www.tivocommunity.com/tivo-vb/showthread.php?t=392385 but couldn't get it work successfully in VC and I had decent control working through my iTach with IR commands (thanks to some patient help from the VC forums) so I left it. Decided to give it another try a couple of weeks ago and finally got it to work correctly. I've been meaning to post it ever since but work has kept me busy.

I use a listen command specific to the Tivo that disables my XBMC command group since the phrases used sometimes overlap (pause, play, fast forward, etc). All commands are basic telnet and when I tried before I always used TCP.Single.Write. I had tried with and without /x0D/x0A and subsets but I could never get it working for some reason. So this time I decided to open a connection during the listen command and issue TCP.Client.WriteLn for individual commands. That seemed to be the secret. Just TCP.Client.WriteLn with no terminator set in the session open. I set my 'don't listen' command and 'idle timeout' to close the session and re-enable the XBMC group (as I now use it for media more often than the Tivo).

My holy grail would be to have someone write a plug-in or Python command group that uses the rpcRequest options discovered by Arantius and fleshed out by Moyekj (the creator of KMTTG) in this thread  (allowing for much more XBMC like control.. "skip to 50%", "show episodes of 'big bang theory'"), but that's way beyond my meager skills. http://www.tivocommunity.com/tivo-vb/showthread.php?t=462980&page=3

Here are the commands I use to get VC to list and open and close the TCP session:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="787" name="Listen" enabled="true" alwaysOn="True" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.On</cmdType>
    <cmdString />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.PlayWav</cmdType>
    <cmdString>C:\Vox Commando\Sounds\Tivo upper.wav</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TCP.Single.Write</cmdType>
    <cmdString>{M:GcTV.TV MUTE}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.DisableGroup*</cmdType>
    <cmdString>XBMC</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.EnableGroup</cmdType>
    <cmdString>Network Tivo Commands</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Tcp.Client.Connect</cmdType>
    <cmdString>TIVO&amp;&amp;192.168.1.54&amp;&amp;31339</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>OK</phrase>
  <phrase>Tivo</phrase>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="8" name="Don't Listen" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.Standby</cmdType>
    <cmdString />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TCP.Single.Write</cmdType>
    <cmdString>{M:GcTV.TV MUTE}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.EnableGroup*</cmdType>
    <cmdString>XBMC</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.DisableGroup</cmdType>
    <cmdString>Network Tivo Commands</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.PlayWav</cmdType>
    <cmdString>C:\Vox Commando\Sounds\Tivo Thumbs Down.wav</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TCP.Client.Disconnect</cmdType>
    <cmdString>TIVO</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>ignore me,don't listen,stand by,stop listening</phrase>
</command>

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="719" name="Mute on Idle" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TCP.Single.Write</cmdType>
    <cmdString>{M:GcTV.TV MUTE}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.EnableGroup*</cmdType>
    <cmdString>XBMC</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.DisableGroup</cmdType>
    <cmdString>Network Tivo Commands</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.PlayWav</cmdType>
    <cmdString>C:\Vox Commando\Sounds\Tivo Thumbs Down.wav</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TCP.Client.Disconnect</cmdType>
    <cmdString>TIVO</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>vc.idletimeout</event>
</command>

And here is the Network Commands Group

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="False" name="Network Tivo Commands" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="532" name="Tivo Channel Up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE CHANNELUP&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Channel Up</phrase>
  </command>
  <command id="543" name="Tivo Channel Down" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE CHANNELDOWN&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Channel Down</phrase>
  </command>
  <command id="547" name="Tivo - Tivo" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE TIVO&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Main Menu</phrase>
  </command>
  <command id="559" name="Tivo - Select" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE SELECT&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Select</phrase>
  </command>
  <command id="572" name="Tivo - Live/Switch" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE LIVETV&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Switch Tuners,Live TV</phrase>
  </command>
  <command id="576" name="Tivo - Guide" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE GUIDE&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Guide</phrase>
  </command>
  <command id="606" name="Tivo - Clear/Delete" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE CLEAR&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Clear, Delete</phrase>
  </command>
  <command id="604" name="Tivo - Info" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE DISPLAY&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Info, Information,Display</phrase>
  </command>
  <command id="607" name="Tivo - Up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="300" loopMax="10" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE UP&amp;&amp;250</cmdString>
      <cmdRepeat>{1}</cmdRepeat>
    </action>
    <phrase optional="true">Tivo, Move</phrase>
    <phrase>Up</phrase>
    <payloadRange>1,10</payloadRange>
  </command>
  <command id="610" name="Tivo - Down" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="300" loopMax="10" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE DOWN&amp;&amp;250</cmdString>
      <cmdRepeat>{1}</cmdRepeat>
    </action>
    <phrase optional="true">Tivo, Move</phrase>
    <phrase>Down</phrase>
    <payloadRange>1,10</payloadRange>
  </command>
  <command id="637" name="Tivo - Right" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE RIGHT&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase optional="true">Tivo, Move</phrase>
    <phrase> Right</phrase>
  </command>
  <command id="638" name="Tivo - Left/Back" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE LEFT&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase optional="true">Tivo, Move</phrase>
    <phrase> Back</phrase>
  </command>
  <command id="643" name="Tivo - Enter/Last" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE ENTER&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Enter</phrase>
  </command>
  <command id="657" name="Tivo - Replay" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="300" loopMax="10" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE REPLAY&amp;&amp;400</cmdString>
      <cmdRepeat>{1}</cmdRepeat>
    </action>
    <phrase>Replay</phrase>
    <payloadRange optional="true">1,10</payloadRange>
  </command>
  <command id="667" name="Tivo - Pause" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE PAUSE&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pause</phrase>
  </command>
  <command id="681" name="Tivo - Play" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE PLAY&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Play</phrase>
  </command>
  <command id="713" name="Tivo - FFW &lt;#&gt;" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="300" loopMax="3" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE FORWARD&amp;&amp;250</cmdString>
      <cmdRepeat>{1}</cmdRepeat>
    </action>
    <phrase optional="true">Tivo</phrase>
    <phrase>Fast Forward</phrase>
    <payloadRange optional="true">1,3</payloadRange>
  </command>
  <command id="723" name="Tivo - REW &lt;#&gt;" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="300" loopMax="3" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE REVERSE&amp;&amp;250</cmdString>
      <cmdRepeat>{1}</cmdRepeat>
    </action>
    <phrase optional="true">Tivo</phrase>
    <phrase>Rewind</phrase>
    <payloadRange optional="true">1,3</payloadRange>
  </command>
  <command id="714" name="Tivo - REC" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE RECORD&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Record</phrase>
    <phrase optional="true">This, This Program</phrase>
  </command>
  <command id="717" name="Tivo - Skip &lt;#&gt;" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="300" loopMax="6" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE ADVANCE&amp;&amp;250</cmdString>
      <cmdRepeat>{1}</cmdRepeat>
    </action>
    <phrase optional="true">Tivo</phrase>
    <phrase>Skip</phrase>
    <payloadRange optional="true">1,6</payloadRange>
  </command>
  <command id="768" name="Tivo channel {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="1">
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>Switching to channel: {PF.1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;SETCH {1}&amp;&amp;1000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>CH_STATUS\\x20(.*?)\\&amp;&amp;&amp;&amp;{Var.TivoResponse}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>Channel is now: {M:CoxChannelNames.{Match.1}}&amp;&amp;1000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Change Channel to</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\CableChannels.xml</payloadFromXML>
  </command>
  <command id="793" name="What Channel is this?" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="1">
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>CH_STATUS\\x20(.*?)\\&amp;&amp;&amp;&amp;{Var.TivoResponse}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>Channel is now: {M:CoxChannelNames.{Match.1}}&amp;&amp;1000</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>What Channel is this?</phrase>
  </command>
  <command id="736" name="Tivo - List" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;TELEPORT NOWPLAYING&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Show</phrase>
    <phrase>List, Now Playing, Now Playing List</phrase>
  </command>
  <command id="766" name="Tivo - Thumbs Up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE THUMBSUP&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Thumbs Up</phrase>
  </command>
  <command id="800" name="Tivo - Thumbs Down" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IRCODE THUMBSDOWN&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Thumbs Down</phrase>
  </command>
  <command id="789" name="Tivo - Slow" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Tcp.Client.WriteLn</cmdType>
      <cmdString>TIVO&amp;&amp;IROCODE SLOW&amp;&amp;200</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Slow, SloMo, Slow Motion</phrase>
  </command>
  <command id="790" name="Set Tivo Response Variable" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <cmdString>TivoResponse&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>TIVO</event>
  </command>
</commandGroup>






JasonFox

  • $upporter
  • Jr. Member
  • *****
  • Posts: 27
  • Karma: 4
    • View Profile
Re: Tivo control over Network
« Reply #1 on: March 21, 2014, 02:58:05 AM »
Sorry just remembered the set channel command uses a payload and map that has all the channel names > channel numbers for Cox cable where I live. You would need to substitute your own channel maps/payload for that command.

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: Tivo control over Network
« Reply #2 on: March 21, 2014, 05:08:06 PM »
Really good stuff. I've attached my Payload file I'm using for the equivalent of you network command group in case it is of help.

Did you find that 200ms delay was needed?

Many, many, thanks for this
Garry

JasonFox

  • $upporter
  • Jr. Member
  • *****
  • Posts: 27
  • Karma: 4
    • View Profile
Re: Tivo control over Network
« Reply #3 on: March 22, 2014, 01:46:43 AM »
The delay was a hold over from when I was using my iTach to send actual IR signals. It may not be necessary.

The only delays that I know needed to be there where the ones for the SETCH commands so that it would wait long enough for the response and updated variable so it could announce the channel had changed. I really only added that announce because I wanted to see if I could capture and parse the the response via regEx as a challenge as I had little experience with it. Thankfully the wiki and some forum threads proved to be great resources.