diff --git a/mythtv/libs/libmythtv/eitfixup.cpp b/mythtv/libs/libmythtv/eitfixup.cpp index e71b5d7..2bb5833 100644 --- a/mythtv/libs/libmythtv/eitfixup.cpp +++ b/mythtv/libs/libmythtv/eitfixup.cpp @@ -83,6 +83,9 @@ void EITFixUp::Fix(DBEvent &event) const if (kFixMCA & event.fixup) FixMCA(event); + if (kFixRTL & event.fixup) + FixRTL(event); + if (event.fixup) { if (!event.title.isEmpty()) @@ -727,3 +730,45 @@ void EITFixUp::FixMCA(DBEvent &event) co event.category_type = kCategoryMovie; } } + +/** \fn EITFixUp::FixRTL(DBEvent&) const + * \brief Use this to standardise the RTL group guide in Germany. + */ +void EITFixUp::FixRTL(DBEvent &event) const +{ + const uint SUBTITLE_PCT = 35; //% of description to allow subtitle up to + const uint SUBTITLE_MAX_LEN = 128; // max length of subtitle field in db. + int position; + QRegExp tmpExp1; + + // debugging ausgabe... aber wie event voll ausgeben + // ??? + // No need to continue without a description. + if (event.description.length() <= 0) + return; + + // Try to find subtitle in description, the same regex as in mca network + tmpExp1 = m_mcaSubtitle; + if ((position = tmpExp1.search(event.description)) != -1) + { + if ((tmpExp1.cap(1).length() < SUBTITLE_MAX_LEN) && + ((tmpExp1.cap(1).length()*100)/event.description.length() < + SUBTITLE_PCT)) + { + event.subtitle = tmpExp1.cap(1); + event.description = tmpExp1.cap(2); + } + } + + // Try to find episode numbers in subtitle + // tmpExp1 = m_DVBSSeries; + //if ((position = tmpExp1.search(event.subtitle)) != -1) + //{ + // uint season = tmpExp1.cap(1).toUInt(); + //uint episode = tmpExp1.cap(2).toUInt(); + //event.subtitle = tmpExp1.cap(3).stripWhiteSpace(); + //event.syndicatedepisodenumber = + // QString("E%1S%2").arg(episode).arg(season); + //event.category_type = kCategorySeries; + //} +} diff --git a/mythtv/libs/libmythtv/eitfixup.h b/mythtv/libs/libmythtv/eitfixup.h index 1bd1f29..97dab8b 100644 --- a/mythtv/libs/libmythtv/eitfixup.h +++ b/mythtv/libs/libmythtv/eitfixup.h @@ -28,6 +28,7 @@ class EITFixUp kFixSubtitle = 0x0020, kFixAUStar = 0x0040, kFixMCA = 0x0080, + kFixRTL = 0x0400, // Early fixups kEFixForceISO8859_1 = 0x0100, @@ -54,6 +55,7 @@ class EITFixUp void FixComHem(DBEvent &event, bool parse_subtitle) const; // Sweden DVB-C void FixAUStar(DBEvent &event) const; // Australia DVB-S void FixMCA(DBEvent &event) const; // MultiChoice Africa DVB-S + void FixRTL(DBEvent &event) const; // RTL group DVB const QRegExp m_bellYear; const QRegExp m_bellActors; diff --git a/mythtv/libs/libmythtv/eithelper.cpp b/mythtv/libs/libmythtv/eithelper.cpp index b45ed50..c6d3d95 100644 --- a/mythtv/libs/libmythtv/eithelper.cpp +++ b/mythtv/libs/libmythtv/eithelper.cpp @@ -562,6 +562,10 @@ static void init_fixup(QMap