Difference between revisions of "Script - SKY channel changer"
From MythTV Official Wiki
m (LiRc 2f Sky Channel Changer Script moved to SKY channel changer script) |
|||
Line 1: | Line 1: | ||
− | |||
Here's a channel changer script for Sky in the UK. It cooperates with ../[[Sky Dog Remover Script]]. | Here's a channel changer script for Sky in the UK. It cooperates with ../[[Sky Dog Remover Script]]. | ||
Line 60: | Line 59: | ||
Ask if you have any problems --[[David Greaves]] | Ask if you have any problems --[[David Greaves]] | ||
+ | |||
+ | [[Category:HOWTO]] |
Revision as of 20:41, 5 February 2006
Here's a channel changer script for Sky in the UK. It cooperates with ../Sky Dog Remover Script.
My box occasionally misses a digit so this is thorough:
- send a couple of BACKUPS to clear things out.
- wait a second
- do it again
- sleep 2 seconds to let the channel change happen
- send a couple of BACKUPs to clear the show info banner
#!/usr/bin/perl -w use ir; my $chan=join(" ", split(//,$ARGV[0])); get_lock || die "No lock : $!\n"; print "Sending $chan\n"; system "irsend SEND_ONCE SKY BACKUP BACKUP $chan"; sleep 1; system "irsend SEND_ONCE SKY BACKUP BACKUP BACKUP"; sleep 1; system "irsend SEND_ONCE SKY BACKUP BACKUP $chan"; sleep 2; system "irsend SEND_ONCE SKY BACKUP"; clear_lock;
I install this as /usr/local/bin/change_channel
It uses ir.pm
:
# a couple of useful utility functions for locking during IR activity use Fcntl; my $MAX_TRIES = 10; my $LOCK_FILE="/tmp/ir_lock"; sub get_lock() { my $tries = 0; while (-f $LOCK_FILE && $tries < $MAX_TRIES ) { sleep 1; $tries ++; } return 0 if $tries == $MAX_TRIES ; sysopen(IR_LCK, $LOCK_FILE, O_RDWR | O_EXCL | O_CREAT) || return 0; return 1; } sub clear_lock() { close IR_LCK; unlink($LOCK_FILE); } 1;
This is installed as /usr/local/lib/site_perl/ir.pm
Ask if you have any problems --David Greaves