MythTV Down Under (finally, it’s not all upside down)

Every 6 months or so for the past number of years I have tried to install a dedicated PVR, and fail. I give up because I just can’t get all the Australian stuff working nicely, but finally I have succeeded!

The main problem is that the tv guide grabbers just don’t work nicely in Australia. Install mythtv in the States and you’ll be working in 5 minutes, but here it’s a whole lot of heartache and pain.

Sure, I can easily watch TV, but I can do that in 30 seconds under Linux with Me-TV or Kaffeine. I want to be able to see what’s coming up, schedule recordings and all that sweet stuff (OK, Me-TV can do that too, but it’s new, and I also like the idea of mythtv :))

For anyone else out there like me, here’s what I did!

MythTV

Install mythbuntu, or get your mythtv software installed. This should work with any distro with mythtv, but I installed Mythbuntu (the Ubuntu based MythTV distribution).

I had to add my default user to mythtv group and then re-login
sudo gpasswd -a [user] mythtv

Create a place for recordings
sudo mkdir /home/store
sudo chown mythtv:mythtv /home/store
sudo chmod 775 /home/store

Create the database (use root password and the mythtv database password from the install process)
mysql -u root -p
create database mythconverg;
grant all on mythconverg.* to 'mythtv'@'localhost' identified by 'password';
quit

Now, setup mythtv. In Mythbuntu, open the “Control Center” from Applications -> System.
Click the “MythTV Configuration” button on the left hand side, and on the right pane click “Launch MythTV Setup”.

Others can run the command mythsetup which should do the same thing (make sure you’re in the mythtv group!).

Now, inside the mythsetup program, answer any initial prompts like setting the language and database updates.

Now, configure MythTV as folllows! (Note, I am assuming you are using a DVB card that Linux has detected and which works.)
1. General, set TV format to PAL, “Channel freq table” to australia, and “timezone” to Auto, finish.
2. Capture cards, add a new capture card, set “Card type” to be DVB DTV capture card, finish.
3. Video source, add a new video source, set “Video source name” to anything (i.e. Channels), set “Listings grabber” to No grabber, leave “Channel frequency” to default, then finish.
4. Input connections, select your capture card, set a name if you want, and set “Video source” to the name you set in step 3 (i.e. Channels), hit next, finish.
5. Channel editor, hit “channel scanner” in the bottom left, all settings should be auto filled as above, hit next to start scan, finish.
6. Storage, open “Default” and add a new directory, type the path you created above, i.e. /home/store.
4. Input connections, load your card, set “Starting channel” to a channel you want, next, finish.

Exit mythtvsetup and make sure you run mythfilldatabase when prompted.

I repeat. Run mythfilldatabase!

TV GUIDE
TV should now be working, but to get guide information we turn to a script called shepherd.

Shepherd is a perl script, see the website for a full set of instructions.

Download it 🙂
wget http://www.whuffy.com/shepherd/shepherd

Shepherd requires a whole heap of perl modules, so if you are using a Debian based system then you can easily install them with the following command:
sudo apt-get install xmltv libxml-simple-perl libjavascript-perl libalgorithm-diff-perl libgetopt-mixed-perl libcompress-zlib-perl libdata-dumper-simple-perl libdate-manip-perl liblist-compare-perl libdatetime-format-strptime-perl libhtml-parser-perl libxml-dom-perl libgd-gd2-perl libdigest-sha1-perl libarchive-zip-perl libio-string-perl libdbi-perl

Now we need to configure shepherd, so run:
perl shepherd --configure

It will upgrade any “grabbers” then ask you for your region code. So enter your region then press enter (I’m in Canberra, so I enter 126).

Answer the following questions when asked:
"Would you like Guided channel selection?" Type, yes.
"Do you have High-Definition (HDTV)?". Type yes if you do.
"Do you have PayTV?" I said no.

You will be then asked to match each of your “MythTV channel’s” to the correct “Guide data sources” channel.
You will have to do this for each MythTV channel that you want a guide for (i.e. map “Channel 10” with “Capital”, Prime with “Prime”, ABC1 with “ABC”, etc.).

Once finished it will allow you to double check the channel mappings. If correct type yes.

When asked if you want to “Transition from grabber?”, enter 0 (that’s a ZERO).
When asked whether to “Create configuration file and update MythTV?” type yes.

Shepherd can also attempt to download the channel icons. If you want them, then answer yes when it asks “Shepherd can (optionally) install channel icons.”.

If you choose to download icons, if found, you will be asked to choose from a number of options. Take a punt 🙂

When asked: “Grab data now?” type no (as in NO).

You should now be back at the terminal. We now need to get shepherd to grab the guide information from the Internet.

