UK Channel Assignments

From MythTV Official Wiki
Revision as of 15:28, 8 July 2012 by Steveybaby2 (talk | contribs)

Jump to: navigation, search


It is often preferred by the installer of MythTV to re-arrange the channels numbering, based on what was assigned during the scanning process. As channel scans have to occur regularly to compensate for channel movements and reallocations a script to automate this is preferred.

What follows are three different scripts: a Freeview script which allocates channels to the standard Freeview channel assignments, a FreeSat script that assigns Freesat channels to standard freesat channel number assignments and a combined script (which could be used by freeview or freesat systems as well as combined systems) which allocates numbers in a sky-style manner to three digit channel numbers and into groups by channel genre.

Read all three; some of them have notes to explain why and how they work. The combined Freeview/FreeSat script seems to be more complete and even adds in the xmltv information if you are using xml radio times programme guide feed [[1]].

This is a much faster process than manual reassignment. If everyone contributes their changes back here; where channels have changed this will be a much simpler process for everyone. Each time you rescan for channels you will need to re-run the script - check back here hopefully it has been updated for any recent change and please be aware that when channels move around this script may need changing to prevent two channels wanting the same channel number.

Remember to change the script for your ITV1 regional variation.

The following SQL statements maybe of use: This will hide all channels where there isnt any guide data available.

UPDATE channel SET visible=0 WHERE channel.chanid NOT IN (SELECT DISTINCT(chanid) FROM program);

And; mark no comm-flagging on BBC channels

UPDATE channel set commmethod=-2 WHERE name LIKE '%BBC%' OR name = 'CBeebies';  

A full listing of channels and channel numbers for freeview by region is available from the following official website:

See also Database_editing_script where a template script is provided for other territories.


(For England - Wales, Scotland and Northern Ireland may require minor modifications)

use mythconverg;
update channel set channum=1 where name='BBC ONE';
update channel set channum=2 where name='BBC TWO';
update channel set channum=3 where name='ITV1';
update channel set channum=4 where name='Channel 4';
update channel set channum=5 where name='Channel 5';
update channel set channum=6 where name='ITV2';
update channel set channum=7 where name='BBC THREE';
update channel set channum=9 where name='BBC FOUR';
update channel set channum=10 where name='ITV3';
update channel set channum=11 where name='Pick TV';
update channel set channum=12 where name='Yesterday';
update channel set channum=13 where name='Channel 4+1';
update channel set channum=14 where name='More 4';
update channel set channum=15 where name='Film4';
update channel set channum=16 where name='QVC';
update channel set channum=17 where name='G.O.L.D.';
update channel set channum=18 where name='4Music';
update channel set channum=19 where name='Dave';
update channel set channum=20 where name='Really';
update channel set channum=21 where name='VIVA';
update channel set channum=22 where name='Ideal World';
update channel set channum=23 where name='bid tv';
update channel set channum=24 where name='ITV4';
update channel set channum=25 where name='Dave ja vu';
update channel set channum=26 where name='Home';
update channel set channum=27 where name='ITV2 +1';
update channel set channum=28 where name='E4';
update channel set channum=29 where name='E4+1';
update channel set channum=30 where name='5*';
update channel set channum=31 where name='5 USA';
update channel set channum=32 where name='Big Deal';
update channel set channum=33 where name='ITV1 +1';
update channel set channum=34 where name='ESPN';
update channel set channum=36 where name='Create & Craft';
update channel set channum=37 where name='price-drop tv';
update channel set channum=38 where name='QUEST';
update channel set channum=40 where name='Rocks & Co 1';
update channel set channum=41 where name='Sky Sports 1';
update channel set channum=42 where name='Sky Sports 2';
update channel set channum=43 where name='Gems TV';
update channel set channum=44 where name='Channel 5+1';
update channel set channum=45 where name='Pick TV+1';
update channel set channum=46 where name='Challenge';
update channel set channum=47 where name='Daystar';
update channel set channum=48 where name='QVC Beauty';
update channel set channum=50 where name='BBC One HD';
update channel set channum=51 where name='ITV1 HD';
update channel set channum=52 where name='Channel 4 HD';
update channel set channum=54 where name='BBC HD';
update channel set channum=70 where name='CBBC Channel';
update channel set channum=71 where name='CBeebies';
update channel set channum=72 where name='CITV';
update channel set channum=80 where name='BBC NEWS';
update channel set channum=81 where name='BBC Parliament';
update channel set channum=82 where name='Sky News';
update channel set channum=84 where name='CNN';
update channel set channum=85 where name='Russia Today';
update channel set channum=87 where name='COMMUNITY';
update channel set channum=89 where name='Al Jazeera Eng';
update channel set channum=90 where name='TV News';
update channel set channum=92 where name='ADULT Section';
update channel set channum=93 where name='Television X';
update channel set channum=94 where name='ADULT smileTV2';
update channel set channum=95 where name='ADULT smileTV3';
update channel set channum=96 where name='ADULT Babestn';
update channel set channum=97 where name='ADULT PARTY';
update channel set channum=98 where name='ADULT Blue';
update channel set channum=101 where name='Teletext Hols';
update channel set channum=102 where name='Rabbit';
update channel set channum=103 where name='Gay Rabbit';
update channel set channum=104 where name='1-2-1 Dating';
update channel set channum=105 where name='BBC Red Button';
update channel set channum=108 where name='Sky Text';
update channel set channum=109 where name='MOBILIZER';
update channel set channum=191 where name='ADULT redhotTV';
update channel set channum=192 where name='ADULT Filth';
update channel set channum=301 where name='301';
update channel set channum=303 where name='303';
update channel set channum=306 where name='Channel Zero';
update channel set channum=307 where name='TOPUP Anytime1';
update channel set channum=308 where name='TOPUP Anytime2';
update channel set channum=309 where name='TOPUP Anytime3';
update channel set channum=700 where name='BBC Radio 1';
update channel set channum=701 where name='BBC R1X';
update channel set channum=702 where name='BBC Radio 2';
update channel set channum=703 where name='BBC Radio 3';
update channel set channum=704 where name='BBC Radio 4';
update channel set channum=705 where name='BBC R5L';
update channel set channum=706 where name='BBC R5SX';
update channel set channum=707 where name='BBC 6 Music';
update channel set channum=708 where name='BBC Radio 4 Ex';
update channel set channum=709 where name='BBC Asian Net.';
update channel set channum=710 where name='BBC World Sv.';
update channel set channum=711 where name='The Hits Radio';
update channel set channum=712 where name='Smash Hits!';
update channel set channum=713 where name='Kiss';
update channel set channum=714 where name='heat';
update channel set channum=715 where name='Magic';
update channel set channum=716 where name='Q';
update channel set channum=718 where name='SMOOTH RADIO';
update channel set channum=722 where name='Kerrang!';
update channel set channum=723 where name='talkSPORT';
update channel set channum=724 where name='Capital FM';
update channel set channum=725 where name='Premier Radio';
update channel set channum=727 where name='Absolute Radio';
update channel set channum=728 where name='Heart';


