[mythtvnz] Channel id to name tables: Where are they?

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Oct 23 05:36:40 BST 2012


On Tue, 23 Oct 2012 15:36:50 +1300, you wrote:

>> Good call, Steve.  There are two sources.  So now we need to see how
>> the two sources are set up.  The sourceid field is used in only three
>> tables: channel, videosource and dtv_multiplex.  So please post the
>> results of these:
>> 
>> select * from videosource;
>> select * from dtv_multiplex;
>
>Attached.  That second one has a lot of columns.
>
>> 
>> I think this is all still the result of two scans, and that one source
>> can be deleted, along with all the related channel records.
>
>In mythtv speak what is a source?  Is it a tuner?  (That is what I
>assumed as I have two tuners)

No, that seems to be one of the places where you went wrong - one
source per tuner is a bad idea.  A source is a somewhat nebulous
thing, but basically it is a source of EPG data, and all the channels
that use that data need to be associated with that source, as do the
tuners used to record those channels.  In your case you only need one
source, for all your DVB-T channels.

In my case I have two sources, one for my DVB-T Freeview channels and
one for my Sky channels via an S-Video input from my Sky box.  EPG for
the Freeview source comes from nzepg.org, and for the Sky source from
EIT data collected using my DVB-S2 tuner.  I think it would be
possible for me to combine the two EPG files and then set things up
with one source, but it is working fine as is.

>> 
>> To safely delete one duplicate set of channel records, we also need to
>> know where the chanid values in those records are being used, and
>> whether they will then need to be changed from 1xxx to 3xxx and vice
>> versus.  I did a dump of the database structure:
>> 
>>   mysqldump -d -u $DBUserName -p$DBPassword -h $DBHostName $DBName
>>> mythconverg_schema.sql
>> 
>> and went searching with my editor to find all references to chanid. As
>> it is the field used to tie together channels and everything else, I
>> was not surprised to find lots of references to it.  Here is the list
>> of tables it is used in:
>> 
>>   channel
>>   channelgroup
>>   credits
>>   eit_cache
>>   inuseprograms
>>   jobqueue
>>   oldrecorded
>>   pidcache
>>   program
>>   programgenres
>>   programrating
>>   record
>>   record_tmp
>>   recorded
>>   recordedcredits
>>   recordedfile
>>   recordedmarkup
>>   recordedprogram
>>   recordedrating
>>   recordedseek
>>   recordmatch
>>   tvchain
>> 
>> So we need to be sure of whether either or both the 1xxx and 3xxx
>> channels have been used in all those tables.  Some, like tvchain and
>> pidcache, I would expect to be empty tables, but there will be lots of
>> rows in most of them.
>> 
>> The results of this script (count_chanids.sh) should tell us where the
>> 1xxx and 3xxx chanid values have been used:
>> 
>> #!/bin/bash
>
>[snip]
>
>Attached the output of that script too
>
>cheers
>Worik

OK, both the 1xxx and 3xxx channels have been used.  But there is much
more in the database for 1xxx, and since that is the one with all but
one of the recording rules (record table), it is likely the one
currently in use and the other data may well be historical.  So it
looks best to keep the 1xxx channels and their source and remove all
the others.  The radio channels will need to be converted from 3xxx to
1xxx

More later when I have had a more detailed look at what fixes are
needed.  I can not see anything that will stop a fix from working, but
there may be quite a bit to do to fix all the old 3xxx channel
references.



More information about the mythtvnz mailing list