From 6281a196f14b42c2a67077207e313c71bda2ad2a Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 14 Feb 2004 11:00:00 +0100 Subject: Replacing control characters with blanks in EPG; deleting duplicate text in EPG's short text and description --- epg.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'epg.c') diff --git a/epg.c b/epg.c index 19f1c7f4..dbbce74e 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.c 1.4 2004/01/09 15:22:18 kls Exp $ + * $Id: epg.c 1.5 2004/02/14 11:00:00 kls Exp $ */ #include "epg.h" @@ -175,7 +175,7 @@ bool cEvent::Read(FILE *f, cSchedule *Schedule) return false; } -#define MAXEPGBUGFIXSTATS 7 +#define MAXEPGBUGFIXSTATS 8 #define MAXEPGBUGFIXCHANS 100 struct tEpgBugFixStats { int hits; @@ -257,6 +257,13 @@ void cEvent::FixEpgBugs(void) strreplace(title, '\n', ' '); strreplace(shortText, '\n', ' '); strreplace(description, '\n', ' '); + // Same for control characters: + strreplace(title, '\x86', ' '); + strreplace(title, '\x87', ' '); + strreplace(shortText, '\x86', ' '); + strreplace(shortText, '\x87', ' '); + strreplace(description, '\x86', ' '); + strreplace(description, '\x87', ' '); if (Setup.EPGBugfixLevel == 0) return; @@ -397,6 +404,20 @@ void cEvent::FixEpgBugs(void) } } + // Some channels put the same information into ShortText and Description. + // In that case we delete one of them: + if (shortText && description && strcmp(shortText, description) == 0) { + if (strlen(shortText) > MAX_USEFUL_EPISODE_LENGTH) { + free(shortText); + shortText = NULL; + } + else { + free(description); + description = NULL; + } + EpgBugFixStat(7, ChannelID()); + } + // Some channels use the ` ("backtick") character, where a ' (single quote) // would be normally used. Actually, "backticks" in normal text don't make // much sense, so let's replace them: -- cgit v1.2.3