A few things, mostly technical notes...

Monday, January 07, 2008

External Channel changer script which looks up channum against freqid

I had to use an external channel changer script as I moved to use the ir blaster of my Hauppauge PVR 150.   
Shortly thereafter I found that myth is calling the channel-changer script with some weird parameters. For instance,
to change to channel 18, it would evoke the script with an argument of 34590 or so. (Now, try changing your STB
to channel 34590, you will know how it was barfing.)

I am blaming my DB schema (2 years old).

Anyways, here's the script that fixes this problem. Save this as /usr/local/bin/change-channel.sh, chmod it, and
let mythtv-setup know.

You can also wget this script:

wget http://malayalam.homelinux.net/evuraan/change-channel.sh.txt -O /usr/local/bin/change- channel.sh

Lets cut the chase, here's the script:

#! /bin/bash

coin="$@"
REMOTE_NAME="blaster"
say="/usr/bin/logger -p info -t mythchannel"
user="mythtv"
pass="mythpassword"



flip_it() {
for digit in $(echo $score | sed -e 's/./& /g'); do
irsend SEND_ONCE $REMOTE_NAME "$digit"
$say "`date` coin is $coin, score is $score, digit is $digit"
done
sleep 2
}



if [ -z "$coin" ]
then
RET="1"
else
bb="`echo " mysql -u $user -p $pass -Ee 'select channum from channel where freqid="$coin" ' mythconverg"`"
[ ! -z "$bb" ] && score="`(echo "$bb")| sh|grep channum|awk {'print $2'}`"
fi




if [ -z "$score" ]
then
    RET="1"
else
flip_it
RET="0"
fi

exit $RET

0 comments:

Followers

സൂചിക::Index


Creative Commons License
This work is licensed under a Creative Commons License.