(For the South of England; other regions may require minor modifications. Also note that due to duplicate channel names, this script is not perfect. It also has a few extra channels that I remember people requesting, like Sky News and WTF)

use mythconverg;
update channel SET channum=101 WHERE name='BBC 1 South';
update channel SET channum=102 WHERE name='BBC 2 England';
update channel SET channum=103 WHERE name='ITV1 Meridian S';
update channel SET channum=104 WHERE name='Channel 4';
update channel SET channum=105 WHERE name='Channel 5';
update channel SET channum=106 WHERE name='BBC THREE';
update channel SET channum=107 WHERE name='BBC FOUR';
update channel SET channum=108 WHERE name='BBC One HD';
update channel SET channum=109 WHERE name='BBC HD';
update channel SET channum=110 WHERE name='BBC ALBA';
update channel SET channum=112 WHERE name='ITV1+1';
update channel SET channum=113 WHERE name='ITV2';
update channel SET channum=114 WHERE name='ITV2+1';
update channel SET channum=115 WHERE name='ITV3';
update channel SET channum=116 WHERE name='ITV3+1';
update channel SET channum=117 WHERE name='ITV4';
update channel SET channum=118 WHERE name='ITV4+1';
update channel SET channum=119 WHERE name='ITV1 HD';
update channel SET channum=120 WHERE name='S4C';
update channel SET channum=121 WHERE name='Channel 4 +1';
update channel SET channum=122 WHERE name='E4';
update channel SET channum=123 WHERE name='E4+1';
update channel SET channum=124 WHERE name='More4';
update channel SET channum=125 WHERE name='More4 +1';
update channel SET channum=126 WHERE name='Channel 4 HD';
update channel SET channum=134 WHERE name='CBS Drama';
update channel SET channum=135 WHERE name='CBS Reality';
update channel SET channum=136 WHERE name='CBS Reality+1';
update channel SET channum=137 WHERE name='CBS Action';
update channel SET channum=138 WHERE name='horror channel';
update channel SET channum=139 WHERE name='horror ch+1';
update channel SET channum=140 WHERE name='BET';
update channel SET channum=141 WHERE name='BET +1';
update channel SET channum=142 WHERE name='True Ent';
update channel SET channum=143 WHERE name='Men & Movies';
update channel SET channum=200 WHERE name='BBC NEWS';
update channel SET channum=201 WHERE name='BBC PARLMNT';
update channel SET channum=203 WHERE name='Al Jazeera Eng';
update channel SET channum=204 WHERE name='Euronews';
update channel SET channum=205 WHERE name='France 24';
update channel SET channum=206 WHERE name='Russia Today';
update channel SET channum=207 WHERE name='CNN';
update channel SET channum=208 WHERE name='Bloomberg';
update channel SET channum=209 WHERE name='NHK World HD';
update channel SET channum=210 WHERE name='CNBC';
update channel SET channum=298 WHERE name='Sky News';
update channel SET channum=299 WHERE name='NHK World TV';
update channel SET channum=300 WHERE name='Film4';
update channel SET channum=301 WHERE name='Film4 +1';
update channel SET channum=302 WHERE name='True Movies 1';
update channel SET channum=303 WHERE name='True Movies 2';
update channel SET channum=304 WHERE name='movies4men';
update channel SET channum=305 WHERE name='mov4men+1';
update channel SET channum=306 WHERE name='movies4men 2';
update channel SET channum=307 WHERE name='mov4men2 +1';
update channel SET channum=400 WHERE name='wedding tv';
update channel SET channum=402 WHERE name='Information TV';
update channel SET channum=403 WHERE name='Showcase';
update channel SET channum=405 WHERE name='Food Network';
update channel SET channum=406 WHERE name='Food Netwrk+1';
update channel SET channum=500 WHERE name='Chart Show TV';
update channel SET channum=501 WHERE name='The Vault';
update channel SET channum=502 WHERE name='Flava';
update channel SET channum=503 WHERE name='Scuzz';
update channel SET channum=504 WHERE name='B4U Music';
update channel SET channum=509 WHERE name='Zing';
update channel SET channum=514 WHERE name='Clubland TV';
update channel SET channum=515 WHERE name='Vintage TV';
update channel SET channum=516 WHERE name='NME TV';
update channel SET channum=517 WHERE name='Bliss';
update channel SET channum=599 WHERE name='WTF';
update channel SET channum=600 WHERE name='CBBC Channel';
update channel SET channum=601 WHERE name='CBeebies';
update channel SET channum=602 WHERE name='CITV';
update channel SET channum=603 WHERE name='POP';
update channel SET channum=604 WHERE name='PopGirl';
update channel SET channum=605 WHERE name='Tiny Pop';
update channel SET channum=606 WHERE name='Kix!';
update channel SET channum=650 WHERE name='OceanFinance';
update channel SET channum=651 WHERE name='Renault TV';
update channel SET channum=652 WHERE name='Psychic TV';
update channel SET channum=690 WHERE name='Inspiration';
update channel SET channum=691 WHERE name='DAYSTAR';
update channel SET channum=692 WHERE name='revelation';
update channel SET channum=693 WHERE name='Islam Channel';
update channel SET channum=694 WHERE name='GOD Channel';
update channel SET channum=700 WHERE name='BBC R1';
update channel SET channum=701 WHERE name='BBC R1X';
update channel SET channum=702 WHERE name='BBC R2';
update channel SET channum=703 WHERE name='BBC R3';
update channel SET channum=704 WHERE name='BBC R4 FM';
update channel SET channum=705 WHERE name='BBC R5L';
update channel SET channum=706 WHERE name='BBC R5SX';
update channel SET channum=707 WHERE name='BBC 6 Music';
update channel SET channum=708 WHERE name='BBC R4 Ex';
update channel SET channum=709 WHERE name='BBC Asian';
update channel SET channum=710 WHERE name='BBC R4 LW';
update channel SET channum=711 WHERE name='BBC WS';
update channel SET channum=712 WHERE name='BBC R Scot.';
update channel SET channum=713 WHERE name='BBC R n Gael';
update channel SET channum=714 WHERE name='BBC R Wales';
update channel SET channum=715 WHERE name='BBC R Cymru';
update channel SET channum=716 WHERE name='BBC R Ulster';
update channel SET channum=718 WHERE name='BBC London';
update channel SET channum=719 WHERE name='Capital FM';
update channel SET channum=720 WHERE name='Choice FM';
update channel SET channum=721 WHERE name='Classic FM';
update channel SET channum=722 WHERE name='Gold';
update channel SET channum=723 WHERE name='XFM';
update channel SET channum=724 WHERE name='Absolute';
update channel SET channum=725 WHERE name='Absolute CR';
update channel SET channum=726 WHERE name='Absolute80s';
update channel SET channum=727 WHERE name='NME';
update channel SET channum=728 WHERE name='WRN Europe';
update channel SET channum=729 WHERE name='Jazz FM';
update channel SET channum=730 WHERE name='Planet Rock';
update channel SET channum=731 WHERE name='TalkSport';
update channel SET channum=732 WHERE name='Smooth';
update channel SET channum=733 WHERE name='Heart';
update channel SET channum=750 WHERE name='RTE Radio 1';
update channel SET channum=751 WHERE name='RTE 2FM';
update channel SET channum=752 WHERE name='RTE Lyric fm';
update channel SET channum=753 WHERE name='RTE R na G';
update channel SET channum=777 WHERE name='InsightRadio';
update channel SET channum=786 WHERE name='BFBS Radio';
update channel SET channum=790 WHERE name='TWR';
update channel SET channum=800 WHERE name='QVC';
update channel SET channum=801 WHERE name='price-drop tv';
update channel SET channum=802 WHERE name='bid tv';
update channel SET channum=803 WHERE name='Pitch TV';
update channel SET channum=804 WHERE name='Pitch World';
update channel SET channum=805 WHERE name='Gems TV';
update channel SET channum=806 WHERE name='TV SHOP';
update channel SET channum=807 WHERE name='Jewelry Maker';
update channel SET channum=808 WHERE name='JML';
update channel SET channum=809 WHERE name='JML Choice';
update channel SET channum=810 WHERE name='Ideal Extra';
update channel SET channum=812 WHERE name='Ideal World';
update channel SET channum=813 WHERE name='Create & Craft';
update channel SET channum=814 WHERE name='speedauctiontv';
update channel SET channum=815 WHERE name='Jewellery Ch.';
update channel SET channum=816 WHERE name='QVC Beauty';
update channel SET channum=817 WHERE name='Rocks & Co 1';
update channel SET channum=818 WHERE name='Gems TV Extra';
update channel SET channum=870 WHERE name='Babestation';
update channel SET channum=874 WHERE name='Filth';
update channel SET channum=950 WHERE name='BBC 1 London';
update channel SET channum=951 WHERE name='BBC 1 CI';
update channel SET channum=952 WHERE name='BBC 1 E Mids';
update channel SET channum=953 WHERE name='BBC 1 East (E)';
update channel SET channum=954 WHERE name='BBC 1 East (W)';
update channel SET channum=955 WHERE name='BBC 1 N West';
update channel SET channum=956 WHERE name='BBC 1 NE & C';
update channel SET channum=957 WHERE name='BBC 1 NI';
update channel SET channum=958 WHERE name='BBC 1 Oxford';
update channel SET channum=959 WHERE name='BBC 1 S East';
update channel SET channum=960 WHERE name='BBC 1 Scotland';
update channel SET channum=961 WHERE name='BBC 1 South';
update channel SET channum=962 WHERE name='BBC 1 S West';
update channel SET channum=963 WHERE name='BBC 1 W Mids';
update channel SET channum=964 WHERE name='BBC 1 Wales';
update channel SET channum=965 WHERE name='BBC 1 West';
update channel SET channum=966 WHERE name='BBC 1 Yorks';
update channel SET channum=967 WHERE name='BBC 1 Yrks&Lin';
update channel SET channum=968 WHERE name='BBC 2 England';
update channel SET channum=969 WHERE name='BBC 2 NI';
update channel SET channum=970 WHERE name='BBC 2 Scotland';
update channel SET channum=971 WHERE name='BBC 2 Wales';
update channel SET channum=974 WHERE name='c4 l';
update channel SET channum=977 WHERE name='ITV1 London';
update channel SET channum=986 WHERE name='Teletext';
update channel SET channum=999 WHERE name='Freesat Info';

