[mythtvnz] EPG NZ howto - using the "nice" feed
Nick Rout
mythtvnz@lists.linuxnut.co.nz
Sun, 27 May 2007 19:51:15 +1200
OK I cracked it!
Heres the HOWTO using had's nice feed. I'll wikify this somewhere. Not
sure where yet.
That knoppmythwiki NZ page needs a lot of attention, but thats another
story.
OK a bit of essential knowledge and preliminaries first.
A. TV info needs to be provided as an xml file conforming to the xmltv
standard (gracing it with the term "standard" may be overly generous.)
B. The NZ TV companies are tight with their EPG information - they don't
provide it easily and for free, so people take two approaches to getting
the info - they scrape websites, or they get the information from the
SKY DVB-S feed. The DVB-S standard provides for EPG via a sub-standard
known as EIT. This EIT info can be converted to xmltv format, and this
is what is done by the epgsnoop script written by one of our subscribers.
C. The xmltv file needs to be fed into mythtv by the mythfilldatabase
script (part of mythtv) and you'll want to set up cron to do this daily.
Most of the info doesn't change more than daily, so doing it more often
is pointless. Don't set it up to run more frequently or the nice people
that provide the feeds will ban your IP address from downloading!
D. You need to associate each channel found in the xml data with a
channel number in mythtv before *anything* will show up in the onscreen
EPG. This step is manual, we'll cover it in step 7 below.
E. Some of the steps are easier via mythweb, so if you have that set up
it will help. Also I am assuming that you have already set up a capture
card, video source and input connection in mythtv-setup, ie menu items
2-4 in mythtv-setup.
F. It is essential that your mythbox is keeping good time and is
properly set to the NZ timezone, which is Pacific/Auckland. If the
result of the "date' command does not report the correct time and either
NZST (normal) or NZDT (daylight savings), then go and fix that first!
Now heres the step by step, usernames and file locations are from
knoppmyth (KM) (specifically R5E50), you may need to vary for your distro:
If you have already tried to set up channels and failed, do steps 1-4,
if you are starting from a fresh install or don't want to delete
existing channels go straight to 5.
======================================================================================================================
1. Kill the backend, in KM Alt-2 does this, otherwise log in via ssh and
execute /etc/init.d/mythtv-backend stop. Some distros may call this
/etc/init.d/mythbackend or some other variation.
2. Go into mythtv-setup, in KM the shortcut is Alt-s, in other distros
you may need to ssh in and run mythtv-setup. mythsetup, or whatever your
packager called it.
3. Go to menu item 5 "Channel Editor" and delete your existing channels.
4. Exit mythsetup and start the backend (Alt-1 in KM)
5. Log in as the user that runs mythfrontend. Doing this via ssh/putty
from another computer is easiest. In KM the user is called mythtv. Make
a temporary directory to play in, call it, say, epg, then download and
extract the zipped epg data from the nice site:
mkdir epg
cd epg
wget http://nice.net.nz/epg/listings.xml.gz
gunzip listings.xml.gz
You will be left with the file listings.xml in the current dir. If you
are curious, take a look through it with less or your favourite pager,
get the feel for the format of the listing, but you really don't need to
know it backwards.
6. run mythfilldatabase with the --do_channel_updates switch, which will
"introduce" the channels to the system. Heres the full invocation:
mythfilldatabase --file 1 7 listings.xml --do_channel_updates
(the 1 means apply to video source 1, 7 means 7 days)
(It's been suggested by Hads that the --do_channels_updates isn't
needed, but I'm not sure...)
This will take a while to run, and will give some output that you might
find interesting, or you may prefer to make a cup of tea.
7. Go into mythweb (thats in your browser, go to
http://yourmythbox/mythweb ) and then click on the settings button at
the top of the page (yes the one with the spanner on it). Then follow
the link to "MythTV channel info". There you should find a large table
of channels - everything on SkyTV. You will see that the channum column
is totally blank. This is the missing link. Go down there and put
channel numbers in for the channels you want to see in the EPG. For
example, I assigned channums 1, 2, 3 & 4 to TV1, TV2, TV3 and Prime. It
seemed sensible to keep the channums the same as the ones Sky uses.
Scroll right down to the bottom and click "Save". Now check that the
channels are listed - in mythweb click "Listings" at the top left and
you should see a table of the channels you just defined. They should now
also be visible in mythtv
7-alternative: If mythweb doesn't work for you or you want to do it the
other way, start mythtv-setup - see 2 above. Go to menu item 5 "Channel
Editor". There should be a large list of channels. Arrow and/or
PgUp/PgDown to get to the channel you want to see in the EPG and press
"enter". In the screen that comes up enter a Channel Number in the space
provided and hit "Next" then "Finish". This has the same effect as the
mythweb way in 7 above. Repeat for other channels you want. Escape out of
8. Now you need to write a script that does the following:
download the feed
gunzip it
mythfilldatabase --update --file 1 -1 listings.xml
And get cron to run that script daily.
I acknowledge that there may be errors in the above, and that different
approaches may be taken.