Ticket #4327: eitfixup9.patch

File eitfixup9.patch, 8.5 KB (added by John {at} Pullan {dot} org, 16 years ago)

Update of file

  • 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),
    21       m_ukNew1("^New\\."),
     20      m_ukNew("\\s*(Brand New|New)\\s*(Series|Episode)\\s*[:\\.\\-]",false),
     21      m_ukNew1("New\\."),
    2222      m_ukT4("^[tT]4:"),
    2323      m_ukEQ("[:\\!\\?]"),
    2424      m_ukEPQ("[:\\!\\.\\?]"),
     
    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|)"),
     44      m_ukBBC3("BBC THREE on BBC TWO\\.",false),
     45      m_ukBBC4("BBC FOUR on BBC TWO\\.",false),
    4346      m_comHemCountry("^(\\(.+\\))?\\s?([^ ]+)\\s([^\\.0-9]+)"
    4447                      "(?:\\sfrån\\s([0-9]{4}))(?:\\smed\\s([^\\.]+))?\\.?"),
    4548      m_comHemDirector("[Rr]egi"),
     
    357360    event.description = event.description.remove(m_ukNew1);
    358361    event.title  = event.title.remove(m_ukT4);
    359362
     363    // Removal of CBBC and CBeebies
     364    event.description = event.description.remove(m_ukCBBC);
     365    event.description = event.description.remove(m_ukCBeebies);
     366
     367    // Removal of BBC FOUR and BBC THREE
     368    event.description = event.description.remove(m_ukBBC4);
     369    event.description = event.description.remove(m_ukBBC3);
     370
    360371    // BBC 7 [Rpt of ...] case.
    361372    event.description = event.description.remove(m_ukBBC7rpt);
    362373
     374    event.title = event.title.stripWhiteSpace();
     375    event.description = event.description.stripWhiteSpace();
     376
    363377    QRegExp tmp24ep = m_uk24ep;
    364378    if (!event.title.startsWith("CSI:") && !event.title.startsWith("CD:"))
    365379    {
     
    385399                    event.description = event.title.mid(position1);
    386400                    event.title = event.title.left(position1);
    387401                }
    388             }
     402            } 
    389403        }
    390404        else if ((position1 = tmp24ep.search(event.description)) != -1)
    391405        {
     
    395409                                tmp24ep.cap(0).length() - 2);
    396410            event.description = event.description.remove(tmp24ep.cap(0));
    397411        }
    398         else if (((position1 = event.title.find(m_ukColonHyphen)) != -1) &&
    399             (event.description.find(":") < 0 ))
     412        else if ((position1 = event.description.find(m_ukTime)) == -1)
    400413        {
    401             if ((uint)position1 < SUBTITLE_MAX_LEN)
     414            if (((position1 = event.title.find(m_ukColonHyphen)) != -1) &&
     415                (event.description.find(":") < 0 ))
    402416            {
    403                 event.subtitle = event.title.mid(position1 + 1);
    404                 event.title = event.title.left(position1);
     417                if ((uint)position1 < SUBTITLE_MAX_LEN)
     418                {
     419                    event.subtitle = event.title.mid(position1 + 1);
     420                    event.title = event.title.left(position1);
     421                }
    405422            }
     423            else
     424                SetUKSubtitle(event);
    406425        }
    407         else
    408             SetUKSubtitle(event);
    409426    }
    410427
    411     if (event.subtitle.isEmpty())
     428    if ((event.description.find(m_ukTime) == -1) && (event.subtitle.isEmpty()))
    412429    {
    413430       QStringList strList1 = QStringList::split(".",event.description,TRUE);
    414431       QStringList strList2 = QStringList::split("?",event.description,TRUE);
     
    426443               QStringList strList3 = strList2.grep("Drama",false);
    427444               QStringList strList4 = strList2.grep("sitcom",false);
    428445               QStringList strList5 = strList2.grep(m_ukStarring1);
     446               QStringList strList6 = strList2.grep("Series",false);
    429447               if ((strList3.count()==0) && (strList4.count()==0) &&
    430                    (strList5.count()==0))
     448                   (strList5.count()==0) && (strList6.count()==0))
    431449               {
    432450                    event.subtitle = strList1[0]+strEnd;
    433451                    event.description=
     
    468486    QRegExp tmpExp3 = m_ukSeries3;
    469487    if ((position1 = tmpExp1.search(event.title)) != -1)
    470488    {
    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;
     489        if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt())
     490            && tmpExp1.cap(2).toUInt()<=50)
     491        {
     492            event.partnumber = tmpExp1.cap(1).toUInt();
     493            event.parttotal  = tmpExp1.cap(2).toUInt();
     494            // Remove from the title
     495            event.title = event.title.left(position1)+
     496                event.title.mid(position1 + tmpExp1.cap(0).length());
     497            series = true;
     498        }
    477499    }
    478500    else if ((position1 = tmpExp1.search(event.subtitle)) != -1)
    479501    {
    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;
     502        if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt())
     503            && tmpExp1.cap(2).toUInt()<=50)
     504        {
     505            event.partnumber = tmpExp1.cap(1).toUInt();
     506            event.parttotal  = tmpExp1.cap(2).toUInt();
     507            // Remove from the sub title
     508            event.subtitle = event.subtitle.left(position1)+
     509                event.subtitle.mid(position1 + tmpExp1.cap(0).length());
     510            series = true;
     511        }
    486512    }
    487513    else if ((position1 = tmpExp1.search(event.description)) != -1)
    488514    {
    489         event.partnumber = tmpExp1.cap(1).toUInt();
    490         event.parttotal  = tmpExp1.cap(2).toUInt();
    491         series = true;
     515        if ((tmpExp1.cap(1).toUInt() != tmpExp1.cap(2).toUInt())
     516            && tmpExp1.cap(2).toUInt()<=50)
     517        {
     518            event.partnumber = tmpExp1.cap(1).toUInt();
     519            event.parttotal  = tmpExp1.cap(2).toUInt();
     520            // Remove from the description
     521            event.description = event.description.left(position1)+
     522                event.description.mid(position1+tmpExp1.cap(0).length());
     523            series = true;
     524        }
    492525    }
    493526    else if ((position1 = tmpExp2.search(event.description)) != -1)
    494527    {
    495528        event.partnumber = tmpExp2.cap(2).toUInt();
    496529        event.parttotal  = tmpExp2.cap(3).toUInt();
     530        // Remove from the description
     531        event.description = event.description.left(position1)+
     532            event.description.mid(position1+tmpExp2.cap(0).length());
    497533        series = true;
    498534    }
    499535    else if ((position1 = tmpExp3.search(event.description)) != -1)
    500536    {
    501537        event.partnumber = tmpExp3.cap(1).toUInt();
    502538        event.parttotal  = tmpExp3.cap(2).toUInt();
     539        // Remove from the description
     540        event.description = event.description.left(position1)+
     541            event.description.mid(position1+tmpExp3.cap(0).length());
    503542        series = true;
    504543    }
    505544    if (series)
     
    549588            event.originalairdate = QDate(y, 1, 1);
    550589    }
    551590
    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 
    558591    // Trim trailing '.'
    559592    event.title.remove(m_ukPEnd);
    560593    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;
     107    const QRegExp m_ukBBC3;
     108    const QRegExp m_ukBBC4;
    106109    const QRegExp m_comHemCountry;
    107110    const QRegExp m_comHemDirector;
    108111    const QRegExp m_comHemActor;