Combined FreeView and FreeSat HD channel assignment

 -- Script to update channel numbers in a combined Freeview & Freesat system in
 -- the UK. 
 -- This script is based on and inspired by the work of Richard Lainchbury and Stephen Robertson 
 -- posted on the mythtv-users mailing list:
 -- for access to the mailing list see
 -- use this script carefully; have multiple same channels from different sources
 -- on the same channel number is how MythTV is supposed to be configured based on 
 -- a number of posts from developers, but this should be carefully tested.
 -- Ensure you complete a backup of your channel database table before using
 -- script (you can use the -h option to select an alternative server if not 
 -- running locally):
 -- $ mysqldump -uroot -p > `date +%d%m%y`-channel.sql
 -- to restore the backup:
 -- mysql -uroot -p --database mythconverg < `date +%d%m%y`-channel.sql
 -- to run this channel altering script:
 -- mysql -uroot -p -h192.168.0.2 --database mythconverg < alter-channels.sql
 -- run mythfilldatabase after you have made these changes.
 -- Why would you do this:
 -- channels which have the same name and callsign are treated as being EXACTLY
 -- the same channel by mythtv. To get them to only appear once, we set them as
 -- having the same channum as well.
 -- for instance Freeview ITV in in fact the regional variation of ITV for the
 -- broadcast area; such as Meridian south. On Freesat ITV1 Meridian South is 
 -- broadcast alongside ITV1 Grenada and all the other variations. In order for
 -- mythtv to know what channels are equal, we disregard all the other regional
 -- variations and set Meridian south as having the same name as the freeview
 -- channel ITV1. This has two drawbacks; 1. reduces the opportunity for Mythtv
 -- to use multi-record if an alternative regional variation is on a multiplexes
 -- that would permit a second channel to be recorded. 2. There maybe a 
 -- programme broadcast on a regional variation that you would have been 
 -- interested in. The benefit is a much easier to manage EPG.
 -- WARNING: If you are using broadcast EPG information (EIT) then the channels
 -- that are paired; e.g. Five on satellite and Five on terrestrial are both on
 -- channel number 5; the EPG information must be identical. If you have issues
 -- with 'NO DATA' assign each individual channel instance in the MythWeb
 -- channel editor to a separate number to identify which instance is creating
 -- an issue.
 -- How does this script do it
 -- move all the channels to numbers well outside the normal range (+100000) to
 -- their current number and set them as hidden; we will then go through and
 -- assign sensible numbers to those channels we would like to see in the EPG 
 -- and at the same time mark those channels visible.
 -- After moving all the channels out of the way there are only three different 
 -- statements in this script; 
 -- 1. Correct the naming of channels
 -- 2. For all the channels of the same name assign the same channel number 
 -- 3. the last statement in this script sets all the BBC channels as not 
 --    requiring commercial flagging as they don't carry adverts.
 UPDATE channel SET channum = channum+100000, visible=FALSE;
 -- Entertainment;
 #UPDATE channel SET name='BBC One', callsign='BBC One' WHERE name='BBC ONE Scot';
 #UPDATE channel SET name='BBC One', callsign='BBC One' WHERE name='BBC 1 Scotland';
 #UPDATE channel SET channum=101, visible=1 WHERE name='BBC One'; 
 UPDATE channel SET name='BBC One', callsign='BBC One' WHERE name='BBC 1 South';
 UPDATE channel SET name='BBC One', callsign='BBC One' WHERE name='BBC ONE';
 UPDATE channel SET channum=101, visible=1, xmltvid="" WHERE name='BBC One'; 
 #UPDATE channel SET name='BBC Two', callsign='BBC Two' WHERE name='BBC 2 Scotland';
 #UPDATE channel SET name='BBC Two', callsign='BBC Two' WHERE name='BBC TWO Scot';
 #UPDATE channel SET channum=102, visible=1 WHERE name='BBC Two';
 UPDATE channel SET name='BBC Two', callsign='BBC Two' WHERE name='BBC 2 England';
 UPDATE channel SET name='BBC Two', callsign='BBC Two' WHERE name='BBC TWO';
 UPDATE channel SET channum=102, visible=1, xmltvid="" WHERE name='BBC Two';
 #UPDATE channel SET name='STV', callsign='STV' WHERE name='STV';
 #UPDATE channel SET channum=103, visible=1 WHERE name='STV';
 UPDATE channel SET name='ITV1', callsign='ITV1' WHERE name='ITV1 Meridian S';
 UPDATE channel SET channum=103, visible=1, xmltvid=""  WHERE name='ITV1';
 UPDATE channel SET name='Channel4', callsign='Channel4' WHERE name='Channel 4';
 UPDATE channel SET channum=104, visible=1, xmltvid="" WHERE name='Channel4';
 UPDATE channel SET name='Channel5', callsign='Channel5' WHERE name='Channel 5';
 UPDATE channel SET channum=105, visible=1, xmltvid="" WHERE name='Channel5';
 UPDATE channel SET name='BBC Three', callsign='BBC Three' WHERE name='BBC THREE';
 UPDATE channel SET channum=106, visible=1, xmltvid="" WHERE name='BBC Three';
 UPDATE channel SET name='BBC Four', callsign='BBC Four' WHERE name='BBC FOUR';
 UPDATE channel SET channum=107, visible=1, xmltvid="" WHERE name='BBC Four';
 UPDATE channel SET channum=108, visible=1, xmltvid="" WHERE name='BBC HD';
 UPDATE channel SET name='BBC One HD', callsign='BBC One HD' WHERE name='BBC1 HD';
 UPDATE channel SET channum=109, visible=1, xmltvid="" WHERE name='BBC One HD';
 UPDATE channel SET channum=110, visible=1, xmltvid="" WHERE name='BBC Alba';
 UPDATE channel SET channum=111, visible=1, xmltvid="" WHERE name='Dave'; 
 UPDATE channel SET channum=112, visible=1, xmltvid="" WHERE name='Dave ja vu'; 
 UPDATE channel SET channum=113, visible=1, xmltvid="" WHERE name='ITV2';
 UPDATE channel SET name='ITV2 +1', callsign='ITV2 +1' WHERE name='ITV2+1';
 UPDATE channel SET channum=114, visible=1, xmltvid="" WHERE name='ITV2 +1';
 UPDATE channel SET channum=115, visible=1, xmltvid="" WHERE name='ITV3';
 UPDATE channel SET name='ITV3 +1', callsign='ITV3 +1' WHERE name='ITV3+1';
 UPDATE channel SET channum=116, visible=1, xmltvid="" WHERE name='ITV3 +1';
 UPDATE channel SET channum=117, visible=1, xmltvid="" WHERE name='ITV4';
 UPDATE channel SET name='ITV4 +1', callsign='ITV4 +1' WHERE name='ITV4+1';
 UPDATE channel SET channum=118, visible=1, xmltvid="" WHERE name='ITV4 +1';
 UPDATE channel SET channum=119, visible=1, xmltvid="" WHERE name='ITV1 HD';
 #UPDATE channel SET channum=120 WHERE name='S4C Digidol';
 UPDATE channel SET name='Channel4 +1', callsign='Channel4 +1' WHERE name='Channel 4 +1';
 UPDATE channel SET name='Channel4 +1', callsign='Channel4 +1' WHERE name='Channel 4+1';
 UPDATE channel SET channum=121, visible=1, xmltvid="" WHERE name='Channel4 +1';
 UPDATE channel SET name='E4', callsign='E4' WHERE name='e4';
 UPDATE channel SET channum=122, visible=1, xmltvid="" WHERE name='E4';
 UPDATE channel SET name='E4 +1', callsign='E4 +1' WHERE name='E4+1';
 UPDATE channel SET channum=123, visible=1, xmltvid="" WHERE name='E4 +1';
 UPDATE channel SET name='More4', callsign='More4' WHERE name='More 4';
 UPDATE channel SET channum=124, visible=1, xmltvid="" WHERE name='More4';
 UPDATE channel SET channum=125, visible=1, xmltvid="" WHERE name='More4 +1';
 UPDATE channel SET channum=126, visible=1 WHERE name='Channel 4 HD';
 #UPDATE channel SET channum=127, visible=1, xmltvid="" WHERE name='Channel One';
 UPDATE channel SET channum=127, visible=1 WHERE name='Home';
 UPDATE channel SET name='Quest', callsign='Quest' WHERE name='QUEST';
 UPDATE channel SET channum=128, visible=1, xmltvid="" WHERE name='Quest'; 
 UPDATE channel SET channum=129, visible=1, xmltvid="" WHERE name='Yesterday'; 
 UPDATE channel SET channum=130, visible=1, xmltvid="" WHERE name='G.O.L.D.'; 
 UPDATE channel SET name='Sky3', callsign='Sky3' WHERE name='SKY THREE';
 UPDATE channel SET channum=131, visible=1, xmltvid="" WHERE name='Sky3';  
 UPDATE channel SET channum=132, visible=1, xmltvid="" WHERE name='5*'; 
 UPDATE channel SET channum=133, visible=1, xmltvid="" WHERE name='5 USA'; 
 UPDATE channel SET channum=134, visible=1, xmltvid="" WHERE name='CBS Drama';
 UPDATE channel SET channum=135, visible=1, xmltvid="" WHERE name='CBS Reality';
 UPDATE channel SET name='CBS Reality +1', callsign='CBS Reality +1' WHERE name='CBS Reality+1';
 UPDATE channel SET channum=136, visible=1, xmltvid="" WHERE name='CBS Reality +1';
 UPDATE channel SET channum=137, visible=1, xmltvid="" WHERE name='CBS Action';
 UPDATE channel SET name='Horror Channel', callsign='Horror Channel' WHERE name='Horror Channel';
 UPDATE channel SET channum=138, visible=1, xmltvid="" WHERE name='Horror Channel';
 UPDATE channel SET name='Horror Channel +1', callsign='Horror Channel +1' WHERE name='Horror Ch+1';
 UPDATE channel SET channum=139, visible=1, xmltvid="" WHERE name='Horror Channel +1';
 #UPDATE channel SET name='STV +1', callsign='STV +1' WHERE name='STV+1';
 #UPDATE channel SET channum=140, visible=1 WHERE name='STV +1';
 UPDATE channel SET name='ITV1 +1', callsign='ITV1 +1' WHERE name='ITV1+1';
 UPDATE channel SET channum=140, visible=1, xmltvid="" WHERE name='ITV1 +1';
 UPDATE channel SET name='Channel5 +1', callsign='Channel5 +1' WHERE name='Channel 5+1';
 UPDATE channel SET channum=141, visible=1 WHERE name='Channel5 +1';
 UPDATE channel SET channum=142, visible=1 WHERE name='5* +1';
 UPDATE channel SET channum=143, visible=1 WHERE name='5 USA +1';

 -- News and Sport
 UPDATE channel SET channum=200, visible=1, xmltvid="" WHERE name='BBC News';
 UPDATE channel SET name='BBC Parliament', callsign='BBC Parliament' WHERE name='BBC PARL''MNT';
 UPDATE channel SET channum=201, visible=1, xmltvid="" WHERE name='BBC Parliament';
 #UPDATE channel SET channum=202, visible=1, xmltvid="" WHERE name='S4C2';
 UPDATE channel SET name='Al Jazeera English', callsign='Al Jazeera English' WHERE name='Al Jazeera Eng';
 UPDATE channel SET channum=203, visible=1, xmltvid="" WHERE name='Al Jazeera English';
 UPDATE channel SET channum=204, visible=1, xmltvid="" WHERE name='EuroNews';
 UPDATE channel SET name='CNN International', callsign='CNN International' WHERE name='CNN';
 UPDATE channel SET channum=206, visible=1 WHERE name='Russia Today';
 UPDATE channel SET channum=207, visible=1, xmltvid="" WHERE name='CNN International';
 UPDATE channel SET name='Bloomberg Television', callsign='Bloomberg Television' WHERE name='Bloomberg';
 UPDATE channel SET channum=208, visible=1, xmltvid="" WHERE name='Bloomberg Television';
 UPDATE channel SET channum=209, visible=1, xmltvid="" WHERE name='NHK World TV';
 UPDATE channel SET channum=210, visible=1, xmltvid="" WHERE name='CNBC';
 UPDATE channel SET channum=211, visible=1, xmltvid="" WHERE name='Sky News'; 
 -- Movies;
 UPDATE channel SET channum=300, visible=1, xmltvid="" WHERE name='Film4';
 UPDATE channel SET channum=301, visible=1, xmltvid="" WHERE name='Film4 +1';
 UPDATE channel SET channum=302, visible=1, xmltvid="" WHERE name='True Movies 1';
 UPDATE channel SET channum=303, visible=1, xmltvid="" WHERE name='True Movies 2';
 UPDATE channel SET channum=304, visible=1, xmltvid="" WHERE name='Movies4Men';
 UPDATE channel SET channum=306, visible=1, xmltvid="" WHERE name='Movies4Men 2';
 UPDATE channel SET name='Movies4Men +1', callsign='Movies4Men +1' WHERE name='mov4men+1';
 UPDATE channel SET channum=307, visible=1 WHERE name='Movies4Men +1';
 UPDATE channel SET name='Movies4Men 2 +1', callsign='Movies4Men 2 +1' WHERE name='mov4men2 +1';
 UPDATE channel SET channum=308, visible=1, xmltvid="" WHERE name='Movies4Men 2 +1';
 UPDATE channel SET name='Men & Movies', callsign='Men & Movies' WHERE name='men&movies';
 UPDATE channel SET channum=309, visible=1 WHERE name='Men & Movies';
 UPDATE channel SET name='Men & Movies +1', callsign='Men & Movies +1' WHERE name='men&movs+1';
 UPDATE channel SET channum=310, visible=1 WHERE name='Men & Movies +1';
 -- Lifestyle;
 #UPDATE channel SET channum=400, visible=1, xmltvid="" WHERE name='Wedding TV';
 #UPDATE channel SET channum=401, visible=1 WHERE name='Wedding TV Asia';
 #UPDATE channel SET channum=402, visible=1, xmltvid="" WHERE name='Information TV';
 #UPDATE channel SET channum=403, visible=1 WHERE name='Rural TV';
 #UPDATE channel SET channum=405, visible=1, xmltvid="" WHERE name='Food Network';
 #UPDATE channel SET name='Food Network +1', callsign='Food Network +1' WHERE name='Food Netwrk+1';
 #UPDATE channel SET channum=406, visible=1, xmltvid="" WHERE name='Food Network +1';
 -- Music;
 UPDATE channel SET channum=500, visible=1, xmltvid="" WHERE name='Chart Show TV';
 UPDATE channel SET channum=501, visible=1, xmltvid="" WHERE name='The Vault';
 UPDATE channel SET channum=502, visible=1, xmltvid="" WHERE name='Flava';
 UPDATE channel SET channum=503, visible=1, xmltvid="" WHERE name='VIVA';
 UPDATE channel SET channum=504, visible=1, xmltvid="" WHERE name='B4U Music';
 UPDATE channel SET channum=505, visible=1, xmltvid="" WHERE name='4Music';
 UPDATE channel SET channum=509, visible=1 WHERE name='Zing';
 UPDATE channel SET channum=514, visible=1 WHERE name='Clubland TV';
 UPDATE channel SET channum=516, visible=1, xmltvid="" WHERE name='Scuzz';
 UPDATE channel SET channum=517, visible=1, xmltvid="" WHERE name='Bliss';
 UPDATE channel SET channum=518, visible=1 WHERE name='DanceNationTV';
 -- Children;
 UPDATE channel SET name='CBBC', callsign='CBBC' WHERE name='CBBC Channel';
 UPDATE channel SET channum=600, visible=1, xmltvid="" WHERE name='CBBC';
 UPDATE channel SET channum=601, visible=1, xmltvid="" WHERE name='CBeebies';
 UPDATE channel SET channum=602, visible=1, xmltvid="" WHERE name='CITV';
 UPDATE channel SET channum=603, visible=1, xmltvid="" WHERE name='POP';
 UPDATE channel SET channum=604, visible=1, xmltvid="" WHERE name='Tiny Pop';
 UPDATE channel SET channum=605, visible=1, xmltvid="" WHERE name='Tiny Pop +1';
 UPDATE channel SET channum=606, visible=1 WHERE name='Kix!';
 UPDATE channel SET channum=607, visible=1 WHERE name='PopGirl';
 UPDATE channel SET channum=608, visible=1 WHERE name='PopGirl +1';
 UPDATE channel SET name='Jazeera Children', callsign='Jazeera Children' WHERE name='JazeeraChildren';
 UPDATE channel SET channum=610, visible=1 WHERE name='Jazeera Children';
 -- Special Interest;
 UPDATE channel SET channum=690, visible=1 WHERE name='Inspiration';
 UPDATE channel SET channum=691, visible=1 WHERE name='Daystar TV';
 -- Radio;
 UPDATE channel SET name='BBC Radio 1', callsign='BBC Radio 1' WHERE name='BBC R1';
 UPDATE channel SET channum=700, visible=1 WHERE name='BBC Radio 1';
 UPDATE channel SET name='BBC Radio 1Xtra', callsign='BBC Radio 1Xtra' WHERE name='BBC 1Xtra';
 UPDATE channel SET name='BBC Radio 1Xtra', callsign='BBC Radio 1Xtra' WHERE name='BBC R1X';
 UPDATE channel SET channum=701, visible=1 WHERE name='BBC Radio 1Xtra';
 UPDATE channel SET name='BBC Radio 2', callsign='BBC Radio 2' WHERE name='BBC R2';
 UPDATE channel SET channum=702, visible=1 WHERE name='BBC Radio 2';
 UPDATE channel SET name='BBC Radio 3', callsign='BBC Radio 3' WHERE name='BBC R3';
 UPDATE channel SET channum=703, visible=1 WHERE name='BBC Radio 3';
 UPDATE channel SET name='BBC Radio 4', callsign='BBC Radio 4' WHERE name='BBC R4 FM';
 UPDATE channel SET channum=704, visible=1 WHERE name='BBC Radio 4';
 UPDATE channel SET name='BBC Radio 5 Live', callsign='BBC Radio 5 Live' WHERE name='BBC R5L';
 UPDATE channel SET channum=705, visible=1 WHERE name='BBC Radio 5 Live';
 UPDATE channel SET name='BBC Radio 5 Live Sports Extra', callsign='BBC Radio 5 Live Sports Extra' WHERE name='BBC R5SX';
 UPDATE channel SET channum=706, visible=1 WHERE name='BBC Radio 5 Live Sports Extra';
 UPDATE channel SET channum=707, visible=1 WHERE name='BBC 6 Music';
 UPDATE channel SET channum=708, visible=1 WHERE name='BBC Radio 7';
 UPDATE channel SET name='BBC Asian Network', callsign='BBC Asian Network' WHERE name='BBC Asian Net.';
 UPDATE channel SET name='BBC Asian Network', callsign='BBC Asian Network' WHERE name='BBC Asian';
 UPDATE channel SET channum=709, visible=1 WHERE name='BBC Asian Network';
 UPDATE channel SET name='BBC Radio 4 LW', callsign='BBC Radio 4 LW' WHERE name='BBC R4 LW';
 UPDATE channel SET channum=710, visible=1 WHERE name='BBC Radio 4 LW';
 UPDATE channel SET name='BBC World Service', callsign='BBC World Service' WHERE name='BBC World Sv.';
 UPDATE channel SET channum=711, visible=1 WHERE name='BBC World Service';
 UPDATE channel SET name='BBC Radio 4 Extra', callsign='BBC Radio 4 Extra' WHERE name='BBC Radio 4 Ex';
 UPDATE channel SET name='BBC Radio 4 Extra', callsign='BBC Radio 4 Extra' WHERE name='BBC R4 Ex';
 UPDATE channel SET channum=712, visible=1 WHERE name='BBC Radio 4 Extra';
 UPDATE channel SET name='BBC Radio Scotland', callsign='BBC Radio Scotland' WHERE name='BBC R Scotland';
 UPDATE channel SET name='BBC Radio Scotland', callsign='BBC Radio Scotland' WHERE name='BBC R Scot.';
 UPDATE channel SET channum=713, visible=1 WHERE name='BBC Radio Scotland';
 UPDATE channel SET name='BBC Radio Wales', callsign='BBC Radio Wales' WHERE name='BBC R Wales';
 UPDATE channel SET channum=714, visible=1 WHERE name='BBC Radio Wales';
 UPDATE channel SET name='BBC Radio Ulster', callsign='BBC Radio Ulster' WHERE name='BBC R Ulster';
 UPDATE channel SET channum=715, visible=1 WHERE name='BBC Radio Ulster';
 UPDATE channel SET name='BBC Radio London', callsign='BBC Radio London' WHERE name='BBC  London';
 UPDATE channel SET channum=716, visible=1 WHERE name='BBC Radio London';
 UPDATE channel SET channum=720, visible=1 WHERE name='Choice FM';
 UPDATE channel SET channum=721, visible=1 WHERE name='Classic FM';
 UPDATE channel SET channum=722, visible=1 WHERE name='Gold';
 UPDATE channel SET channum=723, visible=1 WHERE name='Xfm London';
 UPDATE channel SET channum=724, visible=1 WHERE name='Absolute Radio';
 UPDATE channel SET name='Absolute Classic Rock', callsign='Absolute Classic Rock' WHERE name='absolute CR';
 UPDATE channel SET channum=725, visible=1 WHERE name='Absolute Classic Rock';
 UPDATE channel SET name='Absolute 80s', callsign='Absolute 80s' WHERE name='absolute80s';
 UPDATE channel SET channum=726, visible=1 WHERE name='Absolute 80s';
 UPDATE channel SET name='NME Radio', callsign='NME Radio' WHERE name='NME';
 UPDATE channel SET channum=727, visible=1 WHERE name='NME Radio';
 UPDATE channel SET name='WRN Radio', callsign='WRN Radio' WHERE name='WRN europe';
 UPDATE channel SET channum=728, visible=1 WHERE name='WRN Radio';
 UPDATE channel SET channum=729, visible=1 WHERE name='Jazz FM';
 UPDATE channel SET channum=730, visible=1 WHERE name='Planet Rock';
 UPDATE channel SET channum=731, visible=1 WHERE name='Talksport';
 UPDATE channel SET channum=732, visible=1 WHERE name='Q';
 UPDATE channel SET channum=733, visible=1 WHERE name='Magic';
 UPDATE channel SET channum=734, visible=1 WHERE name='The Hits Radio';
 UPDATE channel SET channum=735, visible=1 WHERE name='Smooth Radio';
 UPDATE channel SET channum=736, visible=1 WHERE name='Kerrang!';
 UPDATE channel SET channum=737, visible=1 WHERE name='heat';
 UPDATE channel SET channum=738, visible=1 WHERE name='Kiss';
 UPDATE channel SET channum=738, visible=1 WHERE name='Heart';
 UPDATE channel SET channum=738, visible=1 WHERE name='Smash Hits!';
 UPDATE channel SET channum=750, visible=1 WHERE name='RTE Radio 1';
 UPDATE channel SET name='Insight Radio', callsign='Insight Radio' WHERE name='insightradio';
 UPDATE channel SET channum=777, visible=1 WHERE name='Insight Radio';
 UPDATE channel SET channum=786, visible=1 WHERE name='BFBS Radio';
 UPDATE channel SET channum=790, visible=1 WHERE name='TWR';
 -- Shopping;
 #UPDATE channel SET channum=800, visible=1, xmltvid="" WHERE name='QVC';
 #UPDATE channel SET channum=801, visible=1, xmltvid="" WHERE name='price-drop tv';
 #UPDATE channel SET channum=802, visible=1, xmltvid="" WHERE name='bid tv';
 #UPDATE channel SET channum=803, visible=1 WHERE name='Pitch TV';
 #UPDATE channel SET channum=804, visible=1, xmltvid="" WHERE name='Gems TV';
 #UPDATE channel SET channum=805, visible=1 WHERE name='TV Shop';
 #UPDATE channel SET channum=806, visible=1 WHERE name='JML Home & DIY';
 #UPDATE channel SET channum=807, visible=1 WHERE name='JML Choice';
 #UPDATE channel SET channum=808, visible=1 WHERE name='JML Direct';
 #UPDATE channel SET channum=809, visible=1 WHERE name='JML Cookshop';
 #UPDATE channel SET channum=810, visible=1 WHERE name='Thane Direct';
 #UPDATE channel SET channum=812, visible=1, xmltvid="" WHERE name='Ideal World';
 #UPDATE channel SET channum=813, visible=1 WHERE name='Create & Craft';
 #UPDATE channel SET name='Speed Auction TV', callsign='Speed Auction TV' WHERE name='speedauctiontv';
 #UPDATE channel SET channum=814, visible=1 WHERE name='Speed Auction TV';
 #UPDATE channel SET name='The Jewellery Channel', callsign='The Jewellery Channel' WHERE name='Jewellery ch.';
 #UPDATE channel SET channum=815, visible=1 WHERE name='The Jewellery Channel';
 #UPDATE channel SET channum=816, visible=1 WHERE name='QVC Beauty';
 #UPDATE channel SET channum=817, visible=1 WHERE name='Rocks & Co 1';
 -- Gaming and Dating;
 -- Adult;
 #UPDATE channel SET name='Babestation', callsign='Babestation' WHERE name='ADULT Babestn';
 #UPDATE channel SET channum=870, visible=1 WHERE name='Babestation';
 #UPDATE channel SET name='SmileTV2', callsign='SmileTV2' WHERE name='ADULT smileTV2';
 #UPDATE channel SET channum=872, visible=1 WHERE name='SmileTV2';
 #UPDATE channel SET name='SmileTV3', callsign='SmileTV3' WHERE name='ADULT smileTV3';
 #UPDATE channel SET channum=873, visible=1 WHERE name='SmileTV3';
 #UPDATE channel SET channum=874, visible=1 WHERE name='Television X';
 #UPDATE channel SET name='PARTY', callsign='PARTY' WHERE name='ADULT PARTY';
 #UPDATE channel SET channum=875, visible=1 WHERE name='PARTY';
 #UPDATE channel SET name='TMTV', callsign='TMTV' WHERE name='ADULT TMTV';
 #UPDATE channel SET channum=876, visible=1 WHERE name='TMTV';
 #UPDATE channel SET name='Filth', callsign='Filth' WHERE name='ADULT Filth';
 #UPDATE channel SET channum=877, visible=1 WHERE name='Filth';
 #UPDATE channel SET name='Bluekiss', callsign='Bluekiss' WHERE name='ADULT Bluekiss';
 #UPDATE channel SET channum=878, visible=1 WHERE name='Bluekiss';
 #UPDATE channel SET name='Redhot TV', callsign='Redhot TV' WHERE name='ADULT redhotTv';
 #UPDATE channel SET channum=879, visible=1 WHERE name='Redhot TV';
 -- Testing;
 UPDATE channel SET name='BBC Sport Interactive', callsign='BBC Sport Interactive' WHERE name='BBC Red Button';
 UPDATE channel SET name='BBC Sport Interactive', callsign='BBC Sport Interactive' WHERE name='BBC Sport Interactive: BBC1';
 UPDATE channel SET channum=900, visible=1, xmltvid="" WHERE name='BBC Sport Interactive';
 UPDATE channel SET name='BBC Sport Interactive: BBC1', callsign='BBC Sport Interactive: BBC1' WHERE name='301';
 UPDATE channel SET channum=901, visible=1, xmltvid="" WHERE name='301';
 UPDATE channel SET name='BBC Sport Interactive: BBC2', callsign='BBC Sport Interactive: BBC2' WHERE name='302';
 UPDATE channel SET channum=902, visible=1, xmltvid="" WHERE name='BBC Sport Interactive: BBC2';
 UPDATE channel SET name='BBC Sport Interactive: BBC3', callsign='BBC Sport Interactive: BBC3' WHERE name='303';
 UPDATE channel SET channum=903, visible=1, xmltvid="" WHERE name='BBC Sport Interactive: BBC3';

