Prime Update Script

Purpose

There currently is no fully automatic way to maintain the channel tuning information for a clear QAM tuner. Tools like Scte65scan can help but they do not work 100% of the time because the information needed by such tools either changes from time to time or isn't reported at all by the cable provider.

If you have invested in an HD Homerun Prime (HDHR3-CC or HDHR6-CC) configured with a CableCard, this script will use the channel information automatically provided by your cable provider to your HD Homerun Prime and use it to correct and maintain the channel tuning information of your clear QAM tuner.

Note that your clear QAM tuner does not have to be an HD Homerun for this script to work. This script does not communicate with the clear QAM tuner at all and will correct the tuning information of any clear QAM setup. It will work with any clear QAM tuner.

What This Script Doesn't Do

This script does not perform the initial population of the channel database for a clear QAM tuner. Follow the usual instructions to perform this process.

The wiki has some links to get you started with the classic HD Homerun clear QAM tuner: Hdhomerun

Also see Prime2qam. Note the author of this script has had nothing to do with Prime2qam and makes no representations whatsoever as to its quality or applicability.

How To Configure The Script

Please be sure to read all the comments in the script. The script requires some familiarity with the MythTV database structure. If you misconfigure it it could damage your MythTV setup. Use at your own risk.

Copy the script to an executable location in your system and also make the file executable:

$chmod 755 prime_channel_update.pl

Configuring the script is simply a matter of editing the collection of variables near the beginning of the script. These are between the comments "Configuration Info" and "Work Begins Here."

Again, please read the comments carefully to see what each variable does. You do not have to configure the email notification function, that is optional. Your system may not be configured for or capable of email.

%prog is a hash containing the full path of two external programs used by the script, mail and hdhomerun_config.

You must download and compile hdhomerun_config from Silicon Dust before using this script. Download it here: Silicon Dust Downloads. This script uses hdhomerun_config to communicate with your Prime and extract the current channel information from it.

$targsourceid is the most important and dangerous variable you can set. This is the Source ID of your clear QAM tuner and will be used by the script when updating channel information. Be sure you set this correctly. If you set it incorrectly, channel information for the wrong turner will be changed. The videosource table in your database should have a description of each of your sources.

The remaining variables are documented in the script.

Finally, run the script as a cron job. For me Comcast seems to make it's channel changes sometime in the early morning, although I'm not sure exactly when. Since I very rarely make recordings in the morning, I run this script twice, at 3:00 AM and 9:00 AM.

To Do

It's been rightly pointed out that I am not using the perl bindings used by the other perl scripts that are part of MythTV. Using the bindings would avoid the need to manually find and connect to the database. There is also an interface to do things like add new entries into dtv_multiplex.