[mythtv-users] mythfilldatabase channel updates

Jan Ceuleers jan.ceuleers at computer.org
Thu Jun 19 19:32:27 UTC 2008


Mike LaPlante wrote:
> I just updated my SchedulesDirect to remove all the useless channels I 
> don't watch. I know if I wait 2 weeks or so my guide should drop those 
> channels, but is there a way to force that?
> I tried --do-channel-updates, didn't seem to help. Doing this remotely 
> over ssh so I've only attempted command line solutions.
> Do I need to get into mythtv-setup and remove/recreate my cards, 
> sources, and inputs?

I have a similar issue (which I've solved; see below). I think my 
situation is similar to yours, so perhaps you can come up with a similar 
solution as well.

I don't use SchedulesDirect, but instead I download an xml file on a 
daily basis that a kind soul puts together using a number of web 
scrapers. The problem is that this xml file contains a number of 
channels that I don't actually receive on any of my tuners. When I 
import the xml file using mythfilldatabase, it creates entries for those 

I wanted to get rid of the phantom channels, so I went and looked for 
what sets them apart from the "legitimate" channels, and I came up with 
the following:

delete from channel where isnull(freqid) and char_length(channum)=0;

Having got rid of the channels, I also needed to get rid of any programs 
that mythfilldatabase had imported for those channels:

delete from program where chanid not in (select chanid from channel);

The nightly script that does all of this looks like this:

cd ~mythtv
wget http://www.mythportal.be/sites/mythportal.be/files/guide.xml.gz
gunzip -f guide.xml.gz
sed -ie 's/"ketnet"/"ketnet\/canvas"/g' guide.xml
sed -ie 's/"canvas"/"ketnet\/canvas"/g' guide.xml
mythfilldatabase --file 1 guide.xml
mythfilldatabase --file 2 guide.xml
. /etc/mythtv/mysql.txt
mysql -h via.xperim.be -u $DBUserName --password=$DBPassword $DBName < 
mythbackend --resched

where removePhantomChannelsAndPrograms.sql contains the above two SQL 
statements followed by quit.

Please don't just adopt the above without checking that the delete 
statements don't remove any of your legitimate channels!!

HTH, Jan

More information about the mythtv-users mailing list