Permalink
Browse files

improve EITFixup for german RTL channels

Set category to series if we find an episode number or episode title.
Stop once we got an episode number/title instead of replacing a good
episode name with the first sentence of the description.
  • Loading branch information...
dekarl committed Dec 9, 2012
1 parent dece451 commit 4dd0b8d74de167491ffcddc727620b7a56d6b202
Showing with 23 additions and 12 deletions.
  1. +23 −12 mythtv/libs/libmythtv/eitfixup.cpp
@@ -88,7 +88,8 @@ EITFixUp::EITFixUp()
m_mcaDD(",?\\sDD\\.?"),
m_RTLrepeat("(\\(|\\s)?Wiederholung.+vo[m|n].+((?:\\d{2}\\.\\d{2}\\.\\d{4})|(?:\\d{2}[:\\.]\\d{2}\\sUhr))\\)?"),
m_RTLSubtitle("^([^\\.]{3,})\\.\\s+(.+)"),
m_RTLSubtitle1("^Folge\\s(\\d{1,4})\\s*:\\s+'(.*)'(?:\\.\\s*|$)"),
/* should be (?:\x{8a}|\\.\\s*|$) but 0x8A gets replaced with 0x20 */
m_RTLSubtitle1("^Folge\\s(\\d{1,4})\\s*:\\s+'(.*)'(?:\\s|\\.\\s*|$)"),
m_RTLSubtitle2("^Folge\\s(\\d{1,4})\\s+(.{,5}[^\\.]{,120})[\\?!\\.]\\s*"),
m_RTLSubtitle3("^(?:Folge\\s)?(\\d{1,4}(?:\\/[IVX]+)?)\\s+(.{,5}[^\\.]{,120})[\\?!\\.]\\s*"),
m_RTLSubtitle4("^Thema.{0,5}:\\s([^\\.]+)\\.\\s*"),
@@ -1288,7 +1289,7 @@ void EITFixUp::FixRTL(DBEventEIT &event) const
{
int pos;
// No need to continue without a description and with an subtitle.
// No need to continue without a description or with an subtitle.
if (event.description.length() <= 0 || event.subtitle.length() > 0)
return;
@@ -1368,20 +1369,30 @@ void EITFixUp::FixRTL(DBEventEIT &event) const
event.description.remove(0, tmpExpEpisodeNo2.matchedLength());
}
int position;
const uint SUBTITLE_PCT = 35; // % of description to allow subtitle up to
const uint SUBTITLE_MAX_LEN = 50; // max length of subtitle field in db
/* got an episode title now? (we did not have one at the start of this function) */
if (!event.subtitle.isEmpty())
{
event.categoryType = kCategorySeries;
}
if ((position = tmpExp1.indexIn(event.description)) != -1)
/* if we do not have an episode title by now try some guessing as last resort */
if (event.subtitle.length() == 0)
{
uint tmpExp1Len = tmpExp1.cap(1).length();
uint evDescLen = max(event.description.length(), 1);
int position;
const uint SUBTITLE_PCT = 35; // % of description to allow subtitle up to
const uint SUBTITLE_MAX_LEN = 50; // max length of subtitle field in db
if ((tmpExp1Len < SUBTITLE_MAX_LEN) &&
(tmpExp1Len * 100 / evDescLen < SUBTITLE_PCT))
if ((position = tmpExp1.indexIn(event.description)) != -1)
{
event.subtitle = tmpExp1.cap(1);
event.description = tmpExp1.cap(2);
uint tmpExp1Len = tmpExp1.cap(1).length();
uint evDescLen = max(event.description.length(), 1);
if ((tmpExp1Len < SUBTITLE_MAX_LEN) &&
(tmpExp1Len * 100 / evDescLen < SUBTITLE_PCT))
{
event.subtitle = tmpExp1.cap(1);
event.description = tmpExp1.cap(2);
}
}
}
}

0 comments on commit 4dd0b8d

Please sign in to comment.