TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Main TiVo Forums > TiVo Mini
TiVo Community
Reply
Forum Jump
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average.
Old 01-13-2015, 11:25 AM   #1
HuskerMike
Registered User
 
Join Date: Jun 2014
Posts: 25
Help with Telnet script for mini

I've been working on keeping my minis from sleeping using a telnet script, but I don't understand enough to do it properly.
Here's my script so far:

192.168.1.10 31339
SEND "IRCODE CLEAR"

But I can't find anything about how to maybe delay before the "send" command (or if that's even necessary), or how to close when done, etc.

Every thread on this topic assumes telnet knowledge, so if anyone can comment, or even post a script example, that would be awesome.

HuskerMike is offline   Reply With Quote
Old 01-13-2015, 12:10 PM   #2
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,540
What computers / OS's do you have available at home?

telemark is offline   Reply With Quote
Old 01-13-2015, 12:16 PM   #3
HuskerMike
Registered User
 
Join Date: Jun 2014
Posts: 25
I'm using a windows PC. I'm just looking to finish the telnet script in notepad, run with Telnet Scripting Tool 1.0. There have been probably several hundred posts about this process here, but none of them contain the actual script. It's almost comical how ALL the threads narrowly avoid it - going off-topic or dying before getting helpful.


Last edited by HuskerMike; 01-13-2015 at 12:22 PM.
HuskerMike is offline   Reply With Quote
Old 01-13-2015, 12:41 PM   #4
HuskerMike
Registered User
 
Join Date: Jun 2014
Posts: 25
Ok, I've discovered one mistake - I've been forgetting the \m at the end of the "SEND" lines.

So, it kind-of works, but I can't seem to do what I want fully. In the new script below, I'm trying to set several minis to different channels using the same script. Not sure if I can put another IP address into the same script. Feel free to jump in with any tips.

192.168.1.10 31339 (note - setting main Tivo to channel 1352)
SEND "IRCODE LIVETV\m"
SEND "SETCH 1352\m"

