From MythTV Official Wiki
Jump to: navigation, search

MythTV uses an Electronic Program Guide, or EPG. The data for that can provided by two sources:

  1. either by some external source like SchedulesDirect or XMLTV,
  2. or by using EIT data included into the digital video stream broadcasted in parallel with the video/audio data.

The EIT (Event Information Table) is extra data that is broadcast with a television signal, much like Closed Caption Text in the VBI stream. EIT provides program data for the current show and future shows which can be then used to view on-screen program information, such as title, length, description and more. This can also be gathered to build a program guide for current and future shows on all your available channels. Most cable and satellite services do. Even many modern digital televisions can have a program guide by gathering and storing EIT.

EIT is typically available over digital television signals, either terrestrial, cable or satellite. With terrestrial signals, each channel provides it's own EIT. Information is usually only available for the upcoming 24 hours. With satellite, the EIT is broadcast on it's own stream, or an Aggregate Event Information Table (AEIT), and contains information for all the channels broadcasted, and can provide scheduling information for more than a week.

It seems that for some people EIT only works when channels have been scanned by MythTV (this has been reported to have been necessary by a DVB-T user in the UK and a DVB-C user in the Netherlands). Importing channels.conf doesn't provide enough information for MythTV to use EIT.

Howto Enable EIT Scanning

You have 3 options to change EIT setting:

  1. Use only certain tuners for EIT collection (tuner EIT setting)
  2. Disable EIT collection on only certain channels so that you can use EIT for some channels and XMLTV/SD for other channels on the same Video Source (though never use both on any channel)
  3. Disable EIT collection on every single channel on a Video Source so you can use XMLTV/SD for all the channels on that Source without having to disable EIT on every single channel in the source
  • In mythtv-setup Video Sources=>your EPG source, check the box "Perform EIT Scan".
  • In MythWeb Settings=>Channel Info, tick the "useonairguide" box for each Channel you want to scan for EIT data. Sometimes, EIT data is retrieved even when "useonairguide" is not checked.

Important.png Importing channels via channels.conf?: EIT will only work for channels picked up via a Full Scan, not those imported via channels.conf [1]

Important.png Note for Australian DVB-T users: Australian TV stations have recently started broadcasting up to 7 days of EIT information, therefore when using this data with MythTV an additional EPG source is not required. Often a generic title such as "SPECIAL EVENT" or "AFTERNOON MOVIE." is utilised with more information in the Subtitle or Description. For more information see Australian_TV_Listings.

