Index: libs/libmythtv/eit.cpp
===================================================================
--- libs/libmythtv/eit.cpp	(revision 10051)
+++ libs/libmythtv/eit.cpp	(working copy)
@@ -279,6 +279,8 @@
     QString lsubtitle = subtitle;
     QString ldesc     = description;
     QString lcategory = category;
+    QString lairdate  = airdate;
+    QDate loriginalairdate = originalairdate;
 
     if (match.title.length() >= ltitle.length())
         ltitle = match.title;
@@ -292,6 +294,12 @@
     if (lcategory.isEmpty() && !match.category.isEmpty())
         lcategory = match.category;
 
+    if (lairdate.isEmpty() && !match.airdate.isEmpty())
+        lairdate = match.airdate;
+
+    if (loriginalairdate.isNull() && !match.originalairdate.isNull())
+        loriginalairdate = match.originalairdate;
+
     uint tmp = category_type;
     if (!category_type && match.category_type)
         tmp = match.category_type;
@@ -317,7 +325,8 @@
         "    closecaptioned = :CC,        subtitled     = :SUBTITLED, "
         "    stereo         = :STEREO,    hdtv          = :HDTV, "
         "    partnumber     = :PARTNO,    parttotal     = :PARTTOTAL, "
-        "    listingsource  = :LSOURCE "
+        "    listingsource  = :LSOURCE,   airdate       = :AIRDATE, "
+        "    originalairdate = :ORGAIRDATE "
         "WHERE chanid    = :CHANID AND "
         "      starttime = :OLDSTART ");
 
@@ -337,6 +346,8 @@
     query.bindValue(":PARTNO",      lpartnumber);
     query.bindValue(":PARTTOTAL",   lparttotal);
     query.bindValue(":LSOURCE",     1);
+    query.bindValue(":AIRDATE",     lairdate=="" ? "0000" : lairdate);
+    query.bindValue(":ORGAIRDATE",  loriginalairdate);
 
     if (!query.exec())
     {
@@ -458,14 +469,14 @@
         "  starttime,      endtime, "
         "  closecaptioned, subtitled,      stereo,          hdtv, "
         "  partnumber,     parttotal, "
-        "  listingsource ) "
+        "  listingsource,  airdate,        originalairdate ) "
         "VALUES ("
         " :CHANID,        :TITLE,         :SUBTITLE,       :DESCRIPTION, "
         " :CATEGORY,      :CATTYPE, "
         " :STARTTIME,     :ENDTIME, "
         " :CC,            :SUBTITLED,     :STEREO,         :HDTV, "
         " :PARTNUMBER,    :PARTTOTAL, "
-        " :LSOURCE ) ");
+        " :LSOURCE,       :AIRDATE,       :ORGAIRDATE ) ");
 
     QString cattype = myth_category_type_to_string(category_type);
 
@@ -484,6 +495,8 @@
     query.bindValue(":PARTNUMBER",  partnumber);
     query.bindValue(":PARTTOTAL",   parttotal);
     query.bindValue(":LSOURCE",     1);