Run the following
~/.shepherd/shepherd --daily
Note: As this is the first time this has been run, it will take a while, around 45 mins!

Now we need to load the guide information into the MythTV database:
mythfilldatabase --file 1 ~/.shepherd/output.xmltv

Congratulations MythTV should now have full guide information. The only thing left to do is to cron shepherd so it runs regularly.
Start crontab
crontab -e
and enter
44 * * * * ~/.shepherd/shepherd --daily --quiet && mythfilldatabase --update --file 1 ~/.shepherd/output.xmltv --quiet

NOTE: You are not reading the cron incorrectly, above it is scheduled to run every hour. You can change this if you want (it’s just the recommended default). The question is whether your MythTV box is going to be on all the time, or only at certain times. If it’s always on, you could change it to once a day or something, but if not then it’s best to tell it to check pretty regularly to make sure it’s updated within an hour of it being on. Of course you can run it manually 😉

That’s it! Now open the MythTV frontend and enjoy your TV – with guide.

-c

12 thoughts on “MythTV Down Under (finally, it’s not all upside down)

  1. Excellent timing, I finally got my MythBuntu setup going again today – had problems with not realising I was picking up signals from multiple transmitters and it preferred the ones with not enough signal for a lock!

    Now I’ve got that *and* a real program guide! 🙂

    Thanks so much,
    Chris

  2. You can also get MythTV running shepherd like it does the “normal” grabbers, the trick is to make sure that all the .shepherd stuff is in the ~/mythtv directory on a Mythbuntu install. You still have to configure shepherd from the command line, but as the mythtv user (or do it as your normal user then copy the directory across and change ownership).

    With my always on box I’ve found having a crontab entry for shepherd and one for mythfilldatabase a bit safer:
    # m h dom mon dow command
    0 3 * * * /home/troy/.shepherd/shepherd –quiet
    0 5 * * * /usr/bin/mythfilldatabase –update –file 2 /home/troy/.shepherd/output.xmltv

  3. Hi Chris,

    Great guide there! Excellent work.

    I would recommend looking into anacron to solve the “system wakes up at 11:56AM and doesn’t get guide data until 1:00AM the next morning” problem. I don’t use this, as my master backend is on all the time, but it would seem that a configuration like:

    1 0 GetTVGuide ~/bin/run_mythfill.sh

    Where the ~/bin/run_mythfill.sh files contains:

    #!/usr/bin/sh

    ~/.shepherd/shepherd –daily –quiet
    mythfilldatabase –update –file 1 ~/.shepherd/output.xmltv –quiet

    (I usually try to package non-trivial cron commands in a script so I can run them easily, and so that I can fiddle with how things work without having to hack the crontab.)

    Hope this helps,

    Paul

  4. just wondering how , daily or weekly corrections to the data works out
    eg with the current OzTivo data I routinely update the guide data to reflect current episodes etc so I can track the specific showings of series that I watch.
    Does this have the same capability?
    thanks

  5. Hi Chris, great work, but time for an update! Or is the epg data now so good in Aus that shepherd is redundant?

    Mythtv-setup is invoked by the preceeding not mythsetup btw

    Cheers

    Dave

  6. Hi Dave,

    Thanks for that. Yeah, probably is time for an update but I haven’t used myth for a long time – probably since that post! Not sure on the status…

    Cheers,
    -c

  7. I installed Mythtv 2013 and it has run 24/7 until a month ago it failed to get data from shepherd using fillmythdatabase.

    I thought it time to build another box from PPA myth 29.1.
    Completed the initial setup of the BE setting “No Grabber” etc for shepherd.
    Ran fillmythdatabase(think I did this but?).
    Ran shepherd with referance to https://github.com/ShephedProject/shepherd/wiki/Installation#PerlDependencies.
    Rebooted and run fillmythdatabase. Nothing loaded.
    Shepherd produced output.xmltv with 7.3 MB of data.
    Tried many things but nothing has worked. Should I start again?
    I am lost. Hope you can help.
    Cheers
    Glen

  8. I installed Mythtv 2013 and it has run 24/7 until a month ago it failed to get data from shepherd using fillmythdatabase.

    I thought it time to build another box from PPA myth 29.1.
    Completed the initial setup of the BE setting “No Grabber” etc for shepherd.
    Ran mythfilldatabase(think I did this but?).
    Ran shepherd with reference to https://github.com/ShephedProject/shepherd/wiki/Installation#PerlDependencies.
    Rebooted and run mythfilldatabase. Nothing loaded.
    Shepherd produced output.xmltv with 7.3 MB of data.
    Tried many things but nothing has worked. Should I start again?
    I am lost. Hope you can help.
    Cheers
    Glen

Leave a Reply

Your email address will not be published. Required fields are marked *