Updating the MythTV channel lineup shouldn’t need to be so confusing but based on some misinformation on the Internet, I wasted a lot of time heading down wrong paths. The upshot is mythfilldatabase does do the right thing but it may not be clear initially. And if you don’t care about channel numbers at all, and you have only one source, then just run “mythfilldatabase –do-channel-updates” and you are done. If you do care about channel numbers (which can be useful when watching live TV switching between sports programs on neighboring channels, for example) or you have more than one source, read on.
I wanted to update my channel lineup because Comcast made substantial channel lineup changes and I wanted MythTV to get the resulting changes. They added the same channels in new locations while keeping the old. I had been using the old locations because I have the channel updating shut off (I have two sources and I want to control which channels are on which source). And while it doesn’t really matter when you are using a DVR which channels to use, it is easier if the channels are all grouped together rather than scattered across 2000 different numbers. And since some of the new lineup included things that were not in the old lineup locations, I preferred to use the new.
To kick off the changes, I ran the mythfilldatabase command with the flag “–do-channel-updates”. The result was lots of changes, as expected. And I discovered there were lots of things that weren’t right about the new lineup. I actually went through the cable box directly channel by channel making note of what the channel was and whether the lineup at Schedules Direct had it correct. Then I sent the full list of additions/deletions/changes to Schedules Direct. 12 days later, the Schedule Direct changes were complete and I was ready to get the changes into MythTV.
Right after I did the “–do-channel-updates” and had logged all of the differences, I ran my SQL script to clear out the duplicate channels from the two sources. The stuff with the CCI Flag set to zero remains on my “cable card” source (Ceton) while the stuff with CCI Flag set to something other than zero goes to the “cable box” source (HDPVR). Then when MythTV tries to record something it chooses the correct source. I periodically have to update my SQL scripts to handle the lineup changes and to include channels that are no longer CCI Flag = 0, but it isn’t too much trouble and this technique has been working well for me for years.
At this point, I have updated all my channels and updated and ran my scripts to clear out the duplicate channels between sources. And now I am ready to do the “–do-channel-updates” again to get the changes from Schedule Direct. After my run, I did see that many of the deletes had taken effect but strangely many of the additions had not. I tried all manner of trying to update using mythfilldatabase. I ran that program with many different combinations of its myriad inscrutable options and the result was always the same. The additional channels were not added where I expected them to be.
Perhaps the main reason for me writing this blog post is to address some confusion about mythfilldatabase. Numerous posts on MythTV mailing lists and numerous MythTV wiki pages all say that mythfilldatabase is not to be used to add channels. But when you consider that I got hundreds of new channels added when I first ran the “–do-channel-updates” as described in the second paragraph, that is clearly incorrect. And yet the fact that I wasn’t getting all of the channels lent some credence to these statements. I looked through the mythfilldatabase code which led me to the code for Data Direct and in that code I found the answer to the confusion. From the comments:
Find all the channels in the dd_v_station temp table where there is no channel with the same xmltvid in the DB using the same source.
Ah-ha. So the reason why most of my “new” channels didn’t appear is because they weren’t “new” to Data Direct. They may have been in new places but since they were already elsewhere in the lineup, that meant they were not added to the new place. And ultimately, that is actually useful behavior. But the misinformation about mythfilldatabase not being able to add channels had led to confusion and me thinking there was a different way to add a channel.
I’ve encountered this issue before but it was with only small changes and I manually added the channel to the database table. Or I may have used Mythbackend Setup to add the channel. And while I could still do that if I needed to, knowing that mythfilldatabase is doing the right thing and that the channel I am looking for might be in there but in a different place, now I am back in business.
There is still some mystery as to why DataDirect chooses one channel number over another for a channel that occurs in two locations. Most of the time, it seems to make the “right” choice (where “right” is that they are grouped together) but sometimes it does not. And for those occasions, the easiest way for me to edit the data is in the database channel table by updating the channum column.