+    query.bindValue(":AIRDATE",     airdate=="" ? "0000" : airdate);
+    query.bindValue(":ORGAIRDATE",  originalairdate);
 
     if (!query.exec())
     {
Index: libs/libmythtv/eit.h
===================================================================
--- libs/libmythtv/eit.h	(revision 10051)
+++ libs/libmythtv/eit.h	(working copy)
@@ -123,6 +123,7 @@
     QDateTime     starttime;
     QDateTime     endtime;
     QDate         originalairdate;
+    QString       airdate;          // movie year / production year
     DBCredits    *credits;
     uint32_t      chanid;
     uint16_t      partnumber;
Index: libs/libmythtv/eitfixup.cpp
===================================================================
--- libs/libmythtv/eitfixup.cpp	(revision 10051)
+++ libs/libmythtv/eitfixup.cpp	(working copy)
@@ -22,13 +22,20 @@
       m_ukCC("\\[(AD)(,(S)){,1}(,SL){,1}\\]|\\[(S)(,AD){,1}(,SL){,1}\\]|"
              "\\[(SL)(,AD){,1}(,(S)){,1}\\]"),
       m_ukYear("[\\[\\(]([\\d]{4})[\\)\\]]"),
-      m_comHemCountry("^(.+)\\.\\s(.+)\\.\\s(?:([0-9]{2,4})\\.\\s*)?"),
-      m_comHemPEnd("\\.$"),
+      m_comHemCountry("^(\\(.+\\))?\\s?([^ ]+)\\s([^\\.0-9]+)(?:\\sfrån\\s([0-9]{4}))(?:\\smed\\s([^\\.]+))?\\.?"),
       m_comHemDirector("[Rr]egi"),
-      m_comHemActor("[Ss]kådespelare"),
-      m_comHemSub("[.\?] "),
+      m_comHemActor("[Ss]kådespelare|[Ii] rollerna"),
+      m_comHemHost("[Pp]rogramledare"),
+      m_comHemSub("[.\\?\\!] "),
       m_comHemRerun1("[Rr]epris\\sfrån\\s([^\\.]+)(?:\\.|$)"),
-      m_comHemRerun2("([0-9]+)/([0-9]+)(?:\\s-\\s([0-9]{4}))?")
+      m_comHemRerun2("([0-9]+)/([0-9]+)(?:\\s-\\s([0-9]{4}))?"),
+      m_comHemTT("[Tt]ext-[Tt][Vv]"),
+      m_comHemPersSeparator("(, |\\soch\\s)"),
+      m_comHemPersons("\\s?([Rr]egi|[Ss]kådespelare|[Pp]rogramledare|[Ii] rollerna):\\s([^\\.]+)\\."),
+      m_comHemSubEnd("\\s?\\.\\s?$"),
+      m_comHemSeries1("\\s?(?:[dD]el|[eE]pisode)\\s([0-9]+)(?:\\s?(?:/|:|av)\\s?([0-9]+))?\\."),
+      m_comHemSeries2("\\s?-?\\s?([Dd]el\\s+([0-9]+))"),
+      m_comHemTSub("\\s+-\\s+([^\\-]+)")
 {
 }
 
@@ -370,132 +377,172 @@
  */
 void EITFixUp::FixComHem(DBEvent &event, bool process_subtitle) const
 {
-    // the format of the subtitle is:
-    // country. category. year.
-    // the year is optional and if the subtitle is
-    // empty the same information is in the Description instead.
-
-    if (event.subtitle.length() == 0 && event.description.length() > 0)
+    // Reverse what EITFixUp::Fix() did
+    if (event.subtitle.isEmpty() && !event.description.isEmpty())
     {
         event.subtitle = event.description;
         event.description = "";
     }
 
-    // try to find country category and year
-    QRegExp tmpCountry = m_comHemCountry;
-    int pos = tmpCountry.search(event.subtitle);
-    if (pos != -1)
+    // Remove subtitle, it contains the category and we already know that
+    event.subtitle = "";
+
+    bool isSeries = false;
+    // Try to find episode numbers
+    int pos;
+    QRegExp tmpSeries1 = m_comHemSeries1;
+    QRegExp tmpSeries2 = m_comHemSeries2;
+    if ((pos = tmpSeries2.search(event.title)) != -1)
     {
-        QStringList list = tmpCountry.capturedTexts();
-
-        // sometimes the category is empty, in that case use the category from
-        // the subtitle. this category is in swedish and all others
-        // are in english
-        if (event.category.length() == 0)
+        QStringList list = tmpSeries2.capturedTexts();
+        event.partnumber = list[2].toUInt();
+        event.title = event.title.replace(list[0],"");
+    }
+    else if ((pos = tmpSeries1.search(event.description)) != -1)
+    {
+        QStringList list = tmpSeries1.capturedTexts();
+        if (!list[1].isEmpty())
         {
-            event.category = list[2].stripWhiteSpace();
+            event.partnumber = list[1].toUInt();
         }
+        if (!list[2].isEmpty())
+        {
+            event.parttotal = list[2].toUInt();
+        }
 
-        if (list[3].length() > 0)
+        // Remove the episode numbers, but only if it's not at the begining
+        // of the description (subtitle code might use it)
+        if(pos > 0)
+            event.description = event.description.replace(list[0],"");
+        isSeries = true;
+    }
+
+    // Add partnumber/parttotal to subtitle
+    // This will be overwritten if we find a better subtitle
+    if (event.partnumber > 0)
+    {
+        event.subtitle = QString("Del %1").arg(event.partnumber);
+        if (event.parttotal > 0)
         {
-            bool ok;
-            uint y = list[3].stripWhiteSpace().toUInt(&ok);
-            if (ok)
-                event.originalairdate = QDate(y, 1, 1);
+            event.subtitle += QString(" av %1").arg(event.parttotal);
         }
+    }
 
-        // not 100% sure about this one.
-        event.subtitle = "";
+    // Move subtitle info from title to subtitle
+    QRegExp tmpTSub = m_comHemTSub;
+    if (tmpTSub.search(event.title) != -1)
+    {
+        event.subtitle = tmpTSub.cap(1);
+        event.title = event.title.replace(tmpTSub.cap(0),"");
     }
 
+    // No need to continue without a description.
     if (event.description.length() <= 0)
         return;
 
-    // everything up to the first 3 spaces is duplicated from title and
-    // subtitle so remove it
-    pos = event.description.find("   ");
+    // Try to find country category, year and possibly other information
+    // from the begining of the description
+    QRegExp tmpCountry = m_comHemCountry;
+    pos = tmpCountry.search(event.description);
     if (pos != -1)
     {
-        event.description =
-            event.description.mid(pos + 3).stripWhiteSpace();
-        //fprintf(stdout, "EITFixUp::FixStyle4: New: %s\n",
-        //event.description.mid(pos + 3).stripWhiteSpace().ascii());
-    }
+        QStringList list = tmpCountry.capturedTexts();
+        QString replacement;
 
-    // in the description at this point everything up to the first 4 spaces
-    // in a row is a list of director(s) and actors.
-    // different lists are separated by 3 spaces in a row
-    // end of all lists is when there is 4 spaces in a row
-    bool bDontRemove = false;
-    pos = event.description.find("    ");
-    if (pos != -1)
-    {
-        QStringList lists;
-        lists = QStringList::split("   ", event.description.left(pos));
-        QStringList::iterator it;
-        for (it = lists.begin(); it != lists.end(); it++)
+        // Original title, usually english title
+        // note: list[1] contains extra () around the text that needs removing
+        if (list[1].length() > 0)
         {
-            (*it).remove(m_comHemPEnd);
-            QStringList list = QStringList::split(": ", *it);
-            if (list.count() != 2)
+            replacement = list[1] + " ";
+            //store it somewhere?
+        }
+
+        // Countr(y|ies)
+        if (list[2].length() > 0)
+        {
+            replacement += list[2] + " ";
+            //store it somewhere?
+        }
+
+        // Category
+        if (list[3].length() > 0)
+        {
+            replacement += list[3] + ".";
+            if(event.category.isEmpty())
             {
-                // oops, improperly formated list, ignore it
-                //fprintf(stdout,"EITFixUp::FixStyle4:"
-                //"%s is not a properly formated list of persons\n",
-                //(*it).ascii());
-                bDontRemove = true;
-                continue;
+                event.category = list[3];
             }
 
-            if (list[0].find(m_comHemDirector) != -1)
+            if(list[3].find("serie")!=-1)
             {
-                // director(s)
-                QStringList persons = QStringList::split(", ",list[1]);
-                for (QStringList::const_iterator it2 = persons.begin();
-                     it2 != persons.end(); it2++)
-                {
-                    event.AddPerson(DBPerson::kDirector, *it2);
-                }
-                continue;
+                isSeries = true;
             }
+        }
 
-            if (list[0].find(m_comHemActor) != -1)
+        // Year
+        if (list[4].length() > 0)
+        {
+            event.airdate = list[4].stripWhiteSpace();
+        }
+
+        // Actors
+        if (list[5].length() > 0)
+        {
+            QStringList actors;
+            actors=QStringList::split(m_comHemPersSeparator,list[5]);
+            for(QStringList::size_type i=0;i<actors.count();i++)
             {
-                // actor(s)
-                QStringList persons = QStringList::split(", ", list[1]);
-                for (QStringList::const_iterator it2 = persons.begin();
-                     it2 != persons.end(); it2++)
-                {
-                    event.AddPerson(DBPerson::kActor, *it2);
-                }
-                continue;
+                event.AddPerson(DBPerson::kActor, actors[i]);
             }
+        }
 
-            // unknown type, posibly a new one that
-            // this code shoud be updated to handle
-            VERBOSE(VB_EIT, "EITFixUp::FixComHem: " +
-                    QString("%1 is not actor or director")
-                    .arg(list[0]));
-            bDontRemove = true;
+        // Remove year and actors.
+        // The reason category is left in the description is because otherwise
+        // the country would look wierd like "Amerikansk. Rest of description."
+        event.description = event.description.replace(list[0],replacement);
+    }
+
+    if (isSeries)
+        event.category_type = kCategorySeries;
+
+    // Look for additional persons in the description
+    QRegExp tmpPersons = m_comHemPersons;
+    while(pos = tmpPersons.search(event.description),pos!=-1)
+    {
+        DBPerson::Role role;
+        QStringList list = tmpPersons.capturedTexts();
+        
+        QRegExp tmpDirector = m_comHemDirector;
+        QRegExp tmpActor = m_comHemActor;
+        QRegExp tmpHost = m_comHemHost;
+        if (tmpDirector.search(list[1])!=-1)
+        {
+            role = DBPerson::kDirector;
         }
-        // remove list of persons from description if
-        // we coud parse it properly
-        if (!bDontRemove)
+        else if(tmpActor.search(list[1])!=-1)
         {
-            event.description = event.description.mid(pos).stripWhiteSpace();
+            role = DBPerson::kActor;
         }
-    }
+        else if(tmpHost.search(list[1])!=-1)
+        {
+            role = DBPerson::kHost;
+        }
 
-    //fprintf(stdout, "EITFixUp::FixStyle4: Number of persons: %d\n",
-    //event.Credits.count());
+        QStringList actors;
+        actors = QStringList::split(m_comHemPersSeparator, list[2]);
+        for(QStringList::size_type i=0;i<actors.count();i++)
+        {
+            event.AddPerson(role, actors[i]);
+        }
 
-    /*
-      a regexp like this coud be used to get the episode number, shoud be at
-      the begining of the description
-      "^(?:[dD]el|[eE]pisode)\\s([0-9]+)(?:\\s?(?:/|:|av)\\s?([0-9]+))?\\."
-    */
+        // Remove it
+        event.description=event.description.replace(list[0],"");
+    }
 
     // Is this event on a channel we shoud look for a subtitle?
+    // The subtitle is the first sentence in the description, but the
+    // subtitle can't be the only thing in the description and it must be
+    // shorter than 55 characters or we risk picking up the wrong thing.
     if (process_subtitle)
     {
         int pos = event.description.find(m_comHemSub);
@@ -508,11 +555,19 @@
         }
     }
 
