From 8d667255bfc28b5db2a87c0e881e072e2316104a Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Tue, 3 Dec 2013 15:25:23 +0100 Subject: Added better handling of title changes Added more trace output --- xmltv2vdr.cpp | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'xmltv2vdr.cpp') diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp index 597f9e7..b9eb456 100644 --- a/xmltv2vdr.cpp +++ b/xmltv2vdr.cpp @@ -320,10 +320,11 @@ cGlobals::cGlobals() if (LangEnv) { char *codeset_p=strchr(LangEnv,'.'); - if (codeset_p) { + if (codeset_p) + { codeset_p++; // skip dot codeset=strdup(codeset_p); - } + } } } if (!codeset) @@ -740,6 +741,39 @@ bool cEPGHandler::HandleEvent(cEvent* Event) return false; } + if (xevent->Title() && Event->Title()) + { + bool tChanged=false; + if (strcasecmp(xevent->Title(),Event->Title())) + { + // Title maybe changed, check AltTitle if exists + if (xevent->AltTitle()) + { + if (strcasecmp(xevent->AltTitle(),Event->Title())) + { + tChanged=true; + } + } + else + { + tChanged=true; + } + + if (tChanged) + { + tsyslog("{%5i} title changed from '%s'->'%s'",Event->EventID(), + xevent->Title(),Event->Title()); + xevent->SetEITEventID(0); + tEventID oldID=Event->EventID(); + Event->SetEventID(0); + import.UpdateXMLTVEvent(source,db,Event,xevent,NULL); + Event->SetEventID(oldID); + delete xevent; + return false; + } + } + } + import.PutEvent(source,db,NULL,Event,xevent,Flags); delete xevent; return false; // let other handlers change this event -- cgit v1.2.3