[mythtv-users] Script for detecting copy protected channels on the hdhomerun

James Roberts james at robertshousehold.com
Mon Jan 9 19:08:29 UTC 2012


Over the years I've enjoyed putting around with MythTv, but with the Cable
Card tuners, I decided to take the HDHomeRun Prime.  Unfortunately, 2
things are current obstacles for me.
1) Arbitrary copy-once choices by my cable company (Charter, you really
copy protect NickHD and E! HD, but not ShowTime HD?  Really?) and
2) My frontend doesn't like it when I tune to one of those copy protected
channels.  In fact, I have to tie up all 3 tuners to force Myth Frontend
onto my old Analog tuner.

So, I made a script to help me identify protected channels so I can remove
them from both MythTV and Schedules Direct.  I had hoped to just make them
not be visible, but needed to delete them to prevent the wife and children
from tuning them with the Up/Down buttons.  I modified this from a script I
found on the Silicon Dust site, which tuned every channel in a range.  Now
It looks at a sourceid (3 in my case) and uses that for the list of
channels.  Replace the FFFFFFFF with your ID, especially if you have more
than one HDHomeRun.  This could interfere with recordings if the system is
in use.  Without further ado, here is my first contribution back to the
community:

#!/bin/bash
# Show subscription and copy protection for HDHR channels
# Do a scan into hdhrscan.txt first
# With thanks to karog
# First output field is the actual virtual channel, the vchan is the guide
channel
#set -x
PROGRAM_NAME="${0}"
# Put your tuner id here, from "hdhomerun_config discover"
ID="FFFFFFFF"
FILE="hdhrscan.txt"
MYPW="mythtv"
#
trychan() {
  ENCRYPT=""
  #ENCRYPT=`echo $dummy|grep encrypted|sed "s/.*\(encrypted\).*/encrypted/"`
  ENCRYPT=`echo $dummy|grep protected|sed "s/.*\(protected\).*/protected/"`
  TUNE=`hdhomerun_config $ID set /tuner2/vchannel $CHAN`
  sleep 1
  if [ "xx" = "x${TUNE}x" ]; then
    sleep 2
    VSTATUS=`hdhomerun_config $ID get /tuner2/vstatus`
    echo $CHAN $VSTATUS $ENCRYPT
  fi
}
#
date >&2
#
mysql -u mythtv -p $MYPW mythconverg -e "select channum ,callsign from
channel where sourceid = 3 order by channum" > $FILE
echo "Beginning vchannel scan...." >&2
while read CHAN CALLSIGN; do
  if [ $CHAN != "channum" ]; then
    trychan
  fi
done < $FILE


hdhomerun_config $ID set /tuner2/vchannel none
date >&2
####################################################### end of script
Again, don't forget to set your own sourceid, HDHomeRun ID, and database
MYPW password.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20120109/05e3dedf/attachment.html 


More information about the mythtv-users mailing list