+    // Teletext subtitles?
+    int position = event.description.find(m_comHemTT);
+    if (position != -1)
+    {
+        event.flags |= DBEvent::kSubtitled;
+    }
+
     // Try to findout if this is a rerun and if so the date.
     QRegExp tmpRerun1 = m_comHemRerun1;
     if (tmpRerun1.search(event.description) == -1)
         return;
 
+    // Rerun from today
     QStringList list = tmpRerun1.capturedTexts();
     if (list[1] == "i dag")
     {
@@ -520,12 +575,14 @@
         return;
     }
 
+    // Rerun from yesterday afternoon
     if (list[1] == "eftermiddagen")
     {
         event.originalairdate = event.starttime.date().addDays(-1);
         return;
     }
 
+    // Rerun with day, month and possibly year specified
     QRegExp tmpRerun2 = m_comHemRerun2;
     if (tmpRerun2.search(list[1]) != -1)
     {
@@ -546,16 +603,9 @@
             if (date > event.starttime.date())
                 date = date.addYears(-1);
             event.originalairdate = date;
-            //fprintf(stdout, "EITFixUp::FixStyle4: "
-            //"OriginalAirDate set to: %s for '%s'\n",
-            //event.OriginalAirDate.toString(Qt::ISODate).ascii(),
-            //event.description.ascii());
         }
         return;
     }
