Ticket #8483: nrk-eit-v2.diff

File nrk-eit-v2.diff, 6.9 KB (added by hakon@…, 14 years ago)

Fresh start with eit-fixup for NRK on DVB-T

  • libs/libmythtv/eitfixup.cpp

     
    88
    99#include "programinfo.h" // for subtitle types and audio and video properties
    1010
     11#define LOC QString("EITFixUp: ")
     12#define LOC_ERR QString("EITFixUp, Error: ")
     13
    1114/*------------------------------------------------------------------------
    1215 * Event Fix Up Scripts - Turned on by entry in dtv_privatetype table
    1316 *------------------------------------------------------------------------*/
     
    102105      m_nlCat("^(Amusement|Muziek|Informatief|Nieuws/actualiteiten|Jeugd|Animatie|Sport|Serie/soap|Kunst/Cultuur|Documentaire|Film|Natuur|Erotiek|Comedy|Misdaad|Religieus)\\.\\s"),
    103106      m_nlOmroep ("\\s\\(([A-Z]+/?)+\\)$"),
    104107      m_noRerun(" \\(R\\)"),
     108      m_ColonSubtitle("^([^:]+): (.+)"),
     109      m_NRKCategories("^(Supersommer|Superjul|Barne-tv|Fantorangen|Supermorgen|Julemorgen|Sommermorgen|Kuraffen-TV|Sport i dag|NRKs sportsl.rdag|NRKs sportss.ndag|Dagens dokumentar|NRK2s historiekveld|Detektimen|Nattkino|Filmklassiker|Film|Kortfilm|P.skemorgen|Radioteatret|Opera|P2-Akademiet|Nyhetsmorgen i P2 og Alltid Nyheter:): (.+)"),
     110      m_noPremiere("\\s+-\\s+(Sesongpremiere|Premiere)!?$"),
    105111      m_Stereo("\\b\\(?[sS]tereo\\)?\\b")
    106112
    107113{
     
    157163    if (kFixNO & event.fixup)
    158164        FixNO(event);
    159165
     166    if (kFixNRK_DVBT & event.fixup){ // This should probably
     167        FixNRK_DVBT(event);          // be consolidated with
     168    }                                // kFixNO. Testers welcome.
    160169    if (kFixCategory & event.fixup)
    161170        FixCategory(event);
    162171
     
    15131522      event.title = event.title.replace(m_noRerun, "");
    15141523    }
    15151524}
     1525
     1526/** \fn EITFixUp::FixNRK_DVBT(DBEventEIT&) const
     1527 *  \brief Use this to clean DVB-T guide in Norway (NRK)
     1528 */
     1529void EITFixUp::FixNRK_DVBT(DBEventEIT &event) const
     1530{
     1531    int        position;
     1532    QRegExp    tmpExp1;
     1533    tmpExp1 = m_NRKCategories;
     1534    // Check for "title (R)" in the title
     1535    position = event.title.indexOf(m_noRerun);
     1536    if (position != -1)
     1537    {
     1538      event.previouslyshown = true;
     1539      event.title = event.title.replace(m_noRerun, "");
     1540    }
     1541    // Move colon separated category from program-titles into description
     1542    // Have seen "NRK2s historiekveld: Film: bla-bla"
     1543    while (((position = tmpExp1.indexIn(event.title)) != -1) && (tmpExp1.cap(2).length() > 1)){
     1544        event.title  = tmpExp1.cap(2);
     1545        event.description = "(" + tmpExp1.cap(1) + ") " + event.description;
     1546        VERBOSE(VB_EIT, LOC + QString("Category ") + tmpExp1.cap(1)  + QString(" moved") );
     1547    }
     1548    // Remove season premiere markings
     1549    tmpExp1 = m_noPremiere;
     1550    if ((position = tmpExp1.indexIn(event.title)) >=3){
     1551        VERBOSE(VB_EIT, LOC + QString("Removing Premiere tag"));
     1552        event.title.remove(m_noPremiere);
     1553    }
     1554    // Try to find colon-delimited subtitle in title, only tested for NRK channels
     1555    tmpExp1 = m_ColonSubtitle;
     1556    if (!event.title.startsWith("CSI:") &&
     1557        !event.title.startsWith("CD:") &&
     1558        !event.title.startsWith("Distriktsnyheter: fra"))
     1559    {
     1560        if ((position = tmpExp1.indexIn(event.title)) != -1)
     1561        {
     1562
     1563            if (event.subtitle.length() <= 0)
     1564            {
     1565                event.title    = tmpExp1.cap(1);
     1566                event.subtitle = tmpExp1.cap(2);
     1567            } else if (event.subtitle == tmpExp1.cap(2)) {
     1568                event.title    = tmpExp1.cap(1);
     1569            } else {
     1570                VERBOSE(VB_EIT, LOC + QString("Found colon, but it seems there already is a subtitle"));
     1571            }
     1572        }
     1573    }
     1574}
     1575
  • libs/libmythtv/eithelper.cpp

     
    784784    // DVB-S(2) Thor 0.8W Norwegian
    785785    fix[70U << 16] = EITFixUp::kFixNO;
    786786
     787    // DVB-T NTV/NRK (Norway)
     788    fix[910LL << 32 | 8770U  << 16 | 0x006f] = EITFixUp::kFixNRK_DVBT;  //NRK Folkemusikk
     789    fix[910LL << 32 | 8770U  << 16 | 0x0070] = EITFixUp::kFixNRK_DVBT;  //NRK Stortinget
     790    fix[910LL << 32 | 8770U  << 16 | 0x0071] = EITFixUp::kFixNRK_DVBT;  //NRK Super
     791    fix[910LL << 32 | 8770U  << 16 | 0x0072] = EITFixUp::kFixNRK_DVBT;  //NRK Sport
     792    fix[910LL << 32 | 8770U  << 16 | 0x0073] = EITFixUp::kFixNRK_DVBT;  //NRK Gull
     793    fix[910LL << 32 | 8770U  << 16 | 0x0074] = EITFixUp::kFixNRK_DVBT;  //NRK Jazz
     794    fix[910LL << 32 | 8770U  << 16 | 0x0067] = EITFixUp::kFixNRK_DVBT;  //NRK Super / NRK3
     795    fix[910LL << 32 | 8770U  << 16 | 0x0068] = EITFixUp::kFixNRK_DVBT;  //NRK Tegnsprï¿œ
     796    fix[910LL << 32 | 8770U  << 16 | 0x0069] = EITFixUp::kFixNRK_DVBT;  //NRK P2
     797    fix[910LL << 32 | 8770U  << 16 | 0x006a] = EITFixUp::kFixNRK_DVBT;  //NRK P3
     798    fix[910LL << 32 | 8770U  << 16 | 0x006b] = EITFixUp::kFixNRK_DVBT;  //NRK Alltid Nyheter
     799    fix[910LL << 32 | 8770U  << 16 | 0x006c] = EITFixUp::kFixNRK_DVBT;  //NRK mP3
     800    fix[910LL << 32 | 8770U  << 16 | 0x006d] = EITFixUp::kFixNRK_DVBT;  //NRK Klassisk
     801    fix[910LL << 32 | 8770U  << 16 | 0x006e] = EITFixUp::kFixNRK_DVBT;  //NRK Sï¿œi Radio
     802    fix[910LL << 32 | 8770U  << 16 | 0x0066] = EITFixUp::kFixNRK_DVBT;  //NRK2
     803    fix[910LL << 32 | 8770U  << 16 | 0x03f0] = EITFixUp::kFixNRK_DVBT;  //NRK1 Mï¿œe og Romsdal
     804    fix[910LL << 32 | 8770U  << 16 | 0x0455] = EITFixUp::kFixNRK_DVBT;  //NRK P1 Trï¿œdelag
     805    fix[910LL << 32 | 8770U  << 16 | 0x03f1] = EITFixUp::kFixNRK_DVBT;  //NRK1 Midtnytt
     806    //Missing service ids for NRK1 from other counties here.
     807    //Should we allow all service ids ?
     808
     809
    787810    ///////////////////////////////////////////////////////////////////////////
    788811    // Special Early fixups for providers that break DVB EIT spec.
    789812    // transport_id<<32 | netword_id<<16 | service_id
  • libs/libmythtv/eitfixup.h

     
    4949        kFixNL         = 0x1000,
    5050        kFixCategory   = 0x8000,
    5151        kFixNO         = 0x10000,
    52 
     52        kFixNRK_DVBT   = 0x20000,
    5353        // Early fixups
    5454        kEFixForceISO8859_1  = 0x2000,
    5555        kEFixForceISO8859_15 = 0x4000,
     
    8787    void FixNL(DBEventEIT &event) const;            // Netherlands DVB-C
    8888    void FixCategory(DBEventEIT &event) const;      // Generic Category fixes
    8989    void FixNO(DBEventEIT &event) const;            // Norwegian DVB-S
     90    void FixNRK_DVBT(DBEventEIT &event) const;      // NRK DVB-T
    9091
    9192    static QString AddDVBEITAuthority(uint chanid, const QString &id);
    9293
     
    175176    const QRegExp m_nlCat;
    176177    const QRegExp m_nlOmroep;
    177178    const QRegExp m_noRerun;
     179    const QRegExp m_ColonSubtitle;
     180    const QRegExp m_NRKCategories;
     181    const QRegExp m_noPremiere;
    178182    const QRegExp m_Stereo;
    179183};
    180184