192.168.1.14 31339 (note - trying to set Mini #1 to channel 1500, doesn't work).
SEND "IRCODE LIVETV\m"
SEND "SETCH 1500\m"

(Need to close the dialog boxes somehow here)

Also the SETCH command no longer seems to work on my mini boxes, so I'll have to figure out a way to use IRCODE NUM commands somehow.


Last edited by HuskerMike; 01-13-2015 at 01:29 PM.
HuskerMike is offline   Reply With Quote
Old 01-13-2015, 03:34 PM   #5
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,540
Sorry, I'm a Linux / Mac scripter. I would have to install Windows just to try the software you mentioned.

Yes, SETCH has been reported to not work, so IRCODE is the only way last I heard for the second part.

If you install Perl or Python on your windows machine, you might get more responses.

telemark is offline   Reply With Quote
Old 01-13-2015, 06:25 PM   #6
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,540
This works in Linux, might work on other Perl platforms with netcat or a unix like telnet installed.
Spoiler:
Code:
$ cat pokeMinis.pl 

#!/usr/bin/perl
use warnings;
use strict;
use IO::Handle;

my %map = (
  "192.168.0.100" => "1352",
  "192.168.0.101" => "1500"
);

my $port = '31339';
my $cmd = "nc ";
#my $cmd = "telnet ";


foreach my $ip (keys(%map)) {
  print "$ip:\n";
  open SOCK, "|$cmd $ip $port";
  SOCK->autoflush(1);
  my $channel = $map{$ip};
  sleep 2;
  print SOCK "IRCODE LIVETV\r";
  sleep 1;
  my @digits = split(//, $channel);
  foreach my $digit (@digits) {
    print SOCK "IRCODE NUM$digit\r";
    sleep 1;
  }
  close SOCK;
  sleep 1;
}


Or Python:
Spoiler:
Code:
$ cat pokeMinis.py

#!/usr/bin/env python
 
import socket
import time
 
hosts = (
  ("192.168.0.100", "1352"),
  ("192.168.0.101", "1500")
)
port = 31339
 
for ip, channel in hosts:
  print("%s:" % ip)
  s = socket.socket()
  s.connect((ip, port))

  time.sleep(2) 
  s.sendall("IRCODE LIVETV\r")
  time.sleep(2)
 
  for digit in channel:
    s.sendall("IRCODE NUM%s\r" % digit)
    time.sleep(1)
 
  s.close()

Or use as a template for other languages.
Code:
IRCODE LIVETV
IRCODE NUM1
IRCODE NUM5
IRCODE NUM0
IRCODE NUM0

IRCODE LIVETV
IRCODE NUM1
IRCODE NUM3
IRCODE NUM5
IRCODE NUM2


Last edited by telemark; 01-14-2015 at 03:53 PM.
telemark is offline   Reply With Quote
Old 01-13-2015, 07:03 PM   #7
telemark
Registered User
 
Join Date: Nov 2013
Posts: 1,540
Oh wait a sec, why are you setting the channel on the Mini's instead of leaving them on the channel they're on?

telemark is offline   Reply With Quote
Old 01-14-2015, 08:59 AM   #8
HuskerMike
Registered User
 
Join Date: Jun 2014
Posts: 25
The reason for the channel input is so that each day, all the TVs would default back to their correct news channels for work-time regardless of what channel they recorded the night before. Not as necessary as the stay-awake aspect, but I thought it would be useful. I'll keep working on this today.

HuskerMike is offline   Reply With Quote
Old 01-20-2015, 12:33 PM   #9
jntc
Registered User
 
Join Date: Dec 2013
Posts: 114
Is there something to do on the mini's to open the port? Port 31339 isn't open on any of the 5 I have.

# nmap 192.168.0.30

Starting Nmap 6.46 ( http://nmap.org ) at 2015-01-20 13:32 EST
Nmap scan report for xxxxxx.xxxxxx.com (192.168.0.30)
Host is up (0.0053s latency).
Not shown: 995 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
2190/tcp open tivoconnect
2191/tcp open tvbus
9080/tcp closed glrpc
MAC Address: 00:119:xx:xx:xx (TiVo)

jntc is offline   Reply With Quote
Old 01-20-2015, 12:38 PM   #10
Arcady
Stargate Fan
 
Arcady's Avatar
 
Join Date: Oct 2004
Location: Philadelphia, PA
Posts: 3,960
Did you turn on "network remote control" in the settings? I don't think port 31339 is turned on until you do that.

Arcady is offline   Reply With Quote
Old 01-20-2015, 12:45 PM   #11
jntc
Registered User
 
Join Date: Dec 2013
Posts: 114
Quote:
Originally Posted by Arcady View Post
Did you turn on "network remote control" in the settings? I don't think port 31339 is turned on until you do that.
That would be it! Thanks!

jntc is offline   Reply With Quote
Old 01-24-2015, 09:05 PM   #12
weedwhacker2
Registered User
 
Join Date: Sep 2013
Posts: 5
Any update? I have tried the same things with no good results changing the channel on the mini.. Would be nice to have the news on without finding the remote

Quote:
Originally Posted by HuskerMike View Post
The reason for the channel input is so that each day, all the TVs would default back to their correct news channels for work-time regardless of what channel they recorded the night before. Not as necessary as the stay-awake aspect, but I thought it would be useful. I'll keep working on this today.

weedwhacker2 is offline   Reply With Quote
Old 05-27-2016, 09:41 AM   #13
METTTAL
Registered User
 
Join Date: Oct 2010
Posts: 1
Can anyone help me with this? I'm trying to do the same thing, and use the python script provided (I don't know anything about python, and very little about programming), but I'm getting an error when running it:

Traceback (most recent call last):
File "N:\Tivo\602.py", line 17, in <module>
s.sendall("IRCODE LIVETV\r")
TypeError: a bytes-like object is required, not 'str'
>>>

Any help would be appreciated it. I'm searching the error, but knowing nothing about python programming isn't helping me fix it.

***************
EDIT: Nevermind, I found a page that assisted me in figuring it out.

Needed to change:

s.sendall("IRCODE LIVETV\r")

TO

s.sendall("IRCODE LIVETV\r".encode(encoding='utf_8'))

Also had to do that for the number send:

s.sendall("IRCODE NUM%s\r".encode(encoding='utf_8') % digit.encode(encoding='utf_8'))


Last edited by METTTAL; 05-27-2016 at 09:49 AM.
METTTAL is offline   Reply With Quote
Reply
Forum Jump







Thread Tools
Rate This Thread
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Advertisements





TiVo Community
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media


(C) 2016 DBNet - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 09:05 PM.
Page generated in 0.17307210 seconds (60.46% PHP - 39.54% MySQL) with 18 queries