View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 17 posts ] 
Go to page Previous  1, 2

Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject:
PostPosted: Sun Dec 24, 2006 8:16 pm 
Offline
Joined: Sat Nov 04, 2006 9:56 pm
Posts: 23
Location: Ontario, Canada
This is the script i'm using. I'm not familiar with scripting, should this actually be working?

/etc/change_channel

#!/usr/bin/perl

# 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 = 0;

# Change this to point to your rc executable
$rc_command = "/usr/local/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, ">> /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");
}


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 24, 2006 10:52 pm 
Offline
Joined: Sat Nov 04, 2006 9:56 pm
Posts: 23
Location: Ontario, Canada
Ok, I have it changing channels automatically, SUCCESS!! However... when I reboot it stops working. I have to ssh in, do a 'killall mythbackend' then run 'mythbackend' then it starts working.. I'm a little confused by this.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 
Go to page Previous  1, 2



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu