[mythtv-users] Turn off "cable" box after viewing.

Michael mythtv at blandford.net
Tue Jan 5 04:29:02 UTC 2016


On 01/04/2016 09:36 AM, Rob Davis wrote:
> I have managed to get an IPTV box working and built into Myth.  This 
> includes a channel changer script which starts streaming and turns to 
> the correct "channel", to go alongside an EPG.  However, I'd like to 
> run another script (which I already have), which turns off the stream 
> to conserve bandwidth and resources.
>
> Google seems to suggest that I don't bother, but that's mainly due to 
> electrical, rather than bandwidth considerations.  The script I will 
> use checks mythfrontend/status to make sure the channel is not being 
> viewed before issuing the stop stream command, however, I'd like Myth 
> to run it automatically at the end of live tv viewing or recording.  
> Is there a way to do this?  I haven't looked into the event scripts 
> option too much - is there a hook there?
>
> I am using an HDPVR to get the data from the settop box (a Mag254) via 
> HDMI to Component converter, into Myth, and a script which uses ssh to 
> change channels.
>


I was always concerned that I would be trying to turn off the tuner just 
as the next recording was about to start.

So, instead, I just poll the tuners every 5 minutes.  If they aren't in 
use, I turn them off.  So, I have a cron job that does:

#!/bin/bash
export PATH=/usr/bin
MYTHWEBURL=http://<myhost>/mythweb/status

wget -O - --quiet $MYTHWEBURL | grep HDPVR | \
while read line; do
         dish=`echo $line | sed -e 's/.*hdpvr\([0-9]\).*/\1/'`
         if `echo $line | grep --quiet 'and is not recording'`; then
                 echo "Powering off directv-${dish}"
                 /usr/local/bin/directv-${dish} off
         else
                 echo "directv-${dish} is busy"
         fi
done

You would need to adjust the HDPVR entries to match your tuners.


More information about the mythtv-users mailing list