From MythTV Official Wiki
Revision as of 23:48, 30 June 2009 by Vanzandtj (talk | contribs) (out-of-sequence update)

Jump to: navigation, search

Clean.png Cleanup: This article or section may require cleanup. Discuss the issue on the talk page

Important.png Note: The correct title of this article is mythfilldatabase. It appears incorrectly here due to technical restrictions.

mythfilldatabase fills the Myth database program table with upcoming shows.

Automatic use of mythfilldatabase

Normally mythfilldatabase is run automatically by mythbackend every 24 hours. It uses an XMLTV or zap2it grabber as defined in mythtv-setup. For most people allowing mythfilldatabase to run automatically will be sufficient, however in areas with no XMLTV grabber or an unusual channel setup it may be run manually.

Manual use of mythfilldatabase

To run an extra time out of sequence (for example, because your subscription had run out, and you just renewed it), use no command line options:


Command line options


Run in manual channel configuration mode. This will ask you questions about every channel.


For running non-destructive updates on the database for users in xmltv zones that do not provide channel data. For example, to update two datasources with a single xmltv file, use:
      mythfilldatabase --update --file 1 tvguide.xml
      mythfilldatabase --update --file 2 tvguide.xml

See below for help about --file.


Use it in case that you want to assign a preset number for each channel, useful for non US countries where people are used to assigning a sequenced number for each channel, i.e.: 1->TVE1(S41), 2->La 2(SE18), 3->TV3(21), 4->Canal 33(60)...

--file <sourceid> <xmlfile>

Bypass the grabbers and read data directly from a file. <sourceid> = number for the video source to use with this file. <xmlfile> = file to read.

--dd-file <sourceid> <offset> <lineupid> <xmlfile>

<sourceid> = see --file
<offset> = see --file
<lineupid> = the lineup id
<xmlfile> = see --file

--xawchannels <sourceid> <xawtvrcfile>

(--manual flag works in combination with this). Read channels as defined in xawtvrc file given <sourceid> = cardinput, <xawtvrcfile> = file to read


When using DataDirect, ask mythfilldatabase to overwrite channel names, frequencies, etc. with the values available from the data source. This will override custom channel names, which is why it is off by default. This may manage to fix a corrupted channel lineup. You will also likely need to use this switch if your cable company does a channel realignment, once your program listings source catches up.


When using DataDirect, ask mythfilldatabase to remove new channels (those not in the database) from the DataDirect lineup. These channels are removed from the lineup as if you had done so via the DataDirect website's Lineup Wizard, but may be re-added manually and incorporated into MythTV by running mythfilldatabase without this option. New channels are automatically removed for DVB and HDTV sources that use DataDirect.


Normally MythTV tries to avoid adding ATSC channels to NTSC channel lineups. This option restores the behaviour of adding every channel in the downloaded channel lineup to MythTV's lineup, in case MythTV's smarts fail you.

--graboptions <"options">

Pass options to grabber.

--sourceid <number>

Only refresh data for sourceid given.

--max-days <number>

Force the maximum number of days, counting today, for the grabber to check for future listings.


Get as little listings data as possible to update channels.




(Only valid for grabbers: DataDirect, se_swedb, no, ee, de_tvtoday). Force a refresh today or two days (or every day) from now, to catch the latest changes. These may be used to attempt to fix corrupted program guide data.


Tomorrow will always be refreshed unless this argument is used.


"To be announced" programs will always be refreshed unless this argument is used.

--export-icon-map [<filename>]

Exports your current icon map to <filename> (default: iconmap.xml).

--import-icon-map [<filename>]

Imports an icon map from <filename> (default: iconmap.xml).


Updates icon map icons only.

--reset-icon-map [all]

Resets your icon map (pass all to reset channel icons as well).


Marks any programs with a OriginalAirDate earlier than their start date as a repeat.

-v or --verbose debug-level

Use '-v help' for level info.


This text.

--manual and --update can not be used together.

External XMLTV

If you are in a country where mythfilldatabase will not work the normal way you will need to use the --file flag (e.g. XMLTV does not have a grabber included, or the grabber options are not fully supported by MythTV).

1. Obtain xml file of tv guide

Here in Belgium, I use pytvgrab to get my tv guide and output to an xml file:

$ tv_grab_be_tvb --configure  (you only need this the first time)
$ tv_grab_be_tvb -o belgium.xml

