From MythTV Official Wiki
Jump to: navigation, search

This a tutorial on how to use TVxb with MythTV. TVxb is a EPG Grabber that can be used in Brazil. First of all, make sure you have all of the following up-and-running. It is not within the scope of this page to teach you how to do it, but take care with a few points:

  • MythTV
    • Run through mythtv-setup as usual, setting up capture cards, video sources and inputs. Leave the channels alone, though.
    • Still in mythtv-setup, chose "no grabber" for the video source, as we'll use cron to manage mythfilldatabase.
  • Wine
  • Xvfb
    • This is needed to fool TVxb into thinking there's and X display available when running it from cron.

Now download TVxb version 1.0085 and unzip it somewhere convenient. The following commands will install it on /usr/local/share/TVxb:

# wget
# unzip -d /usr/local/share/

Now grab an appropriate ini file for your country here, and put it in the proper directory, while first backing up the original TVxb.ini (if you feel like it):

# cd /usr/local/share/TVxb/ini
# mv TVxb.ini
# wget
# mv TVxb-compilation.ini TVxb.ini

It is also not within the scope of this page to teach or demonstrate how to edit these ini files. Check for that. Nevertheless, make sure the xmltvoutput main parameter is as follows, with no leading path specified:


This will prevent headaches on matching Windows paths to Unix file systems.

Once you're done with the ini file(s), run the following commands to test if everything's as it should be.

# cd /tmp
# wine /usr/local/share/TVxb/bin/TVxb.exe -NoConsole

You should see output like this:

17:03:13 (223.36 KB/s) - `Z:/usr/local/share/TVxb/html/TVxb-ESB-20060918.html' saved [11436/11436]

fixme:powermgnt:SetThreadExecutionState (0x7): stub, harmless.
fixme:powermgnt:SetThreadExecutionState (0x80000001): stub, harmless.
fixme:toolhelp:Heap32ListFirst : stub
           => `Z:/usr/local/share/TVxb/html/TVxb-HBO-20060918.html'
Resolving,,, ...
Connecting to[]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10,541 [text/html]

100%[====================================>] 10,541        --.--K/s

Press CTRL-C after a while (say, 5 minutes). The whole process might take several hours, but we'd like to test stuff quickly before making that kind of commitment! There should now be a non-empty xmltv.xml in the current directory (/tmp/xmltv.xml, if you followed instructions), and a bunch of html files in /usr/local/share/TVxb/html.

If your country's ini file provides channel numbers (namely, two "name" variables per channel, the second being the channel number), you can proceed to run mythfilldatabase. Make sure the backend is already running!

# mythfilldatabase --file 1 -1 /tmp/xmltv.xml

If you don't have channel numbers, I believe you'd have to add a "--manual" parameter to mythfilldatabase. I haven't tested this, though, so you're on your own.

At this point MythTV's channel database should be filled up with a few channels and some programming. Feel free to start the frontend and navigate a little. If everything's fine (meaning, you can change channels and see programming information in the guide), proceed to set up the daily run of mythfilldatabase.

First, create an executable file and add it to /etc/cron.daily (you'll fill it up in the next step), so that it runs every day at 04:00 AM.

# touch /usr/local/bin/tvxb_grab
# chmod a+x /usr/local/bin/tvxb_grab
# ln -s /usr/local/bin/tvxb_grab /etc/cron.daily/

Edit the file (vim /usr/local/bin/tvxb_grab) and add the following text verbatum:

# /usr/local/bin/tvxb_grab
# Glue for mythfilldatabase and TVxb.


[ -e $XML ] && rm $XML

echo "Running TVxb:"
export DISPLAY=:1
/usr/bin/Xvfb :1 &
/usr/bin/wine /usr/local/share/TVxb/bin/TVxb.exe -NoConsole
/usr/bin/killall Xvfb

echo "Running mythfilldatabase:"
/usr/bin/mythfilldatabase --file 1 -1 $XML
rm $XML

Note the use of Xvfb. Without it, TVxb won't run from cron, where there's no X display available.

Now get ready to relax, take a bath, go to the beach, or whatever. When you run the script for the first time, it will probably take a few hours to finish, depending on your connection / ini file settings / channel URLs.

# /usr/local/bin/tvxb_grab

That's it!