Next Previous Contents

9. Configuring MythTV.

By this point, all of the compile-time prerequisites have been installed, mysql is running and has had its initial database setup. It's now time to configure MythTV.

NOTE: If you're running Debian unstable and you have compiled MythTV from source, you will need to install an additional package before you will be able to run MythTV. Execute the following to install the MySQL driver for QT.
$ su -
# apt-get install libqt3c102-mt-mysql
# exit

9.1 Configuring the Master backend system

Open a shell and decide where you will store your video files. By default, MythTV will assume that you will be using /mnt/store/, but if this directory doesn't exist, or it exists and you don't have write privileges to it then MythTV will fail when you attempt to make a recording. The following example is specific for /var/video, but the same instructions would apply if you want to keep the default but don't have the directory structure setup yet. See the Advanced Partition Formatting section for hints on creating a partition for MythTV.

If you create a /var/video subdirectory, change /mnt/store/ to /var/video/ in the setup screens.

$ su
# mkdir /var/video
# chmod a+rwx /var/video
# exit

NOTE: The last slash "/" is not required.

The first thing to configure is the Master backend system. If you are running multiple backend systems, the Master backend will make all decisions about which programs will be recorded on which tuners. If you have only one backend, then it will be its own master.

The Master backend will always choose the first available tuner in the same order as you add cards through "setup". In other words, the second card you add will only be used when there are two overlapping recordings, the third when there are three, and so on. Therefore, you will want to have the greatest amount of disk space on the Master backend because its tuner will always be the first choice. You will then want to add your other backends in the order of your preference for recording.

NOTE: It is possible to not have the cards on the Master backend be the first ones used. However, if you are new to MythTV it is easier to configure the Master backend first before moving on to the Slaves, at least until you become more familiar with the MythTV system. See Advanced Backend Configurations for information on configuring multiple backend systems in various ways.

Because MythTV uses a database to store all configuration variables, part of the bootstrap of MythTV is to indicate the location of the MySQL database server. If the frontend, backend and MySQL database server are all going to be running on the same box, you can continue to the next step. If not, you'll need to change the Host Name in the "Database Configuration" screen of the mythfrontend program.

NOTE: Users that have been running the frontend and the backend on different machines have stated that they have been having issues with remote access to the MySQL database. The following instructions may or may not work. Add the following to /etc/my.cnf on the backend machine and restart MySQL.
skip-innodb
set-variable=thread_stack=256k

Run the setup program:

$ mythtv-setup

The backend setup program will start and offer you a number of choices. It is strongly recommended that you go through them in order.

The first question will ask if you wish to clear out your existing configurations for your capture cards. Initially, you should say "YES" so that there are no surprises later.

The next question will ask you if you wish to clear out your video source information. You should answer "YES" to this as well.

Once the graphical setup starts, you'll see that there are five choices.

  1. General
  2. Capture Cards
  3. Video Sources
  4. Input Connections
  5. Channel Editor

Use the arrow keys to move around, and press the space bar to select which option you wish to configure.

General

The first screen of the General configuration deals with IP addresses of the system that you're running setup on and any master backend you may have. If you've only got one machine, then the default values are fine and you can move to the next page by pressing the space bar. If you need to move around the screen, use the arrow keys to move focus between settings, not the mouse.

If you will be deploying multiple backends, or if your backend is on one system and you're running the frontend on another machine then do not use the "127.0.0.1" IP address.

NOTE: If you modify the 127.0.0.1 address and use a "real" IP address, you must use real IP addresses in both fields, otherwise your frontend machines will generate "Unexpected response to MYTH_PROTO_VERSION" errors.

It is very strongly discouraged that you make any changes to the port settings from the defaults.

Once you're satisfied with the values, move the focus down to Next and hit the space bar.

The next screen details the Host-specific Backend setup. This is where you will set the specific directory paths for this particular backend. Make sure that you've followed the steps at the beginning of this section and created a directory that exists and that MythTV will have write privileges to. When you're done, press Next to continue, taking you to the Global Backend Setup.

On the Global Backend Setup configure your backend with the appropriate settings. Use the left and right arrow keys to iterate through the choices available on each setting, and the up and down keys to move between settings. Move to Finish when you're done and press the space bar, taking you back to the main configuration screen.

Capture Cards

You should have no capture cards defined, so the highlight will be on (New Capture Card). Press space to begin.

Choose the appropriate settings for your particular tuner. Use the arrow keys to move around and to make your choices, and press RETURN when complete. Pressing RETURN will take you back to the Capture Cards screen; if you have additional capture cards in this machine, press the space bar when the highlight is on the (New Capture Card) row to define another card.

