Migrating to Schedules Direct in the UK

From MythTV Official Wiki
Jump to: navigation, search

This is a write up from memory of the main steps taken to set up Schedules Direct (SD) for a UK configuration, especially with respect to converting old Radio Times (RT) or Atlas feed configurations, both of which will be becoming unavailable at time of writing.

Back up your database. I take no responsibility for mistake or errors below or on your part - double check everything!

Create an account on Schedules Direct

Go to http://schedulesdirect.org/ and create an account; you get a 7 day free trial, which you can and should extend by a year (US$25) once you know it works for you. You'll need your username and password.

You do not need to do anything else on their website, the line-up configuration is all done by the grabber script.

Acquire XMLTV with tv_grab_zz_json

This step, which is beyond the scope of this article (somewhat unfortunately since it's not a small step) is to acquire the latest version of XMLTV containing a working tv_grab_zz_json

On most distros this means installing an xmltv-grabbers and/or xmltv packages.

Configure your feeds for the first time


tv_grab_zz_json --configure

.. and answer its questions.

  • Ask for MythTV format channel IDs (5-digits), if only because that's what I used and appears in my mappings below.
  • Where it asks for the country, I used GBR but apparently if you know the specific feed (and the list it offers after your post-code doesn't contain what you want (raise a ticket with SD in this case, they're very good as responding) you can enter the full line-up code (e.g., GBR-0001172-DEFAULT). See http://article.gmane.org/gmane.comp.tv.xmltv.devel/11247 for a list of codes for UK transmitters.
  • If you can, use the code provided by the above link for your DVB-T transmitter. The post-code-based one (“OTA”) is actually likely not what you want (although it will offer the correct Satellite options).
  • For your post-code, only enter first part, as it otherwise gets confused and only offers you limited (non-localised) sources.
  • Ask for individual channels, not the full line-up, as it'll give you a chance to diagnose channel list issues, & disable channels (in the config file it creates, via “channel!12345” instead of “channel=12345”). For my BSkyB listings, the full set was ~600 channels, and I don't use anything like that many.

You should get a viable configuration file out of it, in ~/.xmltv/tv_grab_zz_json.conf, and see the list of xmltvids you have available. The file has configuration information at the head (eg username and password) followed by lines of the form channel=12345 .

Do a trial run

Run the grabber and check you get something sensible. If you have the default initial channel list this might give quite a large XML file.

tv_grab_zz_json --config-file ~/.xmltv/tv_grab_zz_json.conf  --output /tmp/sd.xml

Make sure the grabber runs OK and the output file looks sane.

The file has entries like this:

<channel id="30644">
   <display-name>BBC One (London)</display-name>

In this case, it is saying that the XMLTVID for BBC One (London) is 30644.

Update MythTV

Backup your database now! If you don't use /usr/share/mythtv/mythconverg_backup.pl on a regular basis, start now.

Change the grabber configuration in mythtvsetup

You should probably edit your sources in mythtvsetup (remember you need to stop mythbackend when running that) to use tv_grab_zz_json. It is not believed that the built-in SD option in Myth works outside of the US as we think it still uses the XML API from SD, not the new JSON one, and only that has non-US feeds.

I haven't yet done that, as I run a script that fetches and injects the listings outside of Myth instead of getting it to do it off its own back for various reasons.

Update the channel database to use the SD channel IDs

Well, you can do this manually, or use a version of the SQL script below. Either use the mythtvsetup editor or the SQL command line. See the xmltvid mappings below.

Alternatively, Channel Editor version 2.01 (8 July 2016) has code which will read the huge file above, allow manual matching of the channels which do not match automatically and insert the ids into the database. It will do this and lots more which you would expect of a channel editor.

If you use the script below, search your setup for channel IDs that still aren't the 5-digit SD format, as you'll need to convert those yourself (and please add them to the list below for others!)

Remove old program IDs from the database

This is optional, and your call. I did it, and it mostly worked out OK.

It looks like if we change data source (and get different programme IDs) we might have to delete the programme IDs for all previously recorded episodes. If both previous and upcoming episodes have IDs, MythTV only uses them to detect duplicates, and thus will re-record everything it comes across. If one of the other is missing, it falls back to the usual mechanism (title/subtitle/etc.).

I used the following within mysql to delete old program IDs that XMLTV had injected (the patterns hopefully exclude those added by over-the-air EIT listings which will carry on as normal).

 update oldrecorded set programid='' where  \
   programid rlike '^EP[0-9]+[a-z]?$' or  \
   programid rlike '^MV[0-9]+[a-z]?$' or  \
   programid rlike '^SH[0-9]+[a-z]?$' or  \
   programid rlike '^SP[0-9]+[a-z]?$';
 update recorded set programid='' where  \
   programid rlike '^EP[0-9]+[a-z]?$' or  \
   programid rlike '^MV[0-9]+[a-z]?$' or  \
   programid rlike '^SH[0-9]+[a-z]?$' or  \
   programid rlike '^SP[0-9]+[a-z]?$';
 update recordedprogram set programid='' where  \
   programid rlike '^EP[0-9]+[a-z]?$' or  \
   programid rlike '^MV[0-9]+[a-z]?$' or  \
   programid rlike '^SH[0-9]+[a-z]?$' or  \
   programid rlike '^SP[0-9]+[a-z]?$';

Even after this, I still found a whole load of re-recordings appear, but I think it would have been worse without doing it. If you skip this step, you'll probably just have to perform a little more upcoming-recordings maintenance for a while.

Set up the xmltv config

Copy ~/.xmltv/tv_grab_zz_json.conf over your previous ~/.mythtv/SOURCENAME.xmltv file(s), or maybe even creat the symbolic link to the xmltv original.

I actually copy the config. to a SOURCE.xmltv.hdr, and delete all the channel lines. Then, in my fetch script, I extend the config file (each time) with just the channels I have in my database, so that if I fiddle with channels, I don't have to remember to update the xmltv files (which I used to pretty much forget every time!).

# For the Freeview source, which is sourceid 1 in my setup
cp -f $HOME/.mythtv/Freeview.xmltv.hdr $HOME/.mythtv/Freeview.xmltv
mysql -NB -u DBUSER --password=DBPASS mythconverg -e \
   'select distinct concat("channel=",xmltvid) from channel where sourceid = 1 and xmltvid <> "" order by xmltvid' \
   >>  $HOME/.mythtv/Freeview.xmltv

It may be simpler to use Channel Editor which has a routine to generate all the SOURCENAME.xmltv files automatically. It will generate a file for each source, with channels marked for inclusion (with = ) which are non-UseEIT, are visible are in the appropriate source and have a non blank XMLTVID. Other channels are marked for exclusion (with ! ). After manual inspection, they simply need copying over from current working directory to ~/.mythtv.

Perform your first update

If you just go with the flow, it should be as simple as:


At least initially, I recommend the following, to prevent extra rogue channels from your lineup being added. I always automatically check for and delete automatically added channels after the fetch (those without a channum field).

mythfilldatabase --only-update-guide --dont-refresh-tba

If you do things manually, follow your own modified process to do the deed.


Try searching both the mythtv-users and xmltv-users mailing lists. If you want to post something, xmltv-users would be best solely for issues with the grabber, otherwise you should head to the mythtv-users list.

Please update this page with error fixes or other useful information!


  • “Marvel's Agents of SHIELD” now comes down (correctly) as “Marvel's Agents of S.H.I.E.L.D.” so existing rules likely won't match.


Mapping of old RT IDs to new SD IDs

Please amend as you see fit, this is only the list of channels matching my set-up (South-East Freeview and BSkyB). Take the channel names with a bit of a pinch of salt - they could be well out of date as these things tend to change on a regular basis, and also reflect my preferences over advertised channel names(!).

The IDs may also be old ones which the RT grabber aliased when the channels changed; my setup dates back to 2004.

EDIT - Unlike the RT UK IDs, some channels will possibly have different SD IDs depending upon their source; I initially made this focussed on a Sky channel listing, but a couple are not present in DVB-T line-ups (selected from the transmitter-based list as opposed the the script-0proferred post-code based list). I've updated the list below, but not the SQL conversion script after it. You'll have to adjust those manually. Check the output of running tv_grab_zz_json for unrecognised channel IDs.

1.movies4men.co.uk                              46306       # Movies4Men
1.truemovies.tv                                 50011       # True Movies 2
2.jr.nickelodeon.co.uk                          50269       # Nick Jr 2
2.truemovies.tv                                 44717       # True Movies 1
4music.channel4.com                             31786       # 4Music
4seven.channel4.com                             75804       # 4seven
6music.radio.bbc.co.uk                          30166       # BBC 6 Music
action.cbs.com                                  73970       # CBS Action
alibi.uktv.co.uk                                21258       # Alibi
animalplanet.discoveryeurope.com                20707       # Animal Planet
arts.sky.com                                    24919       # Sky Arts
atlantic.sky.com                                70434       # Sky Atlantic
b4utv.com                                       25529       # B4U Movies
base.mtv.co.uk                                  24217       # MTV Base
bbcfour.bbc.co.uk                               20684       # BBC FOUR
bloomberg.com                                   20711       # Bloomberg Television
boomerang.cartoonnetwork.com                    24341       # Boomerang
british.eurosport.com                           18337       # British Eurosport
cbbc.bbc.co.uk                                  29324       # CBBC
cbeebies.bbc.co.uk                              29325       # CBeebies
central.itv1.itv.co.uk                          21832       # ITV 1 London (Carlton)
challengetv.co.uk                               17454       # TLC
channel4.com                                    17155       # Channel 4
channel5.co.uk                                  17157       # Channel 5
citv.itv.co.uk                                  49452       # CITV
comedycentral.com                               17420       # Comedy Central
communitychannel.org                            24677       # Community Channel
dance.mtv.co.uk                                 25976       # MTV Dance
dave.uktv.co.uk                                 24305       # Dave
discoveryeurope.com                             17444       # Discovery Channel
disneychannel.disney.co.uk                      18377       # Disney Channel
drama.cbs.com                                   57827       # CBS Drama
e4.channel4.com                                 25117       # E4
eden.uktv.co.uk                                 35806       # Eden
eentertainment.com                              32195       # E! Entertainment
encore.itv.com                                  89886       # ITV Encore
entertainment.truemovies.tv                     57747       # True Entertainment
euronews.com                                    82432       # Euronews
europe.cnbc.com                                 16230       # CNBC Europe
europe.cnn.com                                  68053       # CNN International
extra.5live.radio.bbc.co.uk                     29920       # BBC 5L SportsX
extra.comedycentral.com                         34230       # Comedy Central Extra
filmfour.channel4.com                           21494       # Film4
fiver.channel5.co.uk                            52336       # 5*
fiveusa.channel5.co.uk                          52335       # 5 USA
freeview.communitychannel.org                   24677       # Community
freeview.foodnetwork.com                        44718       # Food Network
freeview.hd.channel4.com                        50716       # Channel 4 HD
fxuk.tv                                         35484       # Fox
gold.uktv.co.uk                                 17442       # Gold
goodfood.uktv.co.uk                             28634       # Good Food
hd.aljazeera.net                                97267       # Al Jazeera Eng HD
hd.bbc1.bbc.co.uk                               69387       # BBC ONE HD
hd.bbc2.bbc.co.uk                               50059       # BBC TWO HD
hd.bbcfour.bbc.co.uk                            83282       # BBC FOUR HD
hd.cbbc.bbc.co.uk                               83281       # CBBC HD
hd.cbeebies.bbc.co.uk                           83283       # CBeebies HD
hd.five.tv                                      50717       # Channel 5 HD
hd.news.bbc.co.uk                               83285       # BBC NEWS HD
hd.southeast-macro.itv1.itv.co.uk               67073       # ITV HD
health.discovery.com                            24657       # Discovery Home & Health
history.discoveryeurope.com                     24280       # Discovery History
hits.mtv.co.uk                                  24214       # MTV Hits
home.uktv.co.uk                                 21257       # Home
horror.cbs.com                                  42762       # Horror Channel
idealworld.tv                                   24669       # Ideal World
itv2.itv.co.uk                                  20630       # ITV2
itv3.itv.co.uk                                  44643       # ITV3
itv4.itv.co.uk                                  48020       # ITV4
jr.nickelodeon.co.uk                            24025       # Nick Jr
kerrang.com                                     25627       # Kerrang! TV
kiss-tv.kiss100.com                             25605       # Kiss TV
living.sky.com                                  17443       # Sky Living
magictv.co.uk                                   25607       # Magic
meridian.itv1.itv.co.uk                         21826       # ITV1
more4.channel4.com                              47657       # More 4
motors.tv                                       30141       # Motors TV
mtv.co.uk                                       58695       # MTV UK
nationalgeographic.co.uk                        21592       # National Geographic
news.bbc.co.uk                                  19037       # BBC NEWS
news.eurosport.com                              27413       # British Eurosport 2
news.sports.sky.com                             20643       # Sky Sports News
nickelodeon.co.uk                               17419       # Nickelodeon UK
northern-ireland.bbc2.bbc.co.uk                 29046       # BBC 2 Northern Ireland
parliament.bbc.co.uk                            20685       # BBC Parliament
playboy.com                                     69376       # Playboy TV
plus-1.1.movies4men.co.uk                       59406       # Movies4Men +1
plus-1.comedycentral.com                        47480       # Comedy Central +1
plus-1.meridian.itv1.itv.co.uk                  65161       # ITV1 +1
plus-1.quest.discoveryeurope.com                65394       # Quest +1
plus-1.science.discoveryeurope.com              56266       # Discovery Science +1
plus-1.universalchannel.co.uk                   60936       # Universal +1
plus-1.xd.disney.co.uk                          24073       # Disney XD +1
popfun.co.uk                                    33638       # POP
quest.discoveryeurope.com                       62391       # Quest
qvcuk.com                                       21810       # QVC
radio-1.bbc.co.uk                               24434       # BBC Radio 1
radio-2.bbc.co.uk                               24435       # BBC Radio 2
radio-3.bbc.co.uk                               24436       # BBC Radio 3
radio-4.bbc.co.uk                               24437       # BBC Radio 4
radio-5.bbc.co.uk                               24438       # BBC R5 Live
reality.cbs.com                                 31756       # CBS Reality
really.uktv.co.uk                               45828       # Really
sat.2.travelchannel.co.uk                       32286       # Travel Channel +1
sat.travelchannel.co.uk                         17453       # Travel Channel
science.discoveryeurope.com                     24282       # Discovery Science
scuzz.tv                                        32669       # Scuzz
setindia.com                                    57603       # Sony Entertainment TV Asia
sky-news.sky.com                                16234       # Sky News
sky-one.sky.com                                 16235       # Sky One
sky-three.sky.com                               48021       # Pick TV
sky-two.sky.com                                 32151       # Sky 2
smashhits.net                                   26084       # Smash Hits! TV
sonytv.com                                      31759       # Sony TV
south.bbc1.bbc.co.uk                            24326       # BBC One (South)
south.bbc2.bbc.co.uk                            17154       # BBC Two
south-east.bbc1.bbc.co.uk                       24337       # BBC ONE S East
south-east.bbc2.bbc.co.uk                       17154       # BBC TWO
spike.com                                       97330       # Spike
tcm.turner.com                                  88256       # TCM
televisionx.co.uk                               47738       # Television X
theadultchannel.co.uk                           66975       # The Adult Channel
thebox.co.uk                                    21492       # The Box
thehistorychannel.co.uk                         21558       # History Channel
tinypop.com                                     34087       # Tiny Pop
too.cartoonnetwork.com                          31760       # Cartoonito
toons.nickelodeon.co.uk                         31168       # Nicktoons TV
tsod.plus-1.alibi.uktv.co.uk                    45509       # Alibi +1
tsod.plus-1.animalplanet.discoveryeurope.com    26098       # Animal Planet +1
tsod.plus-1.boomerang.cartoonnetwork.com        48928       # Boomerang +1
tsod.plus-1.challengetv.co.uk                   45283       # Challenge +1
tsod.plus-1.channel4.com                        56892       # Channel 4 +1
tsod.plus-1.channel5.co.uk                      56888       # Channel 5 +1 (Sky)
tsod.plus-1.channel5.co.uk                      97294       # Channel 5 +1 (DVB-T)
tsod.plus-1.dave.uktv.co.uk                     44855       # Dave ja vu
tsod.plus-1.discoveryeurope.com                 21557       # Discovery Channel +1
tsod.plus-1.disneychannel.disney.co.uk          50587       # Disney Channel +1
tsod.plus-1.e4.channel4.com                     33882       # E4 +1
tsod.plus-1.eden.uktv.co.uk                     35945       # Eden +1
tsod.plus-1.filmfour.channel4.com               25630       # Film4 +1
tsod.plus-1.fiveusa.channel5.co.uk              56890       # 5 USA +1
tsod.plus-1.freeview.dave.uktv.co.uk            44855       # Dave ja vu
tsod.plus-1.freeview.itv3.itv.co.uk             98366       # ITV3+1
tsod.plus-1.freeview.itv4.itv.co.uk             61806       # ITV4+1
tsod.plus-1.gold.uktv.co.uk                     31351       # Gold +1
tsod.plus-1.goodfood.uktv.co.uk                 34898       # Good Food +1
tsod.plus-1.health.discovery.com                46490       # Discovery Home & Health +1
tsod.plus-1.home.uktv.co.uk                     29969       # Home +1
tsod.plus-1.itv2.itv.co.uk                      53059       # ITV2 +1
tsod.plus-1.itv3.itv.co.uk                      53060       # ITV3+1 (Sky)
tsod.plus-1.itv3.itv.co.uk                      98366       # ITV3+1 (DVB-T)
tsod.plus-1.living.sky.com                      31949       # Sky Living +1
tsod.plus-1.more4.channel4.com                  47658       # More 4 +1
tsod.plus-1.mtv.co.uk                           35370       # MTV +1
tsod.plus-1.nationalgeographic.co.uk            24112       # National Geographic +1
tsod.plus-1.quest.discoveryeurope.com           65394       # QUEST+1
tsod.plus-1.reality.cbs.com                     45510       # CBS Reaity +1
tsod.plus-1.southeast-macro.itv1.itv.co.uk      65161       # ITV +1
tsod.plus-1.thehistorychannel.co.uk             24699       # History Channel +1
tsod.plus-1.uk.syfy.com                         49969       # SyFy +1
tsod.plus-1.watch.uktv.co.uk                    61459       # Watch +1
tsod.plus-1.yesterday.uktv.co.uk                35706       # Yesterday +1
tsod.plus-24.channel5.co.uk                     97294       # Channel 5+24
turbo.discoveryeurope.com                       24284       # Discovery Turbo
tv5.org                                         21495       # TV5Monde Europe
uk.cartoonnetwork.com                           17667       # Cartoon Network
uk.syfy.com                                     17431       # SyFy
uk.viva.tv                                      31787       # VIVA
universalchannel.co.uk                          24671       # Universal
vh1.co.uk                                       17745       # VH1
wales.bbc2.bbc.co.uk                            28573       # BBC 2 Wales
watch.uktv.co.uk                                61458       # Watch
wild.nationalgeographic.co.uk                   23305       # National Geographic Wild
xd.disney.co.uk                                 18379       # Disney XD
xtra.1.radio.bbc.co.uk                          31266       # 1Xtra BBC
yesterday.uktv.co.uk                            31783       # Yesterday

SQL script to convert the xmltvids in the database

This script should convert the xmltvid values in your database from RT ones to SD ones. I prefer to save this sort of thing off as a file, and then running it into a command-liane manually, as it allows you to test it with a copy of the file with just a single line in case of problems. If you save it as xmltv-map.sql then:

mysql --default-character-set=utf8 -u DBUSER --password=DBPASS mythconverg < xmltv-map.sql

Amend the same as per the mappings above! You don't have to remove any channels you don't have, as the SQL commands for those will simply do nothing on your system.

 update channel set xmltvid='46306' where xmltvid='1.movies4men.co.uk';                              -- Movies4Men
 update channel set xmltvid='50011' where xmltvid='1.truemovies.tv';                                 -- True Movies 2
 update channel set xmltvid='50269' where xmltvid='2.jr.nickelodeon.co.uk';                          -- Nick Jr 2
 update channel set xmltvid='44717' where xmltvid='2.truemovies.tv';                                 -- True Movies 1
 update channel set xmltvid='31786' where xmltvid='4music.channel4.com';                             -- 4Music
 update channel set xmltvid='75804' where xmltvid='4seven.channel4.com';                             -- 4seven
 update channel set xmltvid='30166' where xmltvid='6music.radio.bbc.co.uk';                          -- BBC 6 Music
 update channel set xmltvid='73970' where xmltvid='action.cbs.com';                                  -- CBS Action
 update channel set xmltvid='21258' where xmltvid='alibi.uktv.co.uk';                                -- Alibi
 update channel set xmltvid='20707' where xmltvid='animalplanet.discoveryeurope.com';                -- Animal Planet
 update channel set xmltvid='24919' where xmltvid='arts.sky.com';                                    -- Sky Arts
 update channel set xmltvid='70434' where xmltvid='atlantic.sky.com';                                -- Sky Atlantic
 update channel set xmltvid='25529' where xmltvid='b4utv.com';                                       -- B4U Movies
 update channel set xmltvid='24217' where xmltvid='base.mtv.co.uk';                                  -- MTV Base
 update channel set xmltvid='20684' where xmltvid='bbcfour.bbc.co.uk';                               -- BBC FOUR
 update channel set xmltvid='20711' where xmltvid='bloomberg.com';                                   -- Bloomberg Television
 update channel set xmltvid='24341' where xmltvid='boomerang.cartoonnetwork.com';                    -- Boomerang
 update channel set xmltvid='18337' where xmltvid='british.eurosport.com';                           -- British Eurosport
 update channel set xmltvid='29324' where xmltvid='cbbc.bbc.co.uk';                                  -- CBBC
 update channel set xmltvid='29325' where xmltvid='cbeebies.bbc.co.uk';                              -- CBeebies
 update channel set xmltvid='21832' where xmltvid='central.itv1.itv.co.uk';                          -- ITV 1 London (Carlton)
 update channel set xmltvid='17454' where xmltvid='challengetv.co.uk';                               -- TLC
 update channel set xmltvid='17155' where xmltvid='channel4.com';                                    -- Channel 4
 update channel set xmltvid='17157' where xmltvid='channel5.co.uk';                                  -- Channel 5
 update channel set xmltvid='49452' where xmltvid='citv.itv.co.uk';                                  -- CITV
 update channel set xmltvid='17420' where xmltvid='comedycentral.com';                               -- Comedy Central
 update channel set xmltvid='24677' where xmltvid='communitychannel.org';                            -- Community Channel
 update channel set xmltvid='25976' where xmltvid='dance.mtv.co.uk';                                 -- MTV Dance
 update channel set xmltvid='24305' where xmltvid='dave.uktv.co.uk';                                 -- Dave
 update channel set xmltvid='17444' where xmltvid='discoveryeurope.com';                             -- Discovery Channel
 update channel set xmltvid='18377' where xmltvid='disneychannel.disney.co.uk';                      -- Disney Channel
 update channel set xmltvid='57827' where xmltvid='drama.cbs.com';                                   -- CBS Drama
 update channel set xmltvid='25117' where xmltvid='e4.channel4.com';                                 -- E4
 update channel set xmltvid='35806' where xmltvid='eden.uktv.co.uk';                                 -- Eden
 update channel set xmltvid='32195' where xmltvid='eentertainment.com';                              -- E! Entertainment
 update channel set xmltvid='89886' where xmltvid='encore.itv.com';                                  -- ITV Encore
 update channel set xmltvid='57747' where xmltvid='entertainment.truemovies.tv';                     -- True Entertainment
 update channel set xmltvid='82432' where xmltvid='euronews.com';                                    -- Euronews
 update channel set xmltvid='16230' where xmltvid='europe.cnbc.com';                                 -- CNBC Europe
 update channel set xmltvid='68053' where xmltvid='europe.cnn.com';                                  -- CNN International
 update channel set xmltvid='29920' where xmltvid='extra.5live.radio.bbc.co.uk';                     -- BBC 5L SportsX
 update channel set xmltvid='34230' where xmltvid='extra.comedycentral.com';                         -- Comedy Central Extra
 update channel set xmltvid='21494' where xmltvid='filmfour.channel4.com';                           -- Film4
 update channel set xmltvid='52336' where xmltvid='fiver.channel5.co.uk';                            -- 5*
 update channel set xmltvid='52335' where xmltvid='fiveusa.channel5.co.uk';                          -- 5 USA
 update channel set xmltvid='24677' where xmltvid='freeview.communitychannel.org';                   -- Community
 update channel set xmltvid='44718' where xmltvid='freeview.foodnetwork.com';                        -- Food Network
 update channel set xmltvid='50716' where xmltvid='freeview.hd.channel4.com';                        -- Channel 4 HD
 update channel set xmltvid='35484' where xmltvid='fxuk.tv';                                         -- Fox
 update channel set xmltvid='17442' where xmltvid='gold.uktv.co.uk';                                 -- Gold
 update channel set xmltvid='28634' where xmltvid='goodfood.uktv.co.uk';                             -- Good Food
 update channel set xmltvid='97267' where xmltvid='hd.aljazeera.net';                                -- Al Jazeera Eng HD
 update channel set xmltvid='69387' where xmltvid='hd.bbc1.bbc.co.uk';                               -- BBC ONE HD
 update channel set xmltvid='50059' where xmltvid='hd.bbc2.bbc.co.uk';                               -- BBC TWO HD
 update channel set xmltvid='83282' where xmltvid='hd.bbcfour.bbc.co.uk';                            -- BBC FOUR HD
 update channel set xmltvid='83281' where xmltvid='hd.cbbc.bbc.co.uk';                               -- CBBC HD
 update channel set xmltvid='83283' where xmltvid='hd.cbeebies.bbc.co.uk';                           -- CBeebies HD
 update channel set xmltvid='50717' where xmltvid='hd.five.tv';                                      -- Channel 5 HD
 update channel set xmltvid='83285' where xmltvid='hd.news.bbc.co.uk';                               -- BBC NEWS HD
 update channel set xmltvid='67073' where xmltvid='hd.southeast-macro.itv1.itv.co.uk';               -- ITV HD
 update channel set xmltvid='24657' where xmltvid='health.discovery.com';                            -- Discovery Home & Health
 update channel set xmltvid='24280' where xmltvid='history.discoveryeurope.com';                     -- Discovery History
 update channel set xmltvid='24214' where xmltvid='hits.mtv.co.uk';                                  -- MTV Hits
 update channel set xmltvid='21257' where xmltvid='home.uktv.co.uk';                                 -- Home
 update channel set xmltvid='42762' where xmltvid='horror.cbs.com';                                  -- Horror Channel
 update channel set xmltvid='24669' where xmltvid='idealworld.tv';                                   -- Ideal World
 update channel set xmltvid='20630' where xmltvid='itv2.itv.co.uk';                                  -- ITV2
 update channel set xmltvid='44643' where xmltvid='itv3.itv.co.uk';                                  -- ITV3
 update channel set xmltvid='48020' where xmltvid='itv4.itv.co.uk';                                  -- ITV4
 update channel set xmltvid='24025' where xmltvid='jr.nickelodeon.co.uk';                            -- Nick Jr
 update channel set xmltvid='25627' where xmltvid='kerrang.com';                                     -- Kerrang! TV
 update channel set xmltvid='25605' where xmltvid='kiss-tv.kiss100.com';                             -- Kiss TV
 update channel set xmltvid='17443' where xmltvid='living.sky.com';                                  -- Sky Living
 update channel set xmltvid='25607' where xmltvid='magictv.co.uk';                                   -- Magic
 update channel set xmltvid='21826' where xmltvid='meridian.itv1.itv.co.uk';                         -- ITV1
 update channel set xmltvid='47657' where xmltvid='more4.channel4.com';                              -- More 4
 update channel set xmltvid='30141' where xmltvid='motors.tv';                                       -- Motors TV
 update channel set xmltvid='58695' where xmltvid='mtv.co.uk';                                       -- MTV UK
 update channel set xmltvid='21592' where xmltvid='nationalgeographic.co.uk';                        -- National Geographic
 update channel set xmltvid='19037' where xmltvid='news.bbc.co.uk';                                  -- BBC NEWS
 update channel set xmltvid='27413' where xmltvid='news.eurosport.com';                              -- British Eurosport 2
 update channel set xmltvid='20643' where xmltvid='news.sports.sky.com';                             -- Sky Sports News
 update channel set xmltvid='17419' where xmltvid='nickelodeon.co.uk';                               -- Nickelodeon UK
 update channel set xmltvid='29046' where xmltvid='northern-ireland.bbc2.bbc.co.uk';                 -- BBC 2 Northern Ireland
 update channel set xmltvid='20685' where xmltvid='parliament.bbc.co.uk';                            -- BBC Parliament
 update channel set xmltvid='69376' where xmltvid='playboy.com';                                     -- Playboy TV
 update channel set xmltvid='59406' where xmltvid='plus-1.1.movies4men.co.uk';                       -- Movies4Men +1
 update channel set xmltvid='47480' where xmltvid='plus-1.comedycentral.com';                        -- Comedy Central +1
 update channel set xmltvid='65161' where xmltvid='plus-1.meridian.itv1.itv.co.uk';                  -- ITV1 +1
 update channel set xmltvid='65394' where xmltvid='plus-1.quest.discoveryeurope.com';                -- Quest +1
 update channel set xmltvid='56266' where xmltvid='plus-1.science.discoveryeurope.com';              -- Discovery Science +1
 update channel set xmltvid='60936' where xmltvid='plus-1.universalchannel.co.uk';                   -- Universal +1
 update channel set xmltvid='24073' where xmltvid='plus-1.xd.disney.co.uk';                          -- Disney XD +1
 update channel set xmltvid='33638' where xmltvid='popfun.co.uk';                                    -- POP
 update channel set xmltvid='62391' where xmltvid='quest.discoveryeurope.com';                       -- Quest
 update channel set xmltvid='21810' where xmltvid='qvcuk.com';                                       -- QVC
 update channel set xmltvid='24434' where xmltvid='radio-1.bbc.co.uk';                               -- BBC Radio 1
 update channel set xmltvid='24435' where xmltvid='radio-2.bbc.co.uk';                               -- BBC Radio 2
 update channel set xmltvid='24436' where xmltvid='radio-3.bbc.co.uk';                               -- BBC Radio 3
 update channel set xmltvid='24437' where xmltvid='radio-4.bbc.co.uk';                               -- BBC Radio 4
 update channel set xmltvid='24438' where xmltvid='radio-5.bbc.co.uk';                               -- BBC R5 Live
 update channel set xmltvid='31756' where xmltvid='reality.cbs.com';                                 -- CBS Reality
 update channel set xmltvid='45828' where xmltvid='really.uktv.co.uk';                               -- Really
 update channel set xmltvid='32286' where xmltvid='sat.2.travelchannel.co.uk';                       -- Travel Channel +1
 update channel set xmltvid='17453' where xmltvid='sat.travelchannel.co.uk';                         -- Travel Channel
 update channel set xmltvid='24282' where xmltvid='science.discoveryeurope.com';                     -- Discovery Science
 update channel set xmltvid='32669' where xmltvid='scuzz.tv';                                        -- Scuzz
 update channel set xmltvid='57603' where xmltvid='setindia.com';                                    -- Sony Entertainment TV Asia
 update channel set xmltvid='16234' where xmltvid='sky-news.sky.com';                                -- Sky News
 update channel set xmltvid='16235' where xmltvid='sky-one.sky.com';                                 -- Sky One
 update channel set xmltvid='48021' where xmltvid='sky-three.sky.com';                               -- Pick TV
 update channel set xmltvid='32151' where xmltvid='sky-two.sky.com';                                 -- Sky 2
 update channel set xmltvid='26084' where xmltvid='smashhits.net';                                   -- Smash Hits! TV
 update channel set xmltvid='31759' where xmltvid='sonytv.com';                                      -- Sony TV
 update channel set xmltvid='24326' where xmltvid='south.bbc1.bbc.co.uk';                            -- BBC One (South)
 update channel set xmltvid='17154' where xmltvid='south.bbc2.bbc.co.uk';                            -- BBC Two
 update channel set xmltvid='24337' where xmltvid='south-east.bbc1.bbc.co.uk';                       -- BBC ONE S East
 update channel set xmltvid='17154' where xmltvid='south-east.bbc2.bbc.co.uk';                       -- BBC TWO
 update channel set xmltvid='97330' where xmltvid='spike.com';                                       -- Spike
 update channel set xmltvid='88256' where xmltvid='tcm.turner.com';                                  -- TCM
 update channel set xmltvid='47738' where xmltvid='televisionx.co.uk';                               -- Television X
 update channel set xmltvid='66975' where xmltvid='theadultchannel.co.uk';                           -- The Adult Channel
 update channel set xmltvid='21492' where xmltvid='thebox.co.uk';                                    -- The Box
 update channel set xmltvid='21558' where xmltvid='thehistorychannel.co.uk';                         -- History Channel
 update channel set xmltvid='34087' where xmltvid='tinypop.com';                                     -- Tiny Pop
 update channel set xmltvid='31760' where xmltvid='too.cartoonnetwork.com';                          -- Cartoonito
 update channel set xmltvid='31168' where xmltvid='toons.nickelodeon.co.uk';                         -- Nicktoons TV
 update channel set xmltvid='45509' where xmltvid='tsod.plus-1.alibi.uktv.co.uk';                    -- Alibi +1
 update channel set xmltvid='26098' where xmltvid='tsod.plus-1.animalplanet.discoveryeurope.com';    -- Animal Planet +1
 update channel set xmltvid='48928' where xmltvid='tsod.plus-1.boomerang.cartoonnetwork.com';        -- Boomerang +1
 update channel set xmltvid='45283' where xmltvid='tsod.plus-1.challengetv.co.uk';                   -- Challenge +1
 update channel set xmltvid='56892' where xmltvid='tsod.plus-1.channel4.com';                        -- Channel 4 +1
 update channel set xmltvid='77749' where xmltvid='tsod.plus-1.channel5.co.uk';                      -- Channel 5 +1
 update channel set xmltvid='44855' where xmltvid='tsod.plus-1.dave.uktv.co.uk';                     -- Dave ja vu
 update channel set xmltvid='21557' where xmltvid='tsod.plus-1.discoveryeurope.com';                 -- Discovery Channel +1
 update channel set xmltvid='50587' where xmltvid='tsod.plus-1.disneychannel.disney.co.uk';          -- Disney Channel +1
 update channel set xmltvid='33882' where xmltvid='tsod.plus-1.e4.channel4.com';                     -- E4 +1
 update channel set xmltvid='35945' where xmltvid='tsod.plus-1.eden.uktv.co.uk';                     -- Eden +1
 update channel set xmltvid='25630' where xmltvid='tsod.plus-1.filmfour.channel4.com';               -- Film4 +1
 update channel set xmltvid='56890' where xmltvid='tsod.plus-1.fiveusa.channel5.co.uk';              -- 5 USA +1
 update channel set xmltvid='44855' where xmltvid='tsod.plus-1.freeview.dave.uktv.co.uk';            -- Dave ja vu
 update channel set xmltvid='98366' where xmltvid='tsod.plus-1.freeview.itv3.itv.co.uk';             -- ITV3+1
 update channel set xmltvid='61806' where xmltvid='tsod.plus-1.freeview.itv4.itv.co.uk';             -- ITV4+1
 update channel set xmltvid='31351' where xmltvid='tsod.plus-1.gold.uktv.co.uk';                     -- Gold +1
 update channel set xmltvid='34898' where xmltvid='tsod.plus-1.goodfood.uktv.co.uk';                 -- Good Food +1
 update channel set xmltvid='46490' where xmltvid='tsod.plus-1.health.discovery.com';                -- Discovery Home & Health +1
 update channel set xmltvid='29969' where xmltvid='tsod.plus-1.home.uktv.co.uk';                     -- Home +1
 update channel set xmltvid='53059' where xmltvid='tsod.plus-1.itv2.itv.co.uk';                      -- ITV2 +1
 update channel set xmltvid='53060' where xmltvid='tsod.plus-1.itv3.itv.co.uk';                      -- ITV3+1
 update channel set xmltvid='31949' where xmltvid='tsod.plus-1.living.sky.com';                      -- Sky Living +1
 update channel set xmltvid='47658' where xmltvid='tsod.plus-1.more4.channel4.com';                  -- More 4 +1
 update channel set xmltvid='35370' where xmltvid='tsod.plus-1.mtv.co.uk';                           -- MTV +1
 update channel set xmltvid='24112' where xmltvid='tsod.plus-1.nationalgeographic.co.uk';            -- National Geographic +1
 update channel set xmltvid='65394' where xmltvid='tsod.plus-1.quest.discoveryeurope.com';           -- QUEST+1
 update channel set xmltvid='45510' where xmltvid='tsod.plus-1.reality.cbs.com';                     -- CBS Reality +1
 update channel set xmltvid='65161' where xmltvid='tsod.plus-1.southeast-macro.itv1.itv.co.uk';      -- ITV +1
 update channel set xmltvid='24699' where xmltvid='tsod.plus-1.thehistorychannel.co.uk';             -- History Channel +1
 update channel set xmltvid='49969' where xmltvid='tsod.plus-1.uk.syfy.com';                         -- SyFy +1
 update channel set xmltvid='61459' where xmltvid='tsod.plus-1.watch.uktv.co.uk';                    -- Watch +1
 update channel set xmltvid='35706' where xmltvid='tsod.plus-1.yesterday.uktv.co.uk';                -- Yesterday +1
 update channel set xmltvid='97294' where xmltvid='tsod.plus-24.channel5.co.uk';                     -- Channel 5+24
 update channel set xmltvid='24284' where xmltvid='turbo.discoveryeurope.com';                       -- Discovery Turbo
 update channel set xmltvid='21495' where xmltvid='tv5.org';                                         -- TV5Monde Europe
 update channel set xmltvid='17667' where xmltvid='uk.cartoonnetwork.com';                           -- Cartoon Network
 update channel set xmltvid='17431' where xmltvid='uk.syfy.com';                                     -- SyFy
 update channel set xmltvid='31787' where xmltvid='uk.viva.tv';                                      -- VIVA
 update channel set xmltvid='24671' where xmltvid='universalchannel.co.uk';                          -- Universal
 update channel set xmltvid='17745' where xmltvid='vh1.co.uk';                                       -- VH1
 update channel set xmltvid='28573' where xmltvid='wales.bbc2.bbc.co.uk';                            -- BBC 2 Wales
 update channel set xmltvid='61458' where xmltvid='watch.uktv.co.uk';                                -- Watch
 update channel set xmltvid='23305' where xmltvid='wild.nationalgeographic.co.uk';                   -- National Geographic Wild
 update channel set xmltvid='18379' where xmltvid='xd.disney.co.uk';                                 -- Disney XD
 update channel set xmltvid='31266' where xmltvid='xtra.1.radio.bbc.co.uk';                          -- 1Xtra BBC
 update channel set xmltvid='31783' where xmltvid='yesterday.uktv.co.uk';                            -- Yesterday

List of Frieview channels

Here's a list of Freeview cannels which can be obtained from the xml file as described above with the following command

grep -A1 "channel id" /tmp/sd.xml|sed 's/^  <channel id="/channel=/'|sed ':a;N;$!ba;s/--\n//g'|sed ':a;N;$!ba;s/">\n    <display-name>/  #/g'|sed 's/<\/display-name>//g'
channel=101972  #BLAZE
channel=102340  #Sewing Quarter
channel=102471  #Quest Red
channel=102764  #Quest Red +1
channel=102965  #CBS Action +1
channel=103587  #BT Sport Showcase HD
channel=103633  #POP +1
channel=103634  #Keep It Country
channel=103817  #Blaze +1
channel=105388  #Free Sports
channel=105389  #Freeview Information
channel=105390  #Kiss Me TV
channel=105391  #Proud Dating
channel=105392  #Bollywood HD
channel=105393  #Smile TV2
channel=105394  #Smile TV3
channel=16234  #Sky News
channel=17154  #BBC Two
channel=17155  #Channel 4
channel=17157  #Channel 5
channel=17453  #Travel Channel
channel=17468  #ITV1 (London)
channel=19037  #BBC News
channel=20630  #ITV2
channel=20684  #BBC Four
channel=20685  #BBC Parliament
channel=21257  #Home
channel=21494  #Film4
channel=21793  #Challenge TV
channel=21810  #QVC (European)
channel=24305  #Dave
channel=24434  #BBC Radio 1
channel=24435  #BBC Radio 2
channel=24436  #BBC Radio 3
channel=24437  #BBC Radio 4 FM
channel=24438  #BBC Radio 5 Live
channel=24439  #Classic FM
channel=24440  #Absolute Radio
channel=24441  #Talk Sport
channel=24448  #BBC World Service
channel=24452  #BBC Asian Network
channel=24467  #Heart FM
channel=24469  #Premier - PREMIER
channel=24669  #Ideal World
channel=24677  #TCC
channel=25117  #E4
channel=25151  #Kiss
channel=25225  #TWR
channel=25604  #BBC Radio London
channel=25605  #Kiss Fresh
channel=25630  #Film4 +1
channel=27993  #Gems TV
channel=28296  #Rocks and Co 1
channel=29067  #Jewellery Maker
channel=29324  #CBBC
channel=29325  #CBeebies
channel=29693  #QVC Beauty
channel=29920  #BBC Radio 5 Live Sports Xtra
channel=30157  #Jewellery Channel
channel=30166  #BBC Radio 6 Music
channel=30500  #Capital London
channel=30639  #Magic FM
channel=30644  #BBC One (London)
channel=31266  #BBC Radio 1 Xtra
channel=31756  #CBS Reality
channel=31783  #Yesterday
channel=31786  #4Music
channel=31787  #Viva
channel=31788  #Kerrang! Radio
channel=31790  #BBC Radio 4 Extra
channel=32675  #The Vault
channel=33579  #LBC
channel=33635  #The Hits Radio
channel=33638  #Pop
channel=33762  #BBC Radio Essex
channel=33882  #E4 +1
channel=34087  #Tiny Pop
channel=42762  #Horror Channel
channel=44643  #ITV3
channel=44717  #True Movies 1
channel=44718  #Food Network
channel=44855  #Dave Ja Vu
channel=45006  #Insight Radio
channel=45510  #CBS Reality +1
channel=45752  #Smooth FM 102.2
channel=45828  #Really UKTV
channel=46306  #Movies4Men
channel=47657  #More 4
channel=47658  #More4 +1
channel=48020  #ITV4
channel=48021  #Pick TV
channel=49452  #Children's ITV
channel=49887  #RT
channel=50059  #BBC Two HD
channel=50523  #ITV1 HD (London)
channel=50716  #Channel 4 HD
channel=50717  #Channel 5 HD
channel=52335  #5USA
channel=52336  #5 Star
channel=53059  #ITV2 +1
channel=56423  #Tiny Pop +1
channel=56890  #5USA +1
channel=56892  #Channel 4 +1
channel=56896  #Pop Max
channel=57747  #True Entertainment
channel=57827  #CBS Drama
channel=61806  #ITV4 +1
channel=62391  #Quest
channel=65160  #ITV +1
channel=65394  #Quest +1
channel=68877  #Vintage TV
channel=69373  #TVX: The Fantasy Channel (Digital)
channel=69387  #BBC One HD
channel=73510  #PBS (VM)
channel=73823  #Box Nation
channel=73970  #CBS Action
channel=75804  #4Seven
channel=77749  #Channel 5 +1
channel=79940  #Create and Craft
channel=81004  #BBC Red Button 1
channel=81450  #Sony Movie Channel
channel=82550  #BBC Radio Berkshire
channel=82562  #BBC Three Counties Radio
channel=82575  #Drama
channel=83281  #CBBC HD
channel=83282  #BBC Four HD
channel=83283  #CBeebies HD
channel=83285  #BBC News HD
channel=84926  #London Live
channel=86817  #BBC Radio Surrey
channel=87231  #QVC HD
channel=87987  #British Forces TV
channel=89562  #4Seven HD
channel=89563  #Channel 4 +1 HD
channel=90257  #ITV BE
channel=90645  #ITVBe +1
channel=97267  #Al Jazeera HD
channel=97281  #Sony Movie Channel +1
channel=97290  #5 Star +1
channel=97294  #My5 (Free)
channel=97330  #5Spike
channel=97331  #truTV
channel=97332  #TBN UK
channel=97349  #truTV +1
channel=97673  #QVC Beauty HD
channel=97674  #Your TV
channel=97676  #Your TV +1
channel=98366  #ITV3 Freeview +1
channel=98903  #QVC Style
channel=98939  #The Store
channel=98986  #RT HD
channel=99024  #Talking Pictures TV
channel=99098  #True Crime

This list can then be copied into your tv_grab_zz_json.conf if you use "mode=channels". To disable the fetching of channels you don't need/watch, just delete the corresponding line or disable it by replacing "=" with "!".