Index: libs/libmythtv/eitfixup.cpp
===================================================================
--- libs/libmythtv/eitfixup.cpp	(Revision 15495)
+++ libs/libmythtv/eitfixup.cpp	(Arbeitskopie)
@@ -86,6 +86,17 @@
       m_dePremiereInfos("([^.]+)?\\s?([0-9]{4})\\.\\s[0-9]+\\sMin\\.(?:\\sVon"
                         "\\s([^,]+)(?:,|\\su\\.\\sa\\.)\\smit\\s(.+)\\.)?"),
       m_dePremiereOTitle("\\s*\\(([^\\)]*)\\)$"),
+      m_kdEpisode("[\\(]{1}[0-9]+[\\)]{1}"),
+      m_kdPartTotal("([0-9]+)\\s(?:Episoden|Folgen|Teile)"),
+      m_kdPartNumber("(?:Episode|Folge|Teil)\\s([0-9]+)"),
+      m_kdInfos("^([^;]+)\\*"),
+      m_kdOTitle("^(\\([^\\)]+\\))"),
+      m_kdSubtitle("^([^\\(\\)]+)"),
+      m_kdActors("(?:Mit|G[aä]st[e]?:)\\s(.+\\w+)\\s"),
+      m_kdDirector("R:\\s(.+)\\s"),
+      m_kdHost("(?:Moderation:|Presented by)\\s(.+)\\s"),
+      m_kdCategory("^([\\w-]+\\s?\\w*)(?: nach| mit| frei nach| von|$)"),
+      m_kdCatCountryYear("([\\w-]+\\s?\\w*)(?:(?: nach| mit| frei nach| von)[^,]+)?,\\s([A-Z/]+)(?:\\s([0-9-/]{4,}))?(?:,\\s[0-9]+\\sMinuten,?)?(?:,|\\s\\*|$|\\s)"),
       m_nlStereo("stereo"),
       m_nlTxt("txt"),
       m_nlWide("breedbeeld"),
@@ -148,6 +159,9 @@
 
     if (kFixPremiere & event.fixup)
         FixPremiere(event);
+
+    if (kFixKD & event.fixup)
+        FixKD(event);
         
     if (kFixNL & event.fixup)
         FixNL(event);
@@ -1080,6 +1094,130 @@
     }
 }
 
