diff options
author | Jochen Dolze <vdr@dolze.de> | 2013-12-03 15:25:23 +0100 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2013-12-03 15:25:23 +0100 |
commit | 8d667255bfc28b5db2a87c0e881e072e2316104a (patch) | |
tree | ebece97975f78408b55de06686b7aff60dc9fa9e | |
parent | bb3e75c4719d5eb608d8547d05d839caa3f52d66 (diff) | |
download | vdr-plugin-xmltv2vdr-8d667255bfc28b5db2a87c0e881e072e2316104a.tar.gz vdr-plugin-xmltv2vdr-8d667255bfc28b5db2a87c0e881e072e2316104a.tar.bz2 |
Added better handling of title changes
Added more trace output
-rw-r--r-- | import.cpp | 19 | ||||
-rw-r--r-- | parse.cpp | 6 | ||||
-rw-r--r-- | xmltv2vdr.cpp | 38 |
3 files changed, 56 insertions, 7 deletions
@@ -92,6 +92,10 @@ cEvent *cImport::SearchVDREventByTitle(cEPGSource *source, cSchedule* schedule, { return f; } + else + { + f=NULL; + } } // 3rd with StartTime +/- TimeDiff int maxdiff=INT_MAX; @@ -897,6 +901,7 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, const char *dp=conv->Convert(xEvent->Title()); if (!Event->Title() || strcmp(Event->Title(),dp)) { + tsyslogs(Source,"{%5i} changing title from '%s' to '%s'",Event->EventID(),Event->Title(),dp); Event->SetTitle(dp); changed|=CHANGED_TITLE; // title really changed } @@ -910,6 +915,7 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, const char *dp=conv->Convert(xEvent->AltTitle()); if (!Event->Title() || strcmp(Event->Title(),dp)) { + tsyslogs(Source,"{%5i} changing title from '%s' to '%s'",Event->EventID(),Event->Title(),dp); Event->SetTitle(dp); changed|=CHANGED_TITLE; // title really changed } @@ -922,7 +928,7 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, { if (!strcasecmp(xEvent->ShortText(),Event->Title())) { - tsyslogs(Source,"title and subtitle equal, clearing subtitle"); + tsyslogs(Source,"{%5i} title and subtitle equal, clearing subtitle",Event->EventID()); Event->SetShortText(NULL); } else @@ -1093,7 +1099,7 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule, int len=strlen(buf); if (len>0) buf[len-1]=0; - tsyslogs(Source,"{%5i} changing %s of '%s'/'%s'@%s-%s",Event->EventID(), + tsyslogs(Source,"{%5i} changed %s of '%s'/'%s'@%s-%s",Event->EventID(), buf,Event->Title(),Event->ShortText() ? Event->ShortText() : "", from,till); } @@ -1373,7 +1379,7 @@ bool cImport::UpdateXMLTVEvent(cEPGSource *Source, sqlite3 *Db, const cEvent *Ev if (!xEvent) return false; // prevent unnecessary updates - if (!Description && (xEvent->EITEventID()==Event->EventID())) return false; + if (!Description && Event->EventID() && (xEvent->EITEventID()==Event->EventID())) return false; if (Description) { @@ -1442,8 +1448,11 @@ bool cImport::UpdateXMLTVEvent(cEPGSource *Source, sqlite3 *Db, const cEvent *Ev strcat(buf,"eiteventid"); } - tsyslogs(Source,"{%5i} updating %s of '%s' in db",Event->EventID(),buf, - Event->Title()); + if (Event->EventID()) + { + tsyslogs(Source,"{%5i} updating %s of '%s' in db",Event->EventID(),buf, + Event->Title()); + } } char *errmsg; @@ -109,6 +109,12 @@ void cParse::RemoveNonAlphaNumeric(char *String) memmove(p,p+6,len-6); } + len=strlen(String); + p=String; + // cut off " Folge XX" + p=strstr(String," Folge "); + if (p) *p=0; + // remove non alphanumeric characters len=strlen(String); p=String; 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 |