Information.png Tip: If EIT does not appear to show in the OSD, you can try to enable EIT in MythTV 0.20 (assuming EIT is compiled in mythtv) using a channels.conf created from a program such as 'scan' (dvb-utils). Import channels.conf into mythtv-setup, then delete the channels. This will have populated MythTV with the correct transports for your transmitter/transponder (sometimes MythTV cannot find the transports on it's own). Now let MythTV do a full scan using the existing transports. You should now have EIT showing in MythTV. Users of DVB-T (Freeview) in UK will now have the next seven days of listings available (it may take some time for the listings to build up as the EIT is scanned). Sometimes even scanning the channels with MythTV does not help to show EIT (Problem verified in Germany with DVB-C and small regional provider, MythTV 0.23 and 0.24). Check your transponders if they have a transport id (tid) and network id (nid) (perhaps by looking in table dtv_multiplex; there should be no NULL value in the table). I solved the problem of no EIT by googling for Transport IDs from Astra satellites(it seems my cable provider directly feeds in Astra transponders) and writing them to the database.

Information.png Tip: If EIT does not appear and you have the Provider KABSI (Code: 222) in Austria follow this link -> http://code.mythtv.org/trac/ticket/9592. This worked for me after searching for a long Time.

Information.png Tip: In the U.S. some digital stations may not appear in the program guide even though they are broadcasting program information. This may be due to a "hidden guide" bit that is transmitted by the stations. To see if this is the case run mythbackend with the --verbose important,general,eit option. After some time passes check the output or check /var/log/mythtv/mythbackend.log for "is hidden in guide" output. One way to get the data to be included in the EPG is to "hack" the atscstreamdata.cpp file in libmythtv/mpeg/. Delete the code below from atscstreamdata.cpp and then reinstall mythtv from source.

if (vct->IsHiddenInGuide(i))
    VERBOSE(VB_EIT, QString("%1 chan %2-%3 is hidden in guide")
      .arg(vct->ModulationMode(i) == 1 ? "NTSC" : "ATSC")

Although eit over the air is not as extensive as with Schedules Direct, it is free. Note: one should almost never enable EIT when using Schedules Direct in the U.S. The (bad) EIT data provided by most providers will stomp all over the (good) Schedules Direct data.

Information.png Tip: Radio on Freeview Terrestrial UK: tv_grab_uk_rt / xmltv does not provide radio program information. You have to use EIT data from the air for radio programs. Set up the video source for TV grabber as normal and ensure Perform EIT Scan is set. Then edit each radio channel to use EIT (easiest done with mythweb if you have it: mythweb/settings/tv/channels - check useonairguide for each radio channel) Lastly, make sure your capture cards are enabled for eit scanning through mythtv-setup->capture cards or set field dvb_eitscan in table capturecard with sql.

Be careful of enabling EIT capture on more than one card. On my two DVB-T USB tuners I had both set to capture EIT and this would crash the USB totally.

Information.png Tip: You may be told that in the US OTA EIT information is terribly inaccurate. I believed that and tolerated/suffered the garbled program description information for 5 years, until I found this:

http://code.mythtv.org/trac/ticket/11739 That patch does not exactly work for me (reduced number of wrong program descriptions, but there are still some). But I followed the idea there and modified the code (on 0.27-fix), which totally solved my program title/description mismatch problem (NYC area). Here is my patch:

diff --git a/mythtv/libs/libmythtv/eithelper.cpp b/mythtv/libs/libmythtv/eithelper.cpp
index bf980ed..44c0bef 100644
--- a/mythtv/libs/libmythtv/eithelper.cpp
+++ b/mythtv/libs/libmythtv/eithelper.cpp
@@ -78,7 +78,10 @@ uint EITHelper::ProcessEvents(void)
     for (uint i = 0; (i < kChunkSize) && (db_events.size() > 0); i++)
         DBEventEIT *event = db_events.dequeue();
-        eitList_lock.unlock();
+        // WL: see http://code.mythtv.org/trac/ticket/11739#no1
+        // from that post, removing following line can solve the EIT title/description
+        // mismatch problem.
+        // eitList_lock.unlock();
@@ -86,7 +89,7 @@ uint EITHelper::ProcessEvents(void)
         maxStarttime = max (maxStarttime, event->starttime);
         delete event;
-        eitList_lock.lock();
+        // eitList_lock.lock();
     if (!insertCount)
@@ -148,6 +151,7 @@ void EITHelper::SetChannelID(uint _channelid)
 void EITHelper::AddEIT(uint atsc_major, uint atsc_minor,
                        const EventInformationTable *eit)
+    QMutexLocker locker(&addEit_lock);    // <WL> fix possible race condition
     uint atsc_key = (atsc_major << 16) | atsc_minor;
     EventIDToATSCEvent &events = incomplete_events[atsc_key];
     EventIDToETT &etts = unmatched_etts[atsc_key];
diff --git a/mythtv/libs/libmythtv/eithelper.h b/mythtv/libs/libmythtv/eithelper.h
index 770d8d7..ff9abb4 100644
--- a/mythtv/libs/libmythtv/eithelper.h
+++ b/mythtv/libs/libmythtv/eithelper.h
@@ -106,6 +106,7 @@ class EITHelper
         //QListList_Events  eitList;      ///< Event Information Tables List
     mutable QMutex    eitList_lock; ///< EIT List lock
+    mutable QMutex    addEit_lock;  // <WL> fix possible race condition
     mutable ServiceToChanID srv_to_chanid;
     EITFixUp               *eitfixup;
diff --git a/mythtv/libs/libmythtv/programdata.cpp b/mythtv/libs/libmythtv/programdata.cpp
index b182d1e..03e56e1 100644
--- a/mythtv/libs/libmythtv/programdata.cpp
+++ b/mythtv/libs/libmythtv/programdata.cpp
@@ -477,13 +477,24 @@ uint DBEvent::UpdateDB(
     QString  lseriesId  = seriesId;
     QDate loriginalairdate = originalairdate;
-    if (match.title.length() >= ltitle.length())
+    // <WL> See http://code.mythtv.org/trac/ticket/11739
+    // to fix EIT title/description mismatch issue. I made further modifications, so as
+    // long as title has been updated, everything is updated from latest EIT.
+    // <WL> modified this to ensure latest information overwrite DB
+    bool title_replaced = true;
+    if ( ltitle.length()<=0 )
+    {
         ltitle = match.title;
+        title_replaced = false;
+    }
-    if (match.subtitle.length() >= lsubtitle.length())
+    // <WL> modified this to ensure latest information overwrite DB
+    if ( !title_replaced )
         lsubtitle = match.subtitle;
-    if (match.description.length() >= ldesc.length())
+    // <WL> modified this to ensure latest information overwrite DB
+    if ( !title_replaced )
         ldesc = match.description;
     if (lcategory.isEmpty() && !match.category.isEmpty())

I hope the developers can fix it soon. If any of you knows how to bring this to the attention of the developers, please do that. Thank you.

Update <2014-02-06>: the patch I posted around Jan 27, 2013 still generates some wrong program descriptions. I just updated the patch and so far I have not seen any wrong program descriptions with the current one.