+
+/** \fn EITFixUp::FixKD(DBEvent&) const
+ *  \brief Use this to standardize DVB-C guide in Germany
+ *         for the provider Kabel Deutschland.
+ */
+void EITFixUp::FixKD(DBEvent &event) const
+{
+    QString country = "";
+    QString possible_subtitle = "";
+    QString replacement = "";
+    // Episodes
+    QRegExp tmpPartTotal = m_kdPartTotal;
+    if (tmpPartTotal.search(event.description)!= -1)
+    {
+        QStringList parttotal = tmpPartTotal.capturedTexts();
+        event.parttotal = parttotal[1].toUInt();
+    }
+    // Episode Number
+    QRegExp tmpPartNumber = m_kdPartNumber;
+    if (tmpPartNumber.search(event.description)!= -1)
+    {
+        QStringList partnumber = tmpPartNumber.capturedTexts();
+        event.partnumber = partnumber[1].toUInt();
+    }
+    // Find infos about Category, Country and Year (Kabel Deutschland)
+    QRegExp tmpCatCountryYear = m_kdCatCountryYear;
+    if ((tmpCatCountryYear.search(event.subtitle)!= -1)||(tmpCatCountryYear.search(event.description)!= -1))
+    {
+        QStringList catcountryyear = tmpCatCountryYear.capturedTexts();
+        if (event.category.isEmpty())
+            event.category = catcountryyear[1];
+        if (catcountryyear[2].length()>0)
+            country = catcountryyear[2];
+        if (catcountryyear[3].length()>0)
+            event.airdate  = catcountryyear[3];
+        event.subtitle = event.subtitle.replace(catcountryyear[0],"");
+        event.description = event.description.replace(catcountryyear[0],"");
+    }
+    
+    // Find extra infos (category, credits, subtitle, original title)
+    QRegExp tmpInfos = m_kdInfos;
+    if (tmpInfos.search(event.description)!=-1)
+    {
+        QStringList list = tmpInfos.capturedTexts();
+        QStringList infos;
+        infos = QStringList::split("*", list[1]);
+        
+        QRegExp tmpDirector = m_kdDirector;
+        QRegExp tmpHost     = m_kdHost;
+        QRegExp tmpActor    = m_kdActors;
+        QRegExp tmpOTitle   = m_kdOTitle;
+        QRegExp tmpCategory = m_kdCategory;
+        QRegExp tmpSubtitle = m_kdSubtitle;
+         
+        for(QStringList::size_type i=0;i<infos.count();i++)
+        {
+            if (tmpDirector.search(infos[i])!=-1)
+            {
+                QStringList director = tmpDirector.capturedTexts();
+                event.AddPerson(DBPerson::kDirector, director[1]);
+                event.description = event.description.replace(infos[i]+"*","");
+            } 
+            else if (tmpHost.search(infos[i])!=-1)
+            {
+                QStringList host = tmpHost.capturedTexts();
+                event.AddPerson(DBPerson::kHost, host[1]);
+                event.description = event.description.replace(infos[i]+"*","");
+            } 
+            else if (tmpActor.search(infos[i])!=-1)
+            {
+                QStringList actorlist = tmpActor.capturedTexts();
+                QStringList actors = QStringList::split(", ", actorlist[1]);
+                for(QStringList::size_type j=0;j<actors.count();j++)
+                    event.AddPerson(DBPerson::kActor, actors[j]);
+                event.description = event.description.replace(infos[i]+"*","");
+            } 
+            else if (tmpOTitle.search(infos[i])!=-1)
+            {
+                QStringList origtitle = tmpOTitle.capturedTexts();
+                event.title += " " + origtitle[1];
+                event.description = event.description.replace(infos[i]+"*","");
+            } 
+            else if (event.category.isEmpty() && (tmpCategory.search(infos[i])!=-1))
+            {
+                QStringList category = tmpCategory.capturedTexts();
+                event.category = category[1];
+                event.description = event.description.replace(infos[i]+"*","");
+            }
+            else if (tmpSubtitle.search(infos[i])!=-1)
+            {
+                possible_subtitle = tmpSubtitle.capturedTexts()[1];
+                replacement = infos[i];
+            }
+        }
+
+    } 
+    if (event.category.isEmpty()&&!event.subtitle.isEmpty())
+    {
+        QRegExp tmpCategory = m_kdCategory;
+        if (tmpCategory.search(event.subtitle)!=-1)
+        {
+            event.category = event.subtitle;
+            event.subtitle = "";
+        }
+    }
+    if (event.subtitle.isEmpty()&&!possible_subtitle.isEmpty())
+    {
+            event.subtitle = possible_subtitle; 
+            event.description = event.description.replace(replacement+"*","");
+    }
+
+    // write found country at the description end   
+    if (!country.isEmpty()) 
+      event.description += " " + country;
+    
+    // Get Episode Number from event title
+    int position = event.title.find(m_kdEpisode);
+    if (position != -1)
+    {
+        event.partnumber = event.title.mid(position + 1, event.title.length() - position - 2).toUInt();
+        event.title = event.title.left(position);
+    }
+}
+
 /** \fn EITFixUp::FixFI(DBEvent&) const
  *  \brief Use this to clean DVB-T guide in Finland.
  */
Index: libs/libmythtv/eithelper.cpp
===================================================================
--- libs/libmythtv/eithelper.cpp	(Revision 15495)
+++ libs/libmythtv/eithelper.cpp	(Arbeitskopie)
@@ -758,13 +758,17 @@
     fix[ 8707LL << 32 | 8468 << 16 | 16413] = EITFixUp::kEFixForceISO8859_15;
 
     // DVB-C Kabel Deutschland encoding fixes Germany