2. Find out the source id of your card

This is normally '1' if you have only one input card, but it is best to check it out because I have found if I have run mythtv setup more than once it can end up being something other than 1. To check, you need to look at the database:

$ mysql -u root mythconverg
mysql> select * from cardinput\G

Remember the source id

3. Run mythfilldatabase with the --file flag

The --file argument allows to directly import xmltv files. This is useful if you are using programs like nxtvepg to grab your EPG data.

Prior 0.21:

The offset argument the defines the number of days from today on to be updated. "-1" will refresh all. In this example "belgium.xml" is the file name for the output of the grabber:

$ mythfilldatabase --file <sourceid> offset belgium.xml

From 0.21 on:

From version 0.21 on the arguments of this command changed. The offset argument has been removed and the command changed to:

$ mythfilldatabase --file <sourceid> belgium.xml

The first time you will need to use the --manual flag, but this is better explained on the XmlTv page.


1. LinkSys or Fedora Core

I spent the past 3 weeks trying to troubleshoot a problem I was having with mythfilldatabase. I would run it and it would download between 5K and 3K and then just timeout. If I tried downloading the NVidia drivers, the nVidia page would not even come up.

I found this solution

which says to do this:

add this line in /etc/sysctl.conf

net.ipv4.tcp_window_scaling = 0

execute sysctl -p /etc/sysctl.conf or restart your computer

Weeks of frustration fixed. Hope this helps someone.

Note from a network techie.... Please be aware that disabling tcp window scaling has a system wide impact and will probably result in much slower bulk transfer speeds. Just thought you should be aware.

Note from another network techie: if you're scripting this to auto-download then run mythfilldatabase, you could instead say `/sbin/sysctl -w net.ipv4.tcp_window_scaling = 0` before your download, and then `/sbin/sysctl -w net.ipv4.tcp_window_scaling = 1` again afterwards, to make the setting temporary while downloading, rather than putting the setting in /etc/sysctl.conf and making it permanent.

Note from another techie: Don't do this. That a normal download over HTTP from another site didn't work is a sure sign that something completely independent from mythfilldatabase is wrong. Fix or replace your horribly broken/misconfigured router instead. (...which very likely means taking out that firewall rule you deployed in an attempt to evade your ISP's tampering with BitTorrent traffic.)


If you find in mythfilldatabase's logs something like:

2006-11-21 22:33:22.474 DB Error (Inserting into program table):
Query was:
INSERT IGNORE INTO program (chanid, starttime, endtime, title, subtitle, description, 
showtype, category, category_type, airdate, stars, previouslyshown, stereo, subtitled, 
hdtv, closecaptioned, partnumber, parttotal, seriesid, originalairdate, colorcode, 
syndicatedepisodenumber, programid) SELECT dd_v_program.chanid, DATE_ADD(starttime, 
INTERVAL channel.tmoffset MINUTE), DATE_ADD(endtime, INTERVAL channel.tmoffset MINUTE), 
title, subtitle, description, showtype, dd_genre.class, category_type, airdate, stars, 
previouslyshown, stereo, subtitled, hdtv, closecaptioned, partnumber, parttotal, seriesid, 
originalairdate, colorcode, syndicatedepisodenumber, dd_v_program.programid FROM (dd_v_program, 
channel) LEFT JOIN dd_genre ON (dd_v_program.programid = dd_genre.programid AND 
dd_genre.relevance = '0') WHERE dd_v_program.chanid = channel.chanid;
Driver error was [2/1105]:
QMYSQL3: Unable to execute query
Database error was:
Unknown error

It most likely means your database has become corrupted. To fix the corrupted database run the following command

mysqlcheck -r -u <username> -p <password> mythconverg

3. mythfilldatabase causes the system to hang

This is probably an I/O saturation issue. mythfilldatabase and MySQL can cause hard disk or ATA bus saturation, causing Mythbackend to starve. Read more about Troubleshooting:Mythfilldatabase_IO_bottleneck.

4. mythfilldatabase is scheduled to run, but doesn't

One cause is invalid value in the "mythfilldatabase Log Path". This must be set to a writable filename, not a directory name. If it's set to a directory name (as "Log Path" might imply), or an invalid/non-writable filename, it simply won't run, and doesn't report the error anywhere.