Difference between revisions of "Script - SKY channel changer"
From MythTV Official Wiki
Mrsdonovan (talk | contribs) m (SKY channel changer script moved to Script - SKY channel changer: Created a "scripts" howto section which this should be apart of.) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Script info | ||
+ | |author=David Greaves | ||
+ | |short=Channel-change script for Sky | ||
+ | |long=Channel-change script for Sky | ||
+ | |category=Channel Change Scripts | ||
+ | |name=SKY channel changer}} | ||
+ | |||
+ | |||
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 8: | Line 16: | ||
* send a couple of BACKUPs to clear the show info banner | * send a couple of BACKUPs to clear the show info banner | ||
− | <pre | + | You can achieve faster and more reliable channel changes on sky hardware by using a wired solution instead of infra-red. The [[UK_Television#Sky.2FSky.2B_Box]] page lists several options. |
+ | |||
+ | {{perl|/usr/local/bin/change_channel| | ||
+ | <pre> | ||
#!/usr/bin/perl -w | #!/usr/bin/perl -w | ||
Line 27: | Line 38: | ||
clear_lock; | clear_lock; | ||
− | + | </pre> | |
+ | }} | ||
+ | |||
I install this as <code><nowiki>/usr/local/bin/change_channel</nowiki></code> | I install this as <code><nowiki>/usr/local/bin/change_channel</nowiki></code> | ||
It uses <code><nowiki>ir.pm</nowiki></code>: | It uses <code><nowiki>ir.pm</nowiki></code>: | ||
− | <pre | + | |
+ | {{Code box|/usr/local/lib/site_perl/ir.pm| | ||
+ | <pre> | ||
# a couple of useful utility functions for locking during IR activity | # a couple of useful utility functions for locking during IR activity | ||
use Fcntl; | use Fcntl; | ||
Line 55: | Line 70: | ||
1; | 1; | ||
− | + | </pre> | |
+ | }} | ||
+ | |||
This is installed as <code><nowiki>/usr/local/lib/site_perl/ir.pm</nowiki></code> | This is installed as <code><nowiki>/usr/local/lib/site_perl/ir.pm</nowiki></code> | ||
− | Ask if you have any problems --[[David Greaves]] | + | Ask if you have any problems --[[Abandoned_User_Pages#David_Greaves|David Greaves]] |
[[Category:HOWTO]] | [[Category:HOWTO]] | ||
− | [[Category:Scripts]] | + | [[Category:Channel Change Scripts]] |
+ | [[Category:United Kingdom]] |
Latest revision as of 16:46, 20 February 2013
Author | David Greaves |
Description | Channel-change script for Sky |
Supports |
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
You can achieve faster and more reliable channel changes on sky hardware by using a wired solution instead of infra-red. The UK_Television#Sky.2FSky.2B_Box page lists several options.
#!/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
:
/usr/local/lib/site_perl/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