-- Regions;
 #UPDATE channel SET channum=910, visible=1 WHERE name = 'BBC 1 CI';
 #UPDATE channel SET channum=911, visible=1 WHERE name = 'BBC 1 E Mids';
 #UPDATE channel SET channum=912, visible=1 WHERE name = 'BBC 1 East (E)';
 #UPDATE channel SET channum=913, visible=1 WHERE name = 'BBC 1 East (W)';
 #UPDATE channel SET channum=914, visible=1 WHERE name = 'BBC 1 London';
 #UPDATE channel SET channum=915, visible=1 WHERE name = 'BBC 1 N West';
 #UPDATE channel SET channum=916, visible=1 WHERE name = 'BBC 1 NE & C';
 #UPDATE channel SET channum=917, visible=1 WHERE name = 'BBC 1 NI';
 #UPDATE channel SET channum=918, visible=1 WHERE name = 'BBC 1 Oxford';
 #UPDATE channel SET channum=919, visible=1 WHERE name = 'BBC 1 S East';
 #UPDATE channel SET channum=920, visible=1 WHERE name = 'BBC 1 S West';
 #UPDATE channel SET channum=921, visible=1 WHERE name = 'BBC 1 South';
 #UPDATE channel SET channum=922, visible=1 WHERE name = 'BBC 1 W Mids';
 #UPDATE channel SET channum=923, visible=1 WHERE name = 'BBC 1 Wales';
 #UPDATE channel SET channum=924, visible=1 WHERE name = 'BBC 1 West';
 #UPDATE channel SET channum=925, visible=1 WHERE name = 'BBC 1 Yorks';
 #UPDATE channel SET channum=926, visible=1 WHERE name = 'BBC 1 Yrks&Lin';
 #UPDATE channel SET channum=927, visible=1 WHERE name = 'BBC 2 England';
 #UPDATE channel SET channum=928, visible=1 WHERE name = 'BBC 2 NI';
 #UPDATE channel SET channum=929, visible=1 WHERE name = 'BBC 2 Wales';

 #UPDATE channel SET channum=940, visible=1 WHERE name = 'ITV1 Wales';
 #UPDATE channel SET channum=941, visible=1 WHERE name = 'ITV1 West';
 #UPDATE channel SET channum=942, visible=1 WHERE name = 'ITV1 W Country';
 #UPDATE channel SET channum=943, visible=1 WHERE name = 'ITV1+1';
 #UPDATE channel SET channum=944, visible=1 WHERE name = 'ITV1 London';
 #UPDATE channel SET channum=945, visible=1 WHERE name = 'ITV1 Granada';
 #UPDATE channel SET channum=946, visible=1 WHERE name = 'ITV1 Anglia E';
 #UPDATE channel SET channum=947, visible=1 WHERE name = 'ITV1 Central W';
 #UPDATE channel SET channum=948, visible=1 WHERE name = 'ITV1 Border';
 #UPDATE channel SET channum=948, visible=1 WHERE name = 'ITV1 Tyne Tees';
 #UPDATE channel SET channum=949, visible=1 WHERE name = 'ITV1 Meridian S';
 #UPDATE channel SET channum=950, visible=1 WHERE name = 'ITV1 Mer SE';
 #UPDATE channel SET channum=951, visible=1 WHERE name = 'ITV1 Yorks W';
 #UPDATE channel SET channum=952, visible=1 WHERE name = 'ITV Channel Is';
 #UPDATE channel SET channum=953, visible=1 WHERE name = 'UTV';
 #UPDATE channel SET channum=954, visible=1 WHERE name = 'ITV1 Central S';
 #UPDATE channel SET channum=955, visible=1 WHERE name = 'ITV1 Central E';
-- Mark BBC channels as addfree and not requiring commercial flagging.
UPDATE channel SET commmethod=-2 WHERE name LIKE '%BBC%' OR name = 'CBeebies';

-- Set Default Channel to a valid entry
UPDATE settings SET data=(SELECT channum FROM channel WHERE channum > 100 ORDER BY channum ASC LIMIT 1) WHERE value='DefaultTVChannel';

-- Set Smart Channel Changing (instant change on 3rd Digit)
UPDATE settings SET data = 1 WHERE value='SmartChannelChange';

Alternative - bash script SQL generator

An alternative method to using the SQL above is to generate a customised channel list yourself, using the bash scripts provided on (the latest of which can be found here). The script will produce the SQL to feed straight into mysql, and aims to keep the Freeview numbering, fitting Freesat HD channels around this. Once you've got your list of channels, icons, and mappings between relevant SD and HD channel names, its just a case of updating this whenever the lineup changes, rather than changing the SQL. The usual disclaimers apply, test this first and backup your database.