[mythtv-users] channel change script works only from command line
Tom Rogers
trnitzjunk at gmail.com
Fri Oct 9 15:46:28 UTC 2009
Figured out what the problem was, after observing the little IR transmitter.
When I was running the script from the command line, the IR transmitter was
flashing 3 times; when from MythTV, only twice.
Changed the script to hit enter after changing channels (the $needs_enter
line).
Thanks to everyone who replied...without this list, I would have probably
given up a while ago!
____________________________________________________________________________________
My change channel script for a Hauppauge** PVR-150 and a Comcast-supplied
Motorola DCT700 cable box:
#!/usr/bin/perl
# Script obtained from
# http://www.blushingpenguin.com/mark/lmilk/change_channel
#
#
# make sure to set this string to
# the corresponding remote in /etc/lircd.conf
$remote_name = "blaster";
# Let's assume you don't need to press enter after you punch in a
# channel number. Change this to 1 if your cable box expects you press
# enter after each command
$needs_enter = 1;
# Change this to point to your rc executable
$rc_command = "/usr/bin/irsend";
# This subroutine actually sends the signal to the cable box
sub change_SIGNAL {
my($SIGNAL) = @_;
system ("$rc_command SEND_ONCE $remote_name $SIGNAL");
}
$SIGNAL=$ARGV[0];
open F, ">> /home/mythtv/channel.log";
#open F, ">> /var/log/channel.log";
print F "channel changing $SIGNAL\n";
close F;
print "channel changing $SIGNAL\n";
# Checks if $SIGNAL begins with a digit
# If it detects that the string is made up of digits, then it puts
# spaces between the digits. Ex. 1234 becomes 1 2 3 4
if ( $SIGNAL =~ /^\d+$/ )
{
my $length = length($SIGNAL);
my $counter = 0;
my $temp;
while( $counter < $length )
{
$temp .= substr($SIGNAL,$counter,1) ." ";
$counter++;
}
change_SIGNAL($temp);
}
else
{
# argument we passed was not made up of digits, so it must be a
# command that does something other than channel changing on the
# cable box
change_SIGNAL($SIGNAL);
}
# Do we need to send enter
if ( $needs_enter )
{
system ("$rc_command SEND_ONCE $remote_name ENTER");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20091009/be2c387c/attachment.htm>
More information about the mythtv-users
mailing list