If you have made a mistake, you can delete a card by highlighting it and pressing the 'D' key, or you can highlight it and press the RETURN or 'E' key to edit it.

Once you have no additional cards to setup, press ESC.

Video Sources

When you start, the highlight should be on (New Video Source). Press the space bar to begin. The first field asks for the name of the video source. You may choose something easy to remember, like "Antenna" or "Cable". Once you've chosen a name, press the down arrow to move to the next field.

If you're in North America, change the grabber to "DataDirect", then continue pressing the down arrow to move to the next field. Fill in the username and password that you have established with DataDirect, then move to the "Retrieve Listings" button and press the space bar.

NOTE: You need wget version 1.9.1 or higher to use DataDirect.

The setup program will contact the Zap2It servers and get your account information. Once you're done, you may click the Finish button and skip the next few paragraphs in this document since they only apply to users that are using the external XMLTV script to get their guide data.

If you wish to continue using the XMLTV grabber, then move to the Zip/postal code field and put in the appropriate value.

If you're outside of North America, then some manual interaction will be required with XMLTV.

Once you have chosen your provider, press RETURN to continue. XMLTV will now begin collecting the initial data for your location. The screen may blank for a few seconds to several minutes, depending on the load of the listings provider and the speed of your connection to the Internet. Be patient!

You will then be returned to the Video Sources screen. If you have multiple video sources available, such as Antenna, Cable, etc, go ahead and define them all, even if they're not all going to be physically connected to the master backend server. Once you're done, press ESC to return to the main screen.

Input Connections

The final configuration item is Input Connections. On this screen, you will associate the various video sources you defined earlier with a physical input to a encoder card. It's entirely possible that you have multiple tuners, and each tuner has a different input, so on this screen you let MythTV know which device will connect to which input source.

When you start this screen, you should see a listing of the various input connections available on each of the Capture cards you defined earlier. For example, you may have a capture card with a tuner, a SVideo and a Composite connection. If you wanted to associate the tuner (a.k.a., "Television") with an "Antenna" source you defined in Video Sources, you would move to the /dev/videodevice (Television) -> line and press the space bar. Using the left and right arrow keys will show you the various choices you have already created for video source. In our case, you would use the left/right cursor keys until "Antenna" was shown in the Video Source field. Press down to move to the next setting, all of which should be self-explanatory.

If you have multiple input connection types (Such as Tuner 0 and Tuner 1), it's very, very likely that it is the lowest numbered input that is actually available on the device.

NOTE: If you have a Hauppauge PVR-500, you must think of it has two PVR-150's on a single PCI card. For example, if you have a single PVR-500 card, it will appear as /dev/video0 and /dev/video1. Each /dev/video device will have a Tuner input.
Once you're done, press RETURN to go back to the Input Connections screen. You would then finish associating the video sources to any other hardware devices you have available.

NOTE: Don't add a video source to a hardware input if you don't actually have anything connected there. For example, adding "Cable" to the Tuner and to the Composite inputs without having something connected to Composite will lead to blank recordings.

Press ESC to return to the main menu, and press ESC again if you have no further items to configure, thereby returning you to the command line.

Channel Editor

The channel editor is used to globally alter channel information, including items like hue, contrast, fine tuning and others. Users in North America shouldn't run the channel editor until after completing initial setup and running mythfilldatabase at least once to populate the database.

9.2 Post-configuration

Run the mythfilldatabase program as directed. The master backend will obtain guide data for all the video sources you defined during setup.

NOTE: If you are using DataDirect and watching the output messages on the console or the log file it is normal to see a "401 Unauthorized" error followed by a "200 OK" when the connection to Zap2It is being established.

From : Sun Jun 13 05:00:00 2004 To : Mon Jun 14 05:00:00 2004 (UTC)
--02:58:01--
http://datadirect.webservices.zap2it.com/tvlistings/xtvdService
           => -'
Resolving datadirect.webservices.zap2it.com... 206.18.98.160
Connecting to datadirect.webservices.zap2it.com[206.18.98.160]:80...
connected.
HTTP request sent, awaiting response... 401 Unauthorized
Connecting to datadirect.webservices.zap2it.com[206.18.98.160]:80...
connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/xml]

    [    <=>                              ] 114,125       63.57K/s

02:58:03 (63.53 KB/s) - -' saved [114125]

