From fbd75da596213e5af1256703a6a6aed2aff8ebd1 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 15 Sep 2002 14:35:32 +0200 Subject: [PATCH] Added an EPG bugfix for the latest VOX EPG data format --- HISTORY | 1 + eit.c | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index f8cf060d..d464a222 100644 --- a/HISTORY +++ b/HISTORY @@ -1477,3 +1477,4 @@ Video Disk Recorder Revision History driver (thanks to Andreas Schultz). - Added a missing StripAudioPackets() to cDvbPlayer::Action() (thanks to Stefan Huelswitt). +- Added an EPG bugfix for the latest VOX EPG data format. diff --git a/eit.c b/eit.c index 812cd353..d4912c29 100644 --- a/eit.c +++ b/eit.c @@ -16,7 +16,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: eit.c 1.50 2002/09/15 13:02:28 kls Exp $ + * $Id: eit.c 1.51 2002/09/15 14:35:32 kls Exp $ ***************************************************************************/ #include "eit.h" @@ -405,7 +405,7 @@ bool cEventInfo::Read(FILE *f, cSchedule *Schedule) return false; } -#define MAXEPGBUGFIXSTATS 5 +#define MAXEPGBUGFIXSTATS 6 #define MAXEPGBUGFIXCHANS 50 struct tEpgBugFixStats { int hits; @@ -485,6 +485,32 @@ void cEventInfo::FixEpgBugs(void) // EPG data. Let's fix their bugs as good as we can: if (pTitle) { + // VOX puts too much information into the Subtitle and leaves the Extended + // Description empty: + // + // Title + // (NAT, Year Min')[ ["Subtitle". ]Extended Description] + // + if (pSubtitle && !pExtendedDescription) { + if (*pSubtitle == '(') { + char *e = strchr(pSubtitle + 1, ')'); + if (e) { + if (*(e + 1)) { + if (*++e == ' ') + if (*(e + 1) == '"') + e++; + } + else + e = NULL; + char *s = e ? strdup(e) : NULL; + free(pSubtitle); + pSubtitle = s; + EpgBugFixStat(0, GetServiceID()); + // now the fixes #1 and #2 below will handle the rest + } + } + } + // VOX and VIVA put the Subtitle in quotes and use either the Subtitle // or the Extended Description field, depending on how long the string is: // @@ -504,7 +530,7 @@ void cEventInfo::FixEpgBugs(void) free(pExtendedDescription); pSubtitle = s; pExtendedDescription = d; - EpgBugFixStat(0, GetServiceID()); + EpgBugFixStat(1, GetServiceID()); } } } @@ -521,7 +547,7 @@ void cEventInfo::FixEpgBugs(void) memmove(pSubtitle, pSubtitle + 1, strlen(pSubtitle)); pExtendedDescription = pSubtitle; pSubtitle = NULL; - EpgBugFixStat(1, GetServiceID()); + EpgBugFixStat(2, GetServiceID()); } } @@ -533,7 +559,7 @@ void cEventInfo::FixEpgBugs(void) if (pSubtitle && strcmp(pTitle, pSubtitle) == 0) { free(pSubtitle); pSubtitle = NULL; - EpgBugFixStat(2, GetServiceID()); + EpgBugFixStat(3, GetServiceID()); } // ZDF.info puts the Subtitle between double quotes, which is nothing @@ -549,7 +575,7 @@ void cEventInfo::FixEpgBugs(void) char *p = strrchr(pSubtitle, '"'); if (p) *p = 0; - EpgBugFixStat(3, GetServiceID()); + EpgBugFixStat(4, GetServiceID()); } } @@ -570,7 +596,7 @@ void cEventInfo::FixEpgBugs(void) if (*p == '-' && *(p + 1) == ' ' && *(p + 2) && islower(*(p - 1)) && islower(*(p + 2))) { if (!startswith(p + 2, "und ")) { // special case in German, as in "Lach- und Sachgeschichten" memmove(p, p + 2, strlen(p + 2) + 1); - EpgBugFixStat(4, GetServiceID()); + EpgBugFixStat(5, GetServiceID()); } } p++;