Skip to content

Commit

Permalink
Enhance UK EIT fixup to support "QuotedSubtitles".
Browse files Browse the repository at this point in the history
Some of the channels (specifically 4Music) are helpfully
putting the subtitle in the description as follows
'<subtitle>.' <description>

This adds support for this case.
  • Loading branch information
stuarta committed Dec 29, 2011
1 parent f7b28e5 commit 4125a40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mythtv/libs/libmythtv/eitfixup.cpp
Expand Up @@ -56,6 +56,7 @@ EITFixUp::EITFixUp()
m_ukExclusionFromSubtitle("(starring|stars\\s|drama|series|sitcom)",Qt::CaseInsensitive),
m_ukCompleteDots("^\\.\\.+$"),
m_ukAllNew("All New To 4Music!\\s?"),
m_ukQuotedSubtitle("(?:^')([\\w\\s\\-,]+)(?:\\.' )"),
m_comHemCountry("^(\\(.+\\))?\\s?([^ ]+)\\s([^\\.0-9]+)"
"(?:\\sfrån\\s([0-9]{4}))(?:\\smed\\s([^\\.]+))?\\.?"),
m_comHemDirector("[Rr]egi"),
Expand Down Expand Up @@ -543,7 +544,7 @@ void EITFixUp::SetUKSubtitle(DBEventEIT &event) const
QStringList strListColon = event.description.split(":");
QStringList strListEnd;

bool fColon = false;
bool fColon = false, fQuotedSubtitle = false;
int nPosition1;
QString strEnd;
if (strListColon.count()>1)
Expand Down Expand Up @@ -605,10 +606,17 @@ void EITFixUp::SetUKSubtitle(DBEventEIT &event) const
fColon = true;
}
}
QRegExp tmpQuotedSubtitle = m_ukQuotedSubtitle;
if (tmpQuotedSubtitle.indexIn(event.description) != -1)
{
event.subtitle = tmpQuotedSubtitle.cap(1);
event.description.remove(m_ukQuotedSubtitle);
fQuotedSubtitle = true;
}
QStringList strListPeriod;
QStringList strListQuestion;
QStringList strListExcl;
if (!fColon)
if (!(fColon || fQuotedSubtitle))
{
strListPeriod = event.description.split(".");
if (strListPeriod.count() >1)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/eitfixup.h
Expand Up @@ -134,6 +134,7 @@ class EITFixUp
const QRegExp m_ukYearColon;
const QRegExp m_ukExclusionFromSubtitle;
const QRegExp m_ukCompleteDots;
const QRegExp m_ukQuotedSubtitle;
const QRegExp m_ukAllNew;
const QRegExp m_comHemCountry;
const QRegExp m_comHemDirector;
Expand Down

0 comments on commit 4125a40

Please sign in to comment.