How to ensure Set-Top-Box (STB) is Powered On?
STB - in most cases, Set Top Boxes are the boxes the Cable/DishTV companies leave at your place with a remote control for you to flip channels. STBs are external, and in case of models like mine, there appeared to be no reliable method to ensure that it is powered on (Like in case of small power disruption. The computer would probably boot back up, but what about the dumb STB?. Read more about the uncertainity here in this thread. Or, here.)
I initially proposed something naive like this (alt link here) and went on to finalize this working script.
You will need ffmpeg and jp2a installed. On my Ubuntu 7.10, they were installed by running:
sudo apt-get install jp2a ffmpeg
The idea is pretty simple - read from your ivtv device using dd. ffmpeg then converts them into jpeg files (1 per frame). jp2a analyses each of those frames to check whether they're blank or not.
I placed this in my channel change script (example ), so mythtv ensures that the STB is powered on before changing channels. You can also cron it, but it is better to call this in the beginning of your channel change script, as that way, you have a higher chance of unhindered read access to $pvr.
This can be downloaded to your machine as:
wget http://malayalam.homelinux.net/evuraan//check_stb.txt -O /tmp/check_stb
To suite specific needs/situations, one may accordingly need to change the parameters pvr, mark and wakeup.
Feedbacks are welcome.