Ticket #8777: dish_descriptors5.diff

File dish_descriptors5.diff, 10.2 KB (added by Mark.Buechler@…, 16 years ago)

Final patch to eitfixup for Bell & Dish.

  • libs/libmythtv/eitfixup.cpp

     
    77#include "channelutil.h" // for GetDefaultAuthority()
    88
    99#include "programinfo.h" // for subtitle types and audio and video properties
     10#include "dishdescriptors.h" // for dish_theme_type_to_string
    1011
    1112/*------------------------------------------------------------------------
    1213 * Event Fix Up Scripts - Turned on by entry in dtv_privatetype table
     
    1516EITFixUp::EITFixUp()
    1617    : m_bellYear("[\\(]{1}[0-9]{4}[\\)]{1}"),
    1718      m_bellActors("\\set\\s|,"),
     19      m_bellPPVTitleAllDayHD("\\s*\\(All Day\\, HD\\)\\s*$"),
    1820      m_bellPPVTitleAllDay("\\s*\\(All Day.*\\)\\s*$"),
    1921      m_bellPPVTitleHD("^HD\\s?-\\s?"),
    20       m_bellPPVSubtitleAllDay("^All Day \\(.*\\sEastern\\)$"),
     22      m_bellPPVSubtitleAllDay("^All Day \\(.*\\sEastern\\)\\s*$"),
    2123      m_bellPPVDescriptionAllDay("^\\(.*\\sEastern\\)"),
    2224      m_bellPPVDescriptionAllDay2("^\\([0-9].*am-[0-9].*am\\sET\\)"),
    2325      m_bellPPVDescriptionEventId("\\([0-9]{5}\\)"),
     26      m_dishPPVTitleHD("\\sHD\\s*$"),
     27      m_dishPPVTitleColon("\\:\\s*$"),
     28      m_dishPPVSpacePerenEnd("\\s\\)\\s*$"),
     29      m_dishDescriptionNew("\\s*New\\.\\s*"),
     30      m_dishDescriptionFinale("\\s*(Series|Season)\\sFinale\\.\\s*"),
     31      m_dishDescriptionFinale2("\\s*Finale\\.\\s*"),
     32      m_dishDescriptionPremiere("\\s*(Series|Season)\\s(Premier|Premiere)\\.\\s*"),
     33      m_dishDescriptionPremiere2("\\s*(Premier|Premiere)\\.\\s*"),
     34      m_dishPPVCode("\\s*\\(([A-Z]|[0-9]){5}\\)\\s*$"),
    2435      m_ukThen("\\s*(Then|Followed by) 60 Seconds\\.", Qt::CaseInsensitive),
    2536      m_ukNew("(New\\.|\\s*(Brand New|New)\\s*(Series|Episode)\\s*[:\\.\\-])",Qt::CaseInsensitive),
    2637      m_ukCEPQ("[:\\!\\.\\?]"),
     
    127138    if (kFixBell & event.fixup)
    128139        FixBellExpressVu(event);
    129140
     141    if (kFixDish & event.fixup)
     142        FixBellExpressVu(event);
     143
    130144    if (kFixUK & event.fixup)
    131145        FixUK(event);
    132146
     
    244258    // you come up with an odd category
    245259    if (position < 10)
    246260    {
    247         const QString stmp       = event.description;
    248         event.description        = stmp.right(stmp.length() - position - 2);
    249         event.category = stmp.left(position);
    250261    }
    251262    else
    252263    {
    253264        event.category = "Unknown";
    254265    }
    255266
    256     // When a channel is off air the category is "-"
    257     // so leave the category as blank
    258     if (event.category == "-")
    259         event.category = "OffAir";
     267    // If the content descriptor didn't come up with anything, try parsing the category
     268    // out of the description.
     269    if (event.category == "")
     270    {
     271        // Take out the content description which is
     272        // always next with a period after it
     273        position = event.description.indexOf(".");
     274        if ((position + 1) < event.description.length())
     275            position = event.description.indexOf(". ");
     276        // Make sure they didn't leave it out and
     277        // you come up with an odd category
     278        if ((position > -1) && position < 20)
     279        {
     280            const QString stmp       = event.description;
     281            event.description        = stmp.right(stmp.length() - position - 2);
     282            event.category = stmp.left(position);
    260283
    261     if (event.category.length() > 10)
    262         event.category = "Unknown";
     284            int position_p = event.category.indexOf("(");
     285            if (position_p == -1)
     286                event.description = stmp.right(stmp.length() - position - 2);
     287            else
     288                event.category    = "Unknown";
     289        }
     290        else
     291        {
     292            event.category = "Unknown";
     293        }
    263294
     295        // When a channel is off air the category is "-"
     296        // so leave the category as blank
     297        if (event.category == "-")
     298            event.category = "OffAir";
    264299
     300        if (event.category.length() > 20)
     301            event.category = "Unknown";
     302    }
     303    else if (event.categoryType)
     304    {
     305        QString theme = dish_theme_type_to_string(event.categoryType);
     306        event.description = event.description.replace(theme, "");
     307        if (event.description.startsWith("."))
     308            event.description = event.description.right(event.description.length() - 1);
     309        if (event.description.startsWith(" "))
     310            event.description = event.description.right(event.description.length() - 1);
     311    }
     312
    265313    // See if a year is present as (xxxx)
    266314    position = event.description.indexOf(m_bellYear);
    267315    if (position != -1 && event.category != "")
     
    271319        bool ok;
    272320        uint y = event.description.mid(position + 1, 4).toUInt(&ok);
    273321        if (ok)
     322        {
    274323            event.originalairdate = QDate(y, 1, 1);
     324            event.previouslyshown = true;
     325        }
    275326
    276327        // Get the actors if they exist
    277328        if (position > 3)
     
    305356        event.description = event.description.replace(m_Stereo, "");
    306357    }
    307358
     359    // Check for "title (All Day, HD)" in the title
     360    position = event.title.indexOf(m_bellPPVTitleAllDayHD);
     361    if (position != -1)
     362    {
     363        event.title = event.title.replace(m_bellPPVTitleAllDayHD, "");
     364        event.videoProps |= VID_HDTV;
     365     }
     366
    308367    // Check for "title (All Day)" in the title
    309368    position = event.title.indexOf(m_bellPPVTitleAllDay);
    310369    if (position != -1)
     
    320379        event.videoProps |= VID_HDTV;
    321380    }
    322381
     382    // Check for (HD) in the decription
     383    position = event.description.indexOf("(HD)");
     384    if (position != -1)
     385    {
     386        event.description = event.description.replace("(HD)", "");
     387        event.videoProps |= VID_HDTV;
     388    }
     389
     390    // Check for (HD) in the title
     391    position = event.title.indexOf("(HD)");
     392    if (position != -1)
     393    {
     394        event.description = event.title.replace("(HD)", "");
     395        event.videoProps |= VID_HDTV;
     396    }
     397
     398    // Check for HD at the end of the title
     399    position = event.title.indexOf(m_dishPPVTitleHD);
     400    if (position != -1)
     401    {
     402        event.title = event.title.replace(m_dishPPVTitleHD, "");
     403        event.videoProps |= VID_HDTV;
     404    }
     405
     406    // Check for (DD) at the end of the description
     407    position = event.description.indexOf("(DD)");
     408    if (position != -1)
     409    {
     410        event.description = event.description.replace("(DD)", "");
     411        event.audioProps |= AUD_DOLBY;
     412        event.audioProps |= AUD_STEREO;
     413    }
     414
     415    // Remove SAP from Dish descriptions
     416    position = event.description.indexOf("(SAP)");
     417    if (position != -1)
     418    {
     419        event.description = event.description.replace("(SAP", "");
     420        event.subtitleType |= SUB_HARDHEAR;
     421    }
     422
     423    // Remove any trailing colon in title
     424    position = event.title.indexOf(m_dishPPVTitleColon);
     425    if (position != -1)
     426    {
     427        event.title = event.title.replace(m_dishPPVTitleColon, "");
     428    }
     429
     430    // Remove New at the end of the description
     431    position = event.description.indexOf(m_dishDescriptionNew);
     432    if (position != -1)
     433    {
     434        event.previouslyshown = false;
     435        event.description = event.description.replace(m_dishDescriptionNew, "");
     436    }
     437
     438    // Remove Series Finale at the end of the desciption
     439    position = event.description.indexOf(m_dishDescriptionFinale);
     440    if (position != -1)
     441    {
     442        event.previouslyshown = false;
     443        event.description = event.description.replace(m_dishDescriptionFinale, "");
     444    }
     445
     446    // Remove Series Finale at the end of the desciption
     447    position = event.description.indexOf(m_dishDescriptionFinale2);
     448    if (position != -1)
     449    {
     450        event.previouslyshown = false;
     451        event.description = event.description.replace(m_dishDescriptionFinale2, "");
     452    }
     453
     454    // Remove Series Premiere at the end of the description
     455    position = event.description.indexOf(m_dishDescriptionPremiere);
     456    if (position != -1)
     457    {
     458        event.previouslyshown = false;
     459        event.description = event.description.replace(m_dishDescriptionPremiere, "");
     460    }
     461
     462    // Remove Series Premiere at the end of the description
     463    position = event.description.indexOf(m_dishDescriptionPremiere2);
     464    if (position != -1)
     465    {
     466        event.previouslyshown = false;
     467        event.description = event.description.replace(m_dishDescriptionPremiere2, "");
     468    }
     469
     470    // Remove Dish's PPV code at the end of the description
     471    QRegExp ppvcode = m_dishPPVCode;
     472    ppvcode.setCaseSensitivity(Qt::CaseInsensitive);
     473    position = event.description.indexOf(ppvcode);
     474    if (position != -1)
     475    {
     476        event.description = event.description.replace(ppvcode, "");
     477    }
     478
     479    // Remove trailing garbage
     480    position = event.description.indexOf(m_dishPPVSpacePerenEnd);
     481    if (position != -1)
     482    {
     483        event.description = event.description.replace(m_dishPPVSpacePerenEnd, "");
     484    }
     485
    323486    // Check for subtitle "All Day (... Eastern)" in the subtitle
    324487    position = event.subtitle.indexOf(m_bellPPVSubtitleAllDay);
    325488    if (position != -1)
  • libs/libmythtv/eitfixup.h

     
    4949        kFixNL         = 0x1000,
    5050        kFixCategory   = 0x8000,
    5151        kFixNO         = 0x10000,
     52        kFixDish       = 0x20000,
    5253
    5354        // Early fixups
    5455        kEFixForceISO8859_1  = 0x2000,
     
    9293
    9394    const QRegExp m_bellYear;
    9495    const QRegExp m_bellActors;
     96    const QRegExp m_bellPPVTitleAllDayHD;
    9597    const QRegExp m_bellPPVTitleAllDay;
    9698    const QRegExp m_bellPPVTitleHD;
    9799    const QRegExp m_bellPPVSubtitleAllDay;
    98100    const QRegExp m_bellPPVDescriptionAllDay;
    99101    const QRegExp m_bellPPVDescriptionAllDay2;
    100102    const QRegExp m_bellPPVDescriptionEventId;
     103    const QRegExp m_dishPPVTitleHD;
     104    const QRegExp m_dishPPVTitleColon;
     105    const QRegExp m_dishPPVSpacePerenEnd;
     106    const QRegExp m_dishDescriptionNew;
     107    const QRegExp m_dishDescriptionFinale;
     108    const QRegExp m_dishDescriptionFinale2;
     109    const QRegExp m_dishDescriptionPremiere;
     110    const QRegExp m_dishDescriptionPremiere2;
     111    const QRegExp m_dishPPVCode;
    101112    const QRegExp m_ukThen;
    102113    const QRegExp m_ukNew;
    103114    const QRegExp m_ukCEPQ;