Your subscription expires on 08/20/2004 12:00:00 AM
Grab complete.  Actual data from Sun Jun 13 05:00:00 2004 to Mon Jun 14
00:00:00 2004 (UTC)

Once mythfilldatabase has finished, start the master server before continuing.

$ mythbackend

mythbackend will print information about connections and what it's doing to the console. If you'd like to see the options that are available for mythbackend, type mythbackend -h for help.

As of MythTV v0.19, the available options are:

$ mythbackend --help
Valid options are:
-h or --help                   List valid command line parameters
-l or --logfile filename       Writes STDERR and STDOUT messages to filename
-p or --pidfile filename       Write PID of mythbackend to filename
-d or --daemon                 Runs mythbackend as a daemon
-v or --verbose debug-level    Use '-v help' for level info
--printexpire                  List of auto-expire programs
--printsched                   Upcoming scheduled programs
--testsched                    Test run scheduler (ignore existing schedule)
--resched                      Force the scheduler to update
--nosched                      Do not perform any scheduling
--nojobqueue                   Do not start the JobQueue
--noautoexpire                 Do not start the AutoExpire thread
--version                      Version information

Running mythbackend as a daemon and using the logfile option will allow you to have mythbackend automatically start up during the boot process. For example, you may add this to your rc.local file, or you can follow the steps outlined in the section called Automatically starting mythbackend at system boot time.

9.3 Configuring a non-master backend

Ensure that you've granted access to the master MySQL database for remote backends as discussed in the section titled Modifying access to the MySQL database for multiple systems and that you have the correct IP address for the database server in the "Database Configuration" screen of the setup application on this slave backend.

NOTE: Slave backends must not run a local MySQL daemon. By default, they will connect to their local daemon rather than the central database, causing unexpected behavior such as empty "Watch Recordings" lists and a failure to locate the Video Sources defined on the master backend. Modify the /usr/share/mythtv/mysql.txt file on all slave backends to ensure that the DBHostName has the address of the MySQL server.

Make sure that the IP addresses on the General setup screen are accurate. If the slave backend can't communicate with the master backend due to IP address misconfiguration then MythTV will not function properly.

Configuration of a non-master backend follows the same general procedure as that of the master backend, with the exception that you skip over the "Video Sources" step. All possible video sources need to be defined on the master backend system; only the master backend will query a listings provider to obtain guide data for all the non-master backends.

NOTE: Do not run mythfilldatabase on a non-master backend.

9.4 Configuring and running mythfilldatabase

NOTE: mythfilldatabase might take a while to complete, depending on any number of factors, most of which you can't control. It's best to just let the program run to completion.
mythfilldatabase --help will give a full listing of the options available.

mythfilldatabase --manual is another option; the manual option will allow you to fine tune channel frequencies and specify which channels will be added to the database. If you are not using the tv_grab_na grabber, you must use the --manual option.

mythfilldatabase --file is an option if there isn't an XMLTV grabber for your country, but you do have an XML formatted listings file created by some other program.

mythfilldatabase --xawchannels is an option if you have used xawtv to fine-tune your channels and would like to import the fine tuning offsets into MythTV.

mythfilldatabase --refresh-today will only pull guide data for today (in case of late-breaking changes to the schedule).

Periodically running mythfilldatabase

In order to keep your database filled, mythfilldatabase should be run once a day.

To use MythTV's built-in capability, you'll need to run the mythfrontend Setup option. From the MythFrontend, enter the Setup>General screen and advance to "Mythfilldatabase", the fourth screen. Select the checkbox, then complete the options as you see fit. The mythbackend program will now run mythfilldatabase for you.

9.5 Grabbing channel icons for DataDirect users

While the DataDirect TV listings service has several advantages, it does not support grabbing logo icons for the stations you receive. However, there are utilities provided with MythTV which you may use to grab your initial set of icons and to keep them updated if your lineups change.

First, you need to generate or obtain an XML file with the information for your stations.

If you have XMLTV software installed, there is a perl script in MythTV's contrib/ directory which will generate this file for you. Run the command:

$ perl mkiconmap.pl

You will be asked for your zip code and the service that you use. If there are no errors, the iconmap.xml file that you need for the next step will be created.

If you do not have XMLTV software installed and do not want to install it for the sake of this minor task, there is a generic contrib/master_iconmap.xml which you can copy and use but this may not be as complete as using the specific information for your service.

Once you have an iconmap.xml file, add the icon information to your database and grab any new icons with the command:

$ mythfilldatabase --import-icon-map iconmap.xml --update-icon-map


Next Previous Contents