Ticket #2417: eitfixup-kabeldeutschland.2.diff

File eitfixup-kabeldeutschland.2.diff, 11.3 KB (added by Wolfgang <mythtv@…>, 4 years ago)

Attached new patch against trunk 15495

  • libs/libmythtv/eitfixup.cpp

     
    8686      m_dePremiereInfos("([^.]+)?\\s?([0-9]{4})\\.\\s[0-9]+\\sMin\\.(?:\\sVon" 
    8787                        "\\s([^,]+)(?:,|\\su\\.\\sa\\.)\\smit\\s(.+)\\.)?"), 
    8888      m_dePremiereOTitle("\\s*\\(([^\\)]*)\\)$"), 
     89      m_kdEpisode("[\\(]{1}[0-9]+[\\)]{1}"), 
     90      m_kdPartTotal("([0-9]+)\\s(?:Episoden|Folgen|Teile)"), 
     91      m_kdPartNumber("(?:Episode|Folge|Teil)\\s([0-9]+)"), 
     92      m_kdInfos("^([^;]+)\\*"), 
     93      m_kdOTitle("^(\\([^\\)]+\\))"), 
     94      m_kdSubtitle("^([^\\(\\)]+)"), 
     95      m_kdActors("(?:Mit|G[aä]st[e]?:)\\s(.+\\w+)\\s"), 
     96      m_kdDirector("R:\\s(.+)\\s"), 
     97      m_kdHost("(?:Moderation:|Presented by)\\s(.+)\\s"), 
     98      m_kdCategory("^([\\w-]+\\s?\\w*)(?: nach| mit| frei nach| von|$)"), 
     99      m_kdCatCountryYear("([\\w-]+\\s?\\w*)(?:(?: nach| mit| frei nach| von)[^,]+)?,\\s([A-Z/]+)(?:\\s([0-9-/]{4,}))?(?:,\\s[0-9]+\\sMinuten,?)?(?:,|\\s\\*|$|\\s)"), 
    89100      m_nlStereo("stereo"), 
    90101      m_nlTxt("txt"), 
    91102      m_nlWide("breedbeeld"), 
     
    148159 
    149160    if (kFixPremiere & event.fixup) 
    150161        FixPremiere(event); 
     162 
     163    if (kFixKD & event.fixup) 
     164        FixKD(event); 
    151165         
    152166    if (kFixNL & event.fixup) 
    153167        FixNL(event); 
     
    10801094    } 
    10811095} 
    10821096 
     1097 
     1098/** \fn EITFixUp::FixKD(DBEvent&) const 
     1099 *  \brief Use this to standardize DVB-C guide in Germany 
     1100 *         for the provider Kabel Deutschland. 
     1101 */ 
     1102void EITFixUp::FixKD(DBEvent &event) const 
     1103{ 
     1104    QString country = ""; 
     1105    QString possible_subtitle = ""; 
     1106    QString replacement = ""; 
     1107    // Episodes 
     1108    QRegExp tmpPartTotal = m_kdPartTotal; 
     1109    if (tmpPartTotal.search(event.description)!= -1) 
     1110    { 
     1111        QStringList parttotal = tmpPartTotal.capturedTexts(); 
     1112        event.parttotal = parttotal[1].toUInt(); 
     1113    } 
     1114    // Episode Number 
     1115    QRegExp tmpPartNumber = m_kdPartNumber; 
     1116    if (tmpPartNumber.search(event.description)!= -1) 
     1117    { 
     1118        QStringList partnumber = tmpPartNumber.capturedTexts(); 
     1119        event.partnumber = partnumber[1].toUInt(); 
     1120    } 
     1121    // Find infos about Category, Country and Year (Kabel Deutschland) 
     1122    QRegExp tmpCatCountryYear = m_kdCatCountryYear; 
     1123    if ((tmpCatCountryYear.search(event.subtitle)!= -1)||(tmpCatCountryYear.search(event.description)!= -1)) 
     1124    { 
     1125        QStringList catcountryyear = tmpCatCountryYear.capturedTexts(); 
     1126        if (event.category.isEmpty()) 
     1127            event.category = catcountryyear[1]; 
     1128        if (catcountryyear[2].length()>0) 
     1129            country = catcountryyear[2]; 
     1130        if (catcountryyear[3].length()>0) 
     1131            event.airdate  = catcountryyear[3]; 
     1132        event.subtitle = event.subtitle.replace(catcountryyear[0],""); 
     1133        event.description = event.description.replace(catcountryyear[0],""); 
     1134    } 
     1135     
     1136    // Find extra infos (category, credits, subtitle, original title) 
     1137    QRegExp tmpInfos = m_kdInfos; 
     1138    if (tmpInfos.search(event.description)!=-1) 
     1139    { 
     1140        QStringList list = tmpInfos.capturedTexts(); 
     1141        QStringList infos; 
     1142        infos = QStringList::split("*", list[1]); 
     1143         
     1144        QRegExp tmpDirector = m_kdDirector; 
     1145        QRegExp tmpHost     = m_kdHost; 
     1146        QRegExp tmpActor    = m_kdActors; 
     1147        QRegExp tmpOTitle   = m_kdOTitle; 
     1148        QRegExp tmpCategory = m_kdCategory; 
     1149        QRegExp tmpSubtitle = m_kdSubtitle; 
     1150          
     1151        for(QStringList::size_type i=0;i<infos.count();i++) 
     1152        { 
     1153            if (tmpDirector.search(infos[i])!=-1) 
     1154            { 
     1155                QStringList director = tmpDirector.capturedTexts(); 
     1156                event.AddPerson(DBPerson::kDirector, director[1]); 
     1157                event.description = event.description.replace(infos[i]+"*",""); 
     1158            }  
     1159            else if (tmpHost.search(infos[i])!=-1) 
     1160            { 
     1161                QStringList host = tmpHost.capturedTexts(); 
     1162                event.AddPerson(DBPerson::kHost, host[1]); 
     1163                event.description = event.description.replace(infos[i]+"*",""); 
     1164            }  
     1165            else if (tmpActor.search(infos[i])!=-1) 
     1166            { 
     1167                QStringList actorlist = tmpActor.capturedTexts(); 
     1168                QStringList actors = QStringList::split(", ", actorlist[1]); 
     1169                for(QStringList::size_type j=0;j<actors.count();j++) 
     1170                    event.AddPerson(DBPerson::kActor, actors[j]); 
     1171                event.description = event.description.replace(infos[i]+"*",""); 
     1172            }  
     1173            else if (tmpOTitle.search(infos[i])!=-1) 
     1174            { 
     1175                QStringList origtitle = tmpOTitle.capturedTexts(); 
     1176                event.title += " " + origtitle[1]; 
     1177                event.description = event.description.replace(infos[i]+"*",""); 
     1178            }  
     1179            else if (event.category.isEmpty() && (tmpCategory.search(infos[i])!=-1)) 
     1180            { 
     1181                QStringList category = tmpCategory.capturedTexts(); 
     1182                event.category = category[1]; 
     1183                event.description = event.description.replace(infos[i]+"*",""); 
     1184            } 
     1185            else if (tmpSubtitle.search(infos[i])!=-1) 
     1186            { 
     1187                possible_subtitle = tmpSubtitle.capturedTexts()[1]; 
     1188                replacement = infos[i]; 
     1189            } 
     1190        } 
     1191 
     1192    }  
     1193    if (event.category.isEmpty()&&!event.subtitle.isEmpty()) 
     1194    { 
     1195        QRegExp tmpCategory = m_kdCategory; 
     1196        if (tmpCategory.search(event.subtitle)!=-1) 
     1197        { 
     1198            event.category = event.subtitle; 
     1199            event.subtitle = ""; 
     1200        } 
     1201    } 
     1202    if (event.subtitle.isEmpty()&&!possible_subtitle.isEmpty()) 
     1203    { 
     1204            event.subtitle = possible_subtitle;  
     1205            event.description = event.description.replace(replacement+"*",""); 
     1206    } 
     1207 
     1208    // write found country at the description end    
     1209    if (!country.isEmpty())  
     1210      event.description += " " + country; 
     1211     
     1212    // Get Episode Number from event title 
     1213    int position = event.title.find(m_kdEpisode); 
     1214    if (position != -1) 
     1215    { 
     1216        event.partnumber = event.title.mid(position + 1, event.title.length() - position - 2).toUInt(); 
     1217        event.title = event.title.left(position); 
     1218    } 
     1219} 
     1220 
    10831221/** \fn EITFixUp::FixFI(DBEvent&) const 
    10841222 *  \brief Use this to clean DVB-T guide in Finland. 
    10851223 */ 
  • libs/libmythtv/eithelper.cpp

     
    758758    fix[ 8707LL << 32 | 8468 << 16 | 16413] = EITFixUp::kEFixForceISO8859_15; 
    759759 
    760760    // DVB-C Kabel Deutschland encoding fixes Germany 
    761     fix[   112LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
    762     fix[ 10000LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
    763     fix[ 10001LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
    764     fix[ 10002LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
    765     fix[ 10003LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
    766     fix[ 10006LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
    767     fix[ 10009LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15; 
     761    fix[   112LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
     762    fix[ 10000LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
     763    fix[ 10001LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
     764    fix[ 10002LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
     765    fix[ 10003LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
     766    fix[ 10004LL << 32 | 61441U << 16] = EITFixUp::kFixKD; 
     767    fix[ 10005LL << 32 | 61441U << 16] = EITFixUp::kFixKD; 
     768    fix[ 10006LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
     769    fix[ 10007LL << 32 | 61441U << 16] = EITFixUp::kFixKD; 
     770    fix[ 10008LL << 32 | 61441U << 16] = EITFixUp::kFixKD; 
     771    fix[ 10009LL << 32 | 61441U << 16] = EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
    768772    // On transport 10004 only DMAX needs no fixing: 
    769773    fix[    10004LL<<32 | 61441U << 16 | 50403] = // BBC World Service 
    770774        fix[10004LL<<32 | 61441U << 16 | 53101] = // BBC Prime (engl) 
     
    783787        fix[10004LL<<32 | 61441U << 16 | 53513] = // Playhouse Disney (engl) 
    784788        fix[10004LL<<32 | 61441U << 16 | 53618] = // K1010 
    785789        fix[10004LL<<32 | 61441U << 16 | 53619] = // GemsTV 
    786         EITFixUp::kEFixForceISO8859_15; 
     790        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
    787791    // On transport 10005 QVC and Giga Digital  needs no fixing: 
    788792    fix[    10005LL<<32 | 61441U << 16 | 50104] = // E! Entertainment 
    789793        fix[10005LL<<32 | 61441U << 16 | 50107] = // 13th Street (KD) 
     
    802806        fix[10005LL<<32 | 61441U << 16 | 53516] = // Voyages Television 
    803807        fix[10005LL<<32 | 61441U << 16 | 53611] = // Der Schmuckkanal 
    804808        fix[10005LL<<32 | 61441U << 16 | 53104] = // Jukebox 
    805         EITFixUp::kEFixForceISO8859_15; 
     809        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
    806810    // On transport 10007 only following channels need fixing: 
    807811    fix[    10007LL<<32| 61441U << 16 | 53607] = // Eurosport 
    808812        fix[10007LL<<32| 61441U << 16 | 53608] = // Das Vierte 
    809813        fix[10007LL<<32| 61441U << 16 | 53609] = // Viva 
    810814        fix[10007LL<<32| 61441U << 16 | 53628] = // COMEDY CENTRAL 
    811         EITFixUp::kEFixForceISO8859_15; 
     815        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
    812816    // On transport 10008 only following channels need fixing: 
    813817    fix[    10008LL<<32 | 61441U << 16 | 53002] = // Tele 5 
    814818        fix[10008LL<<32 | 61441U << 16 | 53630] = // HSE24 
    815         EITFixUp::kEFixForceISO8859_15; 
     819        EITFixUp::kEFixForceISO8859_15 | EITFixUp::kFixKD; 
    816820 
    817821    // DVB-S Astra 19.2E DMAX Germany 
    818822    fix[  1113LL << 32 | 1 << 16 | 12602] = EITFixUp::kEFixForceISO8859_15; 
  • libs/libmythtv/eitfixup.h

     
    4343        // Early fixups 
    4444        kEFixForceISO8859_1  = 0x2000, 
    4545        kEFixForceISO8859_15 = 0x4000, 
     46 
     47        // Kabel Deutschland fixups 
     48        kFixKD          = 0x8000, 
    4649    }; 
    4750 
    4851    EITFixUp(); 
     
    6972    void FixRTL(DBEvent &event) const;        // RTL group DVB 
    7073    void FixFI(DBEvent &event) const;            // Finland DVB-T 
    7174    void FixPremiere(DBEvent &event) const;   // german pay-tv Premiere 
     75    void FixKD(DBEvent &event) const;       // german DVB-C 
    7276    void FixNL(DBEvent &event) const;            // Netherlands DVB-C 
    7377 
    7478    const QRegExp m_bellYear; 
     
    143147    const QRegExp m_Stereo; 
    144148    const QRegExp m_dePremiereInfos; 
    145149    const QRegExp m_dePremiereOTitle; 
     150    const QRegExp m_kdEpisode; 
     151    const QRegExp m_kdPartTotal; 
     152    const QRegExp m_kdPartNumber; 
     153    const QRegExp m_kdInfos; 
     154    const QRegExp m_kdStereo; 
     155    const QRegExp m_kdOTitle; 
     156    const QRegExp m_kdSubtitle; 
     157    const QRegExp m_kdActors; 
     158    const QRegExp m_kdDirector; 
     159    const QRegExp m_kdHost; 
     160    const QRegExp m_kdCategory; 
     161    const QRegExp m_kdCatCountryYear; 
    146162    const QRegExp m_nlStereo; 
    147163    const QRegExp m_nlTxt; 
    148164    const QRegExp m_nlWide;