Scanning channels mythtv and mysql notes

One of the issues with (UK based) mythtv is the bewildering set of results you get when doing a channel scan with either freeview of freesat tuners. On freeview in particular now that signals from transmitters are being increased (where analogue is switched off) there is the likelihood that a full channel scan will result in at least two full duplicate sets of channels.

One solution for freeview is to scan only the ‘tranports’ that you want. This is an option in ‘scan configuration’ of mythbackend-setup. 
but perhaps a neater one (with thanks to ) is to always do the full channel scan then simply run this mysql statement, changing the freqid’s to match your transmitter:
DELETE FROM channel WHERE (freqid NOT IN (41, 44, 47, 48, 51, 52) AND freqid IS NOT NULL);
You can get the freqid info from here: 
Determine which TV transmitter you’re getting your signal from. My 6 digital multiplexes are: 41, 44, 47, 48, 51, 52

Liskeard update: muxes now: 21, 22, 25, 25, 27, 28, 30, 31, 37

Here’s some notes re: the mythconverg mysql database:

The most pertinent table re: ensuring channels get setup up right is ‘channel’

I have normally created separate ‘sources’ (FreeView EIT & FreeSat EIT) for the two types of broadcast (ie DVB-S and DVB-T). In the ‘channel’ table you can distinguish between DVB-S and T by looking at the sourceid field.

UPDATE channel SET channum=101, visible=1, xmltvid=""            WHERE sourceid="2" AND serviceid="10301"; #'BBC 1 West Midlands';

field ‘channum’ is the channel number used by mythtv in the epg and live TV etc. 

field ‘channid’ – It’s confusing!
Explanation: with my 2x DBV-T and 2x DVB-S tuner setup I have (in theory) four tunings of BBC1, myth knows about all four because firstly, the T and S versions are distinguished by having different ‘sourceid’. The 2 x BBC1 within the (eg) T tuner are distiguised by having different ‘channid’. (these are made unique during tuning when the channel scanner tells you there is a duplication of channid, myths ‘suggestion’ of the alternative is how it get’s set differently). Myth knows they are both BBC1 because they have the same (prescribed) ‘serviceid’ SID info comes from the channel scan. BBC1 on freesat and freeview will have different SIDs.

An added complication to this is that the DVB-T tuner can get multiple versions of BBC1 (etc) from different parts of the tuning freq (from weaker TXs further away). This is why the freqid field (unique to DVB-T) is helpful in eliminating those weaker versions of channels (the mysql ‘DELETE FROM script above sorts this, but you must know which multiplexes your correct main TXer is using)

The above has resulted in a channel_change.sql text file (in markp/technical/mythtv) containing sql statements for channel configuration of a mythtv setup that contains both dvb-t and dbv-s tuners.

Note that this version of the file is for the Yorkshire (Emley Moor) tv transmitter. change regional BBC and ITV channel accordingly (BBC1 and ITV1).

Need to ensure freesat region variations match the freeview ones:
Which freesat ITV1 channel?? – Emley Moor, my freeview source transmits Yorkshire West, the freesat SID of which is 10160.  i have noted some of the regional freesat stations in the file.

fresat SIDs listed here:

To bring up the mysql command prompt for the mythtv database:
mysql -u root -p mythconverg;

the statements file can be ‘run’ from a mysql prompt with the simple command ‘source’ eg:

mysql> source /path/to/file/channel_change.sql

The statement file didn’t work at first and that was because the first statement which sets all channels to a high number and invisible was commented out. Amended it works well and produces a neat list of channels.

Two other issues now.
1. Am I better using rt-grabber (xmltv) for guide info? probably help if I would like to assign both freeview and freesat channels to the same channum, as some say is possible (the EPG looks much neater then)
2. Should I use same channum for freesat and freeview???