Index: libs/libmythtv/eitfixup.cpp
===================================================================
--- libs/libmythtv/eitfixup.cpp	(revision 17014)
+++ libs/libmythtv/eitfixup.cpp	(working copy)
@@ -21,7 +21,7 @@
       m_ukNew("(New\\.|\\s*(Brand New|New)\\s*(Series|Episode)\\s*[:\\.\\-])",false),
       m_ukCEPQ("[:\\!\\.\\?]"),
       m_ukColonPeriod("[:\\.]"),
-      m_ukDotSpaceStart("^\\. "),
+      m_ukDotSpaceStart("^(?:\\. | )"),
       m_ukDotEnd("\\.$"),
       m_ukSpaceColonStart("^[ |:]*"),
       m_ukSpaceStart("^ "),
@@ -41,6 +41,7 @@
       m_ukYearColon("^[\\d]{4}:"),
       m_ukExclusionFromSubtitle("(starring|stars\\s|drama|series|sitcom)",false),
       m_ukCompleteDots("^\\.\\.+$"),
+      m_uk5xNumberHyphen3xNumber("\\d\\d\\d\\d\\d-\\d\\d\\d [A-Z]"),
       m_comHemCountry("^(\\(.+\\))?\\s?([^ ]+)\\s([^\\.0-9]+)"
                       "(?:\\sfrån\\s([0-9]{4}))(?:\\smed\\s([^\\.]+))?\\.?"),
       m_comHemDirector("[Rr]egi"),
@@ -300,6 +301,9 @@
  */
 void EITFixUp::SetUKSubtitle(DBEvent &event) const
 {
+    if (!event.subtitle.isEmpty())
+        return;
+
     QStringList strListColon = QStringList::split(":",event.description,TRUE);
     QStringList strListEnd;
 
@@ -325,7 +329,7 @@
              QString strTmp = event.description.mid(nPosition1+1,
                                      nLength-nPosition1);
 
-             if (QStringList::split(" ", strTmp ,TRUE).count()< kMaxDotToColon)
+             if (QStringList::split(" ", strTmp ,TRUE).count()<=kMaxDotToColon)
                  fSingleDot = false;
          }
 
@@ -336,30 +340,36 @@
          }
          else if (!fSingleDot)
          {
-             QStringList strListTmp;
-             uint nTitle=0;
-             int nTitleMax=-1;
+             int nCount=strListColon.count();
+             int nMaxLength=0; 
+             int nMaxTitle=0;
              int i;
-             for (i =0; (i<(int)strListColon.count()) && (nTitleMax==-1);i++)
+             for (i=0;i<(nCount-1);i++)
              {
-                 if ((nTitle+=
-                     QStringList::split(" ",strListColon[i],TRUE).count())
-                          <kMaxToTitle)
-                     strListTmp.push_back(strListColon[i]);
-                 else
-                     nTitleMax=i;
+                 QString strTmp = strListColon[i+1].stripWhiteSpace();
+                 QChar aLetter = strTmp.at(0);
+                 QChar bLetter = aLetter.lower();
+                 uint nTmp=
+                     QStringList::split(" ",strListColon[i],FALSE).count();
+                 if ((nMaxLength+nTmp > kMaxToTitle) || (aLetter==bLetter))
+                     break;
+                 nMaxLength = nMaxLength+nTmp;
+                 nMaxTitle = i;
              }
-             QString strPartial;
-             for (i=0;i<(nTitleMax-1);i++)
-                 strPartial+=strListTmp[i]+":";
-             if (nTitleMax>0)
+             if (nMaxLength)
              {
-                 strPartial+=strListTmp[nTitleMax-1];
+                 QString strPartial;
+                 for (i=0;i<=nMaxTitle;i++)
+                 {
+                     strPartial+=strListColon[i];
+                     if (i<(nMaxTitle))
+                          strPartial+=":";
+                 }
                  strListEnd.push_back(strPartial);
-             }
-             for (i=nTitleMax+1;i<(int)strListColon.count();i++)
-                 strListEnd.push_back(strListColon[i]);
-             fColon = true;
+                 for (i=(nMaxTitle+1);i<nCount;i++)
+                     strListEnd.push_back(strListColon[i]);
+                 fColon=true;
+             }             
          }
     }
     QStringList strListPeriod;
