Ticket #4327: eitfixup8.patch

File eitfixup8.patch, 8.3 KB (added by John {at} Pullan {dot} org, 18 years ago)

Further updates

  • libs/libmythtv/eitfixup.cpp

     
    1717      m_bellPPVDescriptionEventId("\\([0-9]{5}\\)"),
    1818      m_ukSubtitle("\\[.*S\\]"),
    1919      m_ukThen("\\s*(Then|Followed by) 60 Seconds\\.", false),
    20       m_ukNew("\\s*(Brand New|New)\\s*Series\\s*[:\\.\\-]",false),
     20      m_ukNew("\\s*(Brand New|New)\\s*(Series|Episode)\\s*[:\\.\\-]",false),
    2121      m_ukNew1("^New\\."),
    2222      m_ukT4("^[tT]4:"),
    2323      m_ukEQ("[:\\!\\?]"),
     
    3434      m_uk24ep("^\\d{1,2}:00[ap]m to \\d{1,2}:00[ap]m: "),
    3535      m_ukStarring("(?:Western\\s)?[Ss]tarring ([\\w\\s\\-']+)[Aa]nd\\s([\\w\\s\\-']+)[\\.|,](?:\\s)*(\\d{4})?(?:\\.\\s)?"),
    3636      m_ukBBC7rpt("\\[Rptd?[^]]+\\d{1,2}\\.\\d{1,2}[ap]m\\]\\."),
    37       m_ukCBBC("^CBBC."),
    38       m_ukCBeebies("^CBeebies."),
    39       m_ukStarring1("star(ring)"),
     37      m_ukCBBC("^CBBC\\s*[\\.]"),
     38      m_ukCBeebies("^CBeebies\\s*[\\.]"),
     39      m_ukStarring1("star(ring|s)"),
    4040      m_ukDoubleDotEnd("\\.\\.+$"),
    4141      m_ukDoubleDotStart("^\\.\\.+"),
    4242      m_ukDotSpaceStart("^\\. "),
     43      m_ukTime("\\d{1,2}[\\.:]\\d{1,2}\\s*(am|pm|)"),
    4344      m_comHemCountry("^(\\(.+\\))?\\s?([^ ]+)\\s([^\\.0-9]+)"
    4445                      "(?:\\sfrån\\s([0-9]{4}))(?:\\smed\\s([^\\.]+))?\\.?"),
    4546      m_comHemDirector("[Rr]egi"),
     
    357358    event.description = event.description.remove(m_ukNew1);
    358359    event.title  = event.title.remove(m_ukT4);
    359360
     361    // Removal of CBBC and CBeebies
     362    event.description = event.description.remove(m_ukCBBC);
     363    event.description = event.description.remove(m_ukCBeebies);
     364
    360365    // BBC 7 [Rpt of ...] case.
    361366    event.description = event.description.remove(m_ukBBC7rpt);
    362367
     368    event.title = event.title.stripWhiteSpace();
     369    event.description = event.description.stripWhiteSpace();
     370
    363371    QRegExp tmp24ep = m_uk24ep;
    364372    if (!event.title.startsWith("CSI:") && !event.title.startsWith("CD:"))
    365373    {
     
    375383                     position1++;
    376384                 event.title = strFull.left(position1);
    377385                 event.description = strFull.mid(position1 + 1);
     386                 event.description = event.description.remove(m_ukNew1);
    378387                 SetUKSubtitle(event);
    379388            }
    380389            if ((position1 = strFull.find(m_ukYear)) != -1)
     
    385394                    event.description = event.title.mid(position1);
    386395                    event.title = event.title.left(position1);
    387396                }
    388             }
     397            } 
    389398        }
    390399        else if ((position1 = tmp24ep.search(event.description)) != -1)
    391400        {
     
    395404                                tmp24ep.cap(0).length() - 2);
    396405            event.description = event.description.remove(tmp24ep.cap(0));
    397406        }
    398         else if (((position1 = event.title.find(m_ukColonHyphen)) != -1) &&
    399             (event.description.find(":") < 0 ))
     407        else if ((position1 = event.description.find(m_ukTime)) == -1)
    400408        {
    401             if ((uint)position1 < SUBTITLE_MAX_LEN)
     409            if (((position1 = event.title.find(m_ukColonHyphen)) != -1) &&
     410                (event.description.find(":") < 0 ))
    402411            {
    403                 event.subtitle = event.title.mid(position1 + 1);
    404                 event.title = event.title.left(position1);
     412                if ((uint)position1 < SUBTITLE_MAX_LEN)
     413                {
     414                    event.subtitle = event.title.mid(position1 + 1);
     415                    event.title = event.title.left(position1);
     416                }
    405417            }
     418            else
     419                SetUKSubtitle(event);
    406420        }
    407         else
    408             SetUKSubtitle(event);
    409421    }
    410422
    411     if (event.subtitle.isEmpty())
     423    if ((event.description.find(m_ukTime) == -1) && (event.subtitle.isEmpty()))
    412424    {
    413425       QStringList strList1 = QStringList::split(".",event.description,TRUE);
    414426       QStringList strList2 = QStringList::split("?",event.description,TRUE);
     
    426438               QStringList strList3 = strList2.grep("Drama",false);
    427439               QStringList strList4 = strList2.grep("sitcom",false);
    428440               QStringList strList5 = strList2.grep(m_ukStarring1);
     441               QStringList strList6 = strList2.grep("Series",false);
    429442               if ((strList3.count()==0) && (strList4.count()==0) &&
    430                    (strList5.count()==0))
     443                   (strList5.count()==0) && (strList6.count()==0))
    431444               {
    432445                    event.subtitle = strList1[0]+strEnd;
    433446                    event.description=
     
    468481    QRegExp tmpExp3 = m_ukSeries3;
    469482    if ((position1 = tmpExp1.search(event.title)) != -1)
    470483    {
    471         event.partnumber = tmpExp1.cap(1).toUInt();
    472         event.parttotal  = tmpExp1.cap(2).toUInt();
    473         // Remove from the title
    474         event.title =
    475             event.title.mid(position1 + tmpExp1.cap(0).length());
    476         series = true;
     484        if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt())
     485            && tmpExp1.cap(2).toUInt()<=50)
     486        {
     487            event.partnumber = tmpExp1.cap(1).toUInt();
     488            event.parttotal  = tmpExp1.cap(2).toUInt();
     489            // Remove from the title
     490            event.title =
     491                event.title.mid(position1 + tmpExp1.cap(0).length());
     492            series = true;
     493        }
    477494    }
    478495    else if ((position1 = tmpExp1.search(event.subtitle)) != -1)
    479496    {
    480         event.partnumber = tmpExp1.cap(1).toUInt();
    481         event.parttotal  = tmpExp1.cap(2).toUInt();
    482         // Remove from the sub title
    483         event.subtitle =
    484             event.subtitle.mid(position1 + tmpExp1.cap(0).length());
    485         series = true;
     497        if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt())
     498            && tmpExp1.cap(2).toUInt()<=50)
     499        {
     500            event.partnumber = tmpExp1.cap(1).toUInt();
     501            event.parttotal  = tmpExp1.cap(2).toUInt();
     502            // Remove from the sub title
     503            event.subtitle =
     504                event.subtitle.mid(position1 + tmpExp1.cap(0).length());
     505            series = true;
     506        }
    486507    }
    487508    else if ((position1 = tmpExp1.search(event.description)) != -1)
    488509    {
    489         event.partnumber = tmpExp1.cap(1).toUInt();
    490         event.parttotal  = tmpExp1.cap(2).toUInt();
    491         series = true;
     510        if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt())
     511            && tmpExp1.cap(2).toUInt()<=50)
     512        {
     513            event.partnumber = tmpExp1.cap(1).toUInt();
     514            event.parttotal  = tmpExp1.cap(2).toUInt();
     515            // Remove from the description
     516            event.description =
     517                event.description.mid(position1+tmpExp1.cap(0).length());
     518            series = true;
     519        }
    492520    }
    493521    else if ((position1 = tmpExp2.search(event.description)) != -1)
    494522    {
    495523        event.partnumber = tmpExp2.cap(2).toUInt();
    496524        event.parttotal  = tmpExp2.cap(3).toUInt();
     525        // Remove from the description
     526        event.description =
     527            event.description.mid(position1+tmpExp2.cap(0).length());
    497528        series = true;
    498529    }
    499530    else if ((position1 = tmpExp3.search(event.description)) != -1)
    500531    {
    501532        event.partnumber = tmpExp3.cap(1).toUInt();
    502533        event.parttotal  = tmpExp3.cap(2).toUInt();
     534        // Remove from the description
     535        event.description =
     536            event.description.mid(position1+tmpExp3.cap(0).length());
    503537        series = true;
    504538    }
    505539    if (series)
     
    549583            event.originalairdate = QDate(y, 1, 1);
    550584    }
    551585
    552     // Remove spurious channel names
    553     event.subtitle = event.subtitle.remove(m_ukCBBC);
    554     event.description = event.description.remove(m_ukCBBC);
    555     event.subtitle = event.subtitle.remove(m_ukCBeebies);
    556     event.description = event.description.remove(m_ukCBeebies);
    557 
    558586    // Trim trailing '.'
    559587    event.title.remove(m_ukPEnd);
    560588    event.subtitle.remove(m_ukPEnd);
  • libs/libmythtv/eitfixup.h

     
    103103    const QRegExp m_ukDoubleDotEnd;
    104104    const QRegExp m_ukDoubleDotStart;
    105105    const QRegExp m_ukDotSpaceStart;
     106    const QRegExp m_ukTime;
    106107    const QRegExp m_comHemCountry;
    107108    const QRegExp m_comHemDirector;
    108109    const QRegExp m_comHemActor;