-    // unknown date, posibly only a year.
-    //fprintf(stdout,"EITFixUp::FixStyle4: "
-    //"unknown rerun date: %s\n",list[1].ascii());
 }
 
 /** \fn EITFixUp::FixAUStar(DBEvent&) const
Index: libs/libmythtv/eithelper.cpp
===================================================================
--- libs/libmythtv/eithelper.cpp	(revision 10051)
+++ libs/libmythtv/eithelper.cpp	(working copy)
@@ -201,10 +201,10 @@
 void EITHelper::AddEIT(const DVBEventInformationTable *eit)
 {
     uint descCompression = (eit->TableID() > 0x80) ? 2 : 1;
-    uint fix = fixup[eit->OriginalNetworkID() << 16];
+    uint fix = fixup[(int)eit->OriginalNetworkID() << 16];
     fix |= fixup[(((uint64_t)eit->TSID()) << 32) |
                  (eit->OriginalNetworkID() << 16)];
-    fix |= fixup[(eit->OriginalNetworkID() << 16) | eit->ServiceID()];
+    fix |= fixup[(((int)eit->OriginalNetworkID()) << 16) | ((int)eit->ServiceID())];
     fix |= EITFixUp::kFixGenericDVB;
 
     uint networkid = eit->OriginalNetworkID();
@@ -452,7 +452,7 @@
     {
         // Check to see if we are interseted in this channel
         bool useOnAirGuide = query.value(1).toBool();
-        return (useOnAirGuide) ? query.value(0).toInt() : -1;        
+        return (useOnAirGuide) ? query.value(0).toInt() : -1;
     }
 
     return -1;
Index: libs/libmythtv/eitfixup.h
===================================================================
--- libs/libmythtv/eitfixup.h	(revision 10051)
+++ libs/libmythtv/eitfixup.h	(working copy)
@@ -67,12 +67,19 @@
     const QRegExp m_ukCC;
     const QRegExp m_ukYear;
     const QRegExp m_comHemCountry;
-    const QRegExp m_comHemPEnd;
     const QRegExp m_comHemDirector;
     const QRegExp m_comHemActor;
+    const QRegExp m_comHemHost;
     const QRegExp m_comHemSub;
     const QRegExp m_comHemRerun1;
     const QRegExp m_comHemRerun2;
+    const QRegExp m_comHemTT;
+    const QRegExp m_comHemPersSeparator;
+    const QRegExp m_comHemPersons;
+    const QRegExp m_comHemSubEnd;
+    const QRegExp m_comHemSeries1;
+    const QRegExp m_comHemSeries2;
+    const QRegExp m_comHemTSub;
 };
 
 #endif // EITFIXUP_H
