Ticket #2417: eitfixup-kabeldeutschland.diff

File eitfixup-kabeldeutschland.diff, 9.9 KB (added by mythtv@…, 19 years ago)
  • libs/libmythtv/eit.h

     
    130130    uint32_t      chanid;
    131131    uint16_t      partnumber;
    132132    uint16_t      parttotal;
    133     unsigned char fixup;
     133    uint16_t      fixup;
    134134    unsigned char flags;
    135135    unsigned char category_type;
    136136
  • libs/libmythtv/eitfixup.cpp

     
    3838      m_comHemSeries1("\\s?(?:[dD]el|[eE]pisode)\\s([0-9]+)"
    3939                      "(?:\\s?(?:/|:|av)\\s?([0-9]+))?\\."),
    4040      m_comHemSeries2("\\s?-?\\s?([Dd]el\\s+([0-9]+))"),
    41       m_comHemTSub("\\s+-\\s+([^\\-]+)")
     41      m_comHemTSub("\\s+-\\s+([^\\-]+)"),
     42      m_kdEpisode("[\\(]{1}[0-9]+[\\)]{1}"),
     43      m_kdPartTotal("([0-9]+)\\s(?:Episoden|Folgen|Teile)"),
     44      m_kdPartNumber("(?:Episode|Folge|Teil)\\s([0-9]+)"),
     45      m_kdInfos("^([^;]+)\\*"),
     46      m_kdOTitle("^(\\([^\\)]+\\))"),
     47      m_kdSubtitle("^([^\\(\\)]+)"),
     48      m_kdActors("(?:Mit|G[aä]st[e]?:)\\s(.+\\w+)\\s"),
     49      m_kdDirector("R:\\s(.+)\\s"),
     50      m_kdHost("(?:Moderation:|Presented by)\\s(.+)\\s"),
     51      m_kdCategory("^([\\w-]+\\s?\\w*)(?: nach| mit| frei nach| von|$)"),
     52      m_kdCatCountryYear("([\\w-]+\\s?\\w*)(?:(?: nach| mit| frei nach| von)[^,]+)?,\\s([A-Z/]+)(?:\\s([0-9-/]{4,}))?(?:,\\s[0-9]+\\sMinuten,?)?(?:,|\\s\\*|$|\\s)"),
     53      m_prInfos("([^.]+)?\\s?([0-9]{4})\\.\\s[0-9]+\\sMin\\.(?:\\sVon\\s([^,]+)(?:,|\\su\\.\\sa\\.)\\smit\\s(.+)\\.)?")
    4254{
    4355}
    4456
     
    7082
    7183    if (kFixAUStar & event.fixup)
    7284        FixAUStar(event);
     85   
     86    if (kEFixPro7Sat & event.fixup)
     87        FixPro7Sat(event);
    7388
    7489    if (event.fixup)
    7590    {
     
    630645        event.description    = stmp.right(stmp.length() - position - 2);
    631646    }
    632647}
     648
     649/** \fn EITFixUp::FixPro7Sat(DBEvent&) const
     650 *  \brief Use this to standardize DVB-C guide in Germany
     651 *         for the providers Kabel Deutschland and Premiere.
     652 */
     653void EITFixUp::FixPro7Sat(DBEvent &event) const
     654{
     655    QString country = "";
     656    QString possible_subtitle = "";
     657    QString replacement = "";
     658    // Episodes
     659    QRegExp tmpPartTotal = m_kdPartTotal;
     660    if (tmpPartTotal.search(event.description)!= -1)
     661    {
     662        QStringList parttotal = tmpPartTotal.capturedTexts();
     663        event.parttotal = parttotal[1].toUInt();
     664    }
     665    // Episode Number
     666    QRegExp tmpPartNumber = m_kdPartNumber;
     667    if (tmpPartNumber.search(event.description)!= -1)
     668    {
     669        QStringList partnumber = tmpPartNumber.capturedTexts();
     670        event.partnumber = partnumber[1].toUInt();
     671    }
     672    // Find infos about Category, Country and Year (Kabel Deutschland)
     673    QRegExp tmpCatCountryYear = m_kdCatCountryYear;
     674    if ((tmpCatCountryYear.search(event.subtitle)!= -1)||(tmpCatCountryYear.search(event.description)!= -1))
     675    {
     676        QStringList catcountryyear = tmpCatCountryYear.capturedTexts();
     677        if (event.category.isEmpty())
     678            event.category = catcountryyear[1];
     679        if (catcountryyear[2].length()>0)
     680            country = catcountryyear[2];
     681        if (catcountryyear[3].length()>0)
     682            event.airdate  = catcountryyear[3];
     683        event.subtitle = event.subtitle.replace(catcountryyear[0],"");
     684        event.description = event.description.replace(catcountryyear[0],"");
     685    }
     686   
     687    // Find infos about Country, Credits and Year (Premiere)
     688    QRegExp tmpInfos =  m_prInfos;
     689    if (tmpInfos.search(event.description)!=-1)
     690    {
     691        QStringList list = tmpInfos.capturedTexts();
     692        country = list[1];
     693        event.airdate = list[2];
     694        event.AddPerson(DBPerson::kDirector, list[3]);
     695        QStringList actors = QStringList::split(", ", list[4]);
     696        for(QStringList::size_type j=0;j<actors.count();j++)
     697            event.AddPerson(DBPerson::kActor, actors[j]);
     698        event.description = event.description.replace(list[0],"");
     699    }
     700
     701    // Find extra infos (category, credits, subtitle, original title)
     702    tmpInfos =  m_kdInfos;
     703    if (tmpInfos.search(event.description)!=-1)
     704    {
     705        QStringList list = tmpInfos.capturedTexts();
     706        QStringList infos;
     707        infos = QStringList::split("*", list[1]);
     708       
     709        QRegExp tmpDirector = m_kdDirector;
     710        QRegExp tmpHost     = m_kdHost;
     711        QRegExp tmpActor    = m_kdActors;
     712        QRegExp tmpOTitle   = m_kdOTitle;
     713        QRegExp tmpCategory = m_kdCategory;
     714        QRegExp tmpSubtitle = m_kdSubtitle;
     715         
     716        for(QStringList::size_type i=0;i<infos.count();i++)
     717        {
     718            if (tmpDirector.search(infos[i])!=-1)
     719            {
     720                QStringList director = tmpDirector.capturedTexts();
     721                event.AddPerson(DBPerson::kDirector, director[1]);
     722                event.description = event.description.replace(infos[i]+"*","");
     723            }
     724            else if (tmpHost.search(infos[i])!=-1)
     725            {
     726                QStringList host = tmpHost.capturedTexts();
     727                event.AddPerson(DBPerson::kHost, host[1]);
     728                event.description = event.description.replace(infos[i]+"*","");
     729            }
     730            else if (tmpActor.search(infos[i])!=-1)
     731            {
     732                QStringList actorlist = tmpActor.capturedTexts();
     733                QStringList actors = QStringList::split(", ", actorlist[1]);
     734                for(QStringList::size_type j=0;j<actors.count();j++)
     735                    event.AddPerson(DBPerson::kActor, actors[j]);
     736                event.description = event.description.replace(infos[i]+"*","");
     737            }
     738            else if (tmpOTitle.search(infos[i])!=-1)
     739            {
     740                QStringList origtitle = tmpOTitle.capturedTexts();
     741                event.title += " " + origtitle[1];
     742                event.description = event.description.replace(infos[i]+"*","");
     743            }
     744            else if (event.category.isEmpty() && (tmpCategory.search(infos[i])!=-1))
     745            {
     746                QStringList category = tmpCategory.capturedTexts();
     747                event.category = category[1];
     748                event.description = event.description.replace(infos[i]+"*","");
     749            }
     750            else if (tmpSubtitle.search(infos[i])!=-1)
     751            {
     752                possible_subtitle = tmpSubtitle.capturedTexts()[1];
     753                replacement = infos[i];
     754            }
     755        }
     756
     757    }
     758    if (event.category.isEmpty()&&!event.subtitle.isEmpty())
     759    {
     760        QRegExp tmpCategory = m_kdCategory;
     761        if (tmpCategory.search(event.subtitle)!=-1)
     762        {
     763            event.category = event.subtitle;
     764            event.subtitle = "";
     765        }
     766    }
     767    if (event.subtitle.isEmpty()&&!possible_subtitle.isEmpty())
     768    {
     769            event.subtitle = possible_subtitle;
     770            event.description = event.description.replace(replacement+"*","");
     771    }
     772
     773    // write found country at the description end   
     774    if (!country.isEmpty())
     775      event.description += " " + country;
     776   
     777
     778    // Get Episode Number from event title
     779    int position = event.title.find(m_kdEpisode);
     780    if (position != -1)
     781    {
     782        event.partnumber = event.title.mid(position + 1, event.title.length() - position - 2).toUInt();
     783        event.title = event.title.left(position);
     784    }
     785}
  • libs/libmythtv/eithelper.cpp

     
    518518    fix[ 769LL << 32 | 8468 << 16] = EITFixUp::kEFixPro7Sat; // DVB-T Berlin
    519519    fix[3075LL << 32 | 8468 << 16] = EITFixUp::kEFixPro7Sat; // DVB-T Bremen
    520520    fix[                133 << 16] = EITFixUp::kEFixPro7Sat; // Premiere and pro7/Sat.1
     521    fix[10000LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     522    fix[10001LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     523    fix[10002LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     524    fix[10003LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     525    fix[10004LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     526    fix[10005LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     527    fix[10006LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     528    fix[10008LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     529    fix[10009LL << 32 | 61441U << 16] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     530    fix[61441U << 16 | 53608U] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
     531    fix[61441U << 16 | 53605U] = EITFixUp::kEFixPro7Sat; // Kabeldeutschland
    521532}
    522533
    523534static int calc_eit_utc_offset(void)
  • libs/libmythtv/eitfixup.h

     
    5151    void FixPBS(DBEvent &event) const;           // USA ATSC
    5252    void FixComHem(DBEvent &event, bool parse_subtitle) const; // Sweden DVB-C
    5353    void FixAUStar(DBEvent &event) const;        // Australia DVB-S
     54    void FixPro7Sat(DBEvent &event) const;       // German DVB-C
    5455
    5556    const QRegExp m_bellYear;
    5657    const QRegExp m_bellActors;
     
    8081    const QRegExp m_comHemSeries1;
    8182    const QRegExp m_comHemSeries2;
    8283    const QRegExp m_comHemTSub;
     84    const QRegExp m_kdEpisode;
     85    const QRegExp m_kdPartTotal;
     86    const QRegExp m_kdPartNumber;
     87    const QRegExp m_kdInfos;
     88    const QRegExp m_kdStereo;
     89    const QRegExp m_kdOTitle;
     90    const QRegExp m_kdSubtitle;
     91    const QRegExp m_kdActors;
     92    const QRegExp m_kdDirector;
     93    const QRegExp m_kdHost;
     94    const QRegExp m_kdCategory;
     95    const QRegExp m_kdCatCountryYear;
     96    const QRegExp m_prInfos;
    8397};
    8498
    8599#endif // EITFIXUP_H