-    fix[   112LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
-    fix[ 10000LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
-    fix[ 10001LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
-    fix[ 10002LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
-    fix[ 10003LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
-    fix[ 10006LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
-    fix[ 10009LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15;
+    fix[   112LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
+    fix[ 10000LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
+    fix[ 10001LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
+    fix[ 10002LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
+    fix[ 10003LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
+    fix[ 10004LL << 32 | 61441U << 16] = EITFixUp::kFixKD;
+    fix[ 10005LL << 32 | 61441U << 16] = EITFixUp::kFixKD;
+    fix[ 10006LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
+    fix[ 10007LL << 32 | 61441U << 16] = EITFixUp::kFixKD;
+    fix[ 10008LL << 32 | 61441U << 16] = EITFixUp::kFixKD;
+    fix[ 10009LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
     // On transport 10004 only DMAX needs no fixing:
     fix[    10004LL<<32 | 61441U << 16 | 50403] = // BBC World Service
         fix[10004LL<<32 | 61441U << 16 | 53101] = // BBC Prime (engl)
@@ -783,7 +787,7 @@
         fix[10004LL<<32 | 61441U << 16 | 53513] = // Playhouse Disney (engl)
         fix[10004LL<<32 | 61441U << 16 | 53618] = // K1010
         fix[10004LL<<32 | 61441U << 16 | 53619] = // GemsTV
-        EITFixUp::kEFixForceISO8859_15;
+        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
     // On transport 10005 QVC and Giga Digital  needs no fixing:
     fix[    10005LL<<32 | 61441U << 16 | 50104] = // E! Entertainment
         fix[10005LL<<32 | 61441U << 16 | 50107] = // 13th Street (KD)
@@ -802,17 +806,17 @@
         fix[10005LL<<32 | 61441U << 16 | 53516] = // Voyages Television
         fix[10005LL<<32 | 61441U << 16 | 53611] = // Der Schmuckkanal
         fix[10005LL<<32 | 61441U << 16 | 53104] = // Jukebox
-        EITFixUp::kEFixForceISO8859_15;
+        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
     // On transport 10007 only following channels need fixing:
     fix[    10007LL<<32| 61441U << 16 | 53607] = // Eurosport
         fix[10007LL<<32| 61441U << 16 | 53608] = // Das Vierte
         fix[10007LL<<32| 61441U << 16 | 53609] = // Viva
         fix[10007LL<<32| 61441U << 16 | 53628] = // COMEDY CENTRAL
-        EITFixUp::kEFixForceISO8859_15;
+        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
     // On transport 10008 only following channels need fixing:
     fix[    10008LL<<32 | 61441U << 16 | 53002] = // Tele 5
         fix[10008LL<<32 | 61441U << 16 | 53630] = // HSE24
-        EITFixUp::kEFixForceISO8859_15;
+        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD;
 
     // DVB-S Astra 19.2E DMAX Germany
     fix[  1113LL << 32 | 1 << 16 | 12602] = EITFixUp::kEFixForceISO8859_15;
Index: libs/libmythtv/eitfixup.h
===================================================================
--- libs/libmythtv/eitfixup.h	(Revision 15495)
+++ libs/libmythtv/eitfixup.h	(Arbeitskopie)
@@ -43,6 +43,9 @@
         // Early fixups
         kEFixForceISO8859_1  = 0x2000,
         kEFixForceISO8859_15 = 0x4000,
+
+        // Kabel Deutschland fixups
+        kFixKD          = 0x8000,
     };
 
     EITFixUp();
@@ -69,6 +72,7 @@
     void FixRTL(DBEvent &event) const;        // RTL group DVB
     void FixFI(DBEvent &event) const;            // Finland DVB-T
     void FixPremiere(DBEvent &event) const;   // german pay-tv Premiere
+    void FixKD(DBEvent &event) const;       // german DVB-C
     void FixNL(DBEvent &event) const;            // Netherlands DVB-C
 
     const QRegExp m_bellYear;
@@ -143,6 +147,18 @@
     const QRegExp m_Stereo;
     const QRegExp m_dePremiereInfos;
     const QRegExp m_dePremiereOTitle;
+    const QRegExp m_kdEpisode;
+    const QRegExp m_kdPartTotal;
+    const QRegExp m_kdPartNumber;
+    const QRegExp m_kdInfos;
+    const QRegExp m_kdStereo;
+    const QRegExp m_kdOTitle;
+    const QRegExp m_kdSubtitle;
+    const QRegExp m_kdActors;
+    const QRegExp m_kdDirector;
+    const QRegExp m_kdHost;
+    const QRegExp m_kdCategory;
+    const QRegExp m_kdCatCountryYear;
     const QRegExp m_nlStereo;
     const QRegExp m_nlTxt;
     const QRegExp m_nlWide;