@@ -367,25 +377,32 @@
     QStringList strListExcl;
     if (!fColon)
     {
+        int nLength=INT_MAX;
         strListPeriod = QStringList::split(".",event.description,TRUE);
+        strListQuestion = QStringList::split("?",event.description,TRUE);
+        strListExcl = QStringList::split("!",event.description,TRUE);
+
         if (strListPeriod.count() >1)
         {
             nPosition1 = event.description.find(".");
             int nPosition2 = event.description.find("..");
             if ((nPosition1 < nPosition2) || (nPosition2==-1))
+            {
+                nLength = strListPeriod[0].length();  
                 strListEnd = strListPeriod;
+            }
         }
 
-        strListQuestion = QStringList::split("?",event.description,TRUE);
-        strListExcl = QStringList::split("!",event.description,TRUE);
         if ((strListQuestion.count()>1) &&
-                 (strListQuestion.count()<=kMaxQuestionExclamation))
+                 (strListQuestion.count()<=kMaxQuestionExclamation) &&
+                 ((int)(strListQuestion[0].length())<nLength))
         {
             strListEnd = strListQuestion;
             strEnd = "?";
         }
         else if ((strListExcl.count()>1) &&
-                 (strListExcl.count()<=kMaxQuestionExclamation))
+                 (strListExcl.count()<=kMaxQuestionExclamation) &&
+                 ((int)(strListExcl[0].length())<nLength))
         {
             strListEnd = strListExcl;
             strEnd = "!";
@@ -397,10 +414,9 @@
     if (strListEnd.count())
     {
         QStringList strListSpace = QStringList::split(" ",strListEnd[0]);
-        if (fColon && (strListSpace.count() > kMaxToTitle))
+        if (strListSpace.count() > kMaxToTitle)
              return;
-        if (strListSpace.count() > kDotToTitle)
-             return;
+
         if (strListSpace.grep(m_ukExclusionFromSubtitle).count()==0)
         {
              event.subtitle = strListEnd[0]+strEnd;
@@ -492,7 +508,9 @@
     }
 
     QRegExp tmp24ep = m_uk24ep;
-    if (!event.title.startsWith("CSI:") && !event.title.startsWith("CD:"))
+    if (!event.title.startsWith("CSI:") && 
+        !event.title.startsWith("Law & Order:") && 
+        !event.title.startsWith("CD:"))
     {
         if (((position1=event.title.find(m_ukDoubleDotEnd)) != -1) &&
             ((position2=event.description.find(m_ukDoubleDotStart)) != -1))
@@ -580,6 +598,15 @@
         }
         else
             SetUKSubtitle(event);
+/*
+        if (event.subtitle.isEmpty() && 
+            (position1=event.description.find(m_uk5xNumberHyphen3xNumber)) &&
+            (position1 >0) && ((uint)position1<SUBTITLE_MAX_LEN))
+        {
+            event.subtitle = event.description.left(position1+9); 
+            event.description = event.description.mid(position1+9); 
+        }
+*/
     }
 
     // Work out the year (if any)
@@ -597,10 +624,19 @@
     }
 
     // Trim leading/trailing '.'
+    event.description.remove(m_ukDotSpaceStart);
     event.subtitle.remove(m_ukDotSpaceStart);
     if (event.subtitle.findRev("..") != (((int)event.subtitle.length())-2))
         event.subtitle.remove(m_ukDotEnd);
 
+    // Demote the subtitle if it matches the title
+    if (!event.title.isEmpty() && !event.subtitle.isEmpty() &&
+         event.title == event.subtitle)
+    {
+        event.description=event.subtitle+" "+event.description;
+        event.subtitle=QString::null;
+    }
+
     // Reverse the subtitle and empty description
     if (event.description.isEmpty() && !event.subtitle.isEmpty())
     {
Index: libs/libmythtv/eitfixup.h
===================================================================
--- libs/libmythtv/eitfixup.h	(revision 17014)
+++ libs/libmythtv/eitfixup.h	(working copy)
@@ -18,13 +18,11 @@
      // max length of subtitle field in db.
      static const uint SUBTITLE_MAX_LEN = 128;
      // max number of words included in a subtitle
-     static const uint kMaxToTitle = 14;
-     // max number of words up to a period, question mark
-     static const uint kDotToTitle = 9;
+     static const uint kMaxToTitle = 10;
      // max number of question/exclamation marks
      static const uint kMaxQuestionExclamation = 2;
      // max number of difference in words between a period and a colon
-     static const uint kMaxDotToColon = 5;
+     static const uint kMaxDotToColon = 6;
 
   public:
     enum FixUpType
@@ -108,6 +106,7 @@
     const QRegExp m_ukYearColon;
     const QRegExp m_ukExclusionFromSubtitle;
     const QRegExp m_ukCompleteDots;
+    const QRegExp m_uk5xNumberHyphen3xNumber;
     const QRegExp m_comHemCountry;
     const QRegExp m_comHemDirector;
     const QRegExp m_comHemActor;
