summaryrefslogtreecommitdiff
path: root/import.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2012-05-19 17:57:50 +0200
committerJochen Dolze <vdr@dolze.de>2012-05-19 17:57:50 +0200
commitfba8c36e477d8b149b9ea78221f8397d04f849e5 (patch)
treebe77731c7d239af4e0b094e2578a8df8a9e57142 /import.cpp
parentb05fade925bd301abd7310d55daf33cfe7078714 (diff)
downloadvdr-plugin-xmltv2vdr-fba8c36e477d8b149b9ea78221f8397d04f849e5.tar.gz
vdr-plugin-xmltv2vdr-fba8c36e477d8b149b9ea78221f8397d04f849e5.tar.bz2
Changed search algo for existing events (max. difftime 780s)
Improved log output
Diffstat (limited to 'import.cpp')
-rw-r--r--import.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/import.cpp b/import.cpp
index 90a6dc9..4791ec1 100644
--- a/import.cpp
+++ b/import.cpp
@@ -90,16 +90,24 @@ cEvent *cImport::SearchVDREvent(cEPGSource *source, cSchedule* schedule, cXMLTVE
// try to find an event,
// 1st with our own EventID
if (xevent->EITEventID()) f=(cEvent *) schedule->GetEvent(xevent->EITEventID());
- if (f) return f;
+ if (f)
+ {
+ return f;
+ }
if (xevent->EventID() && append) f=(cEvent *) schedule->GetEvent(xevent->EventID());
- if (f) return f;
+ if (f)
+ {
+ return f;
+ }
+
+ const char *cxTitle=conv->Convert(xevent->Title());
// 2nd with StartTime
f=(cEvent *) schedule->GetEvent((tEventID) 0,xevent->StartTime());
if (f)
{
- if (!strcmp(f->Title(),conv->Convert(xevent->Title())))
+ if (!strcmp(f->Title(),cxTitle))
{
return f;
}
@@ -108,7 +116,8 @@ cEvent *cImport::SearchVDREvent(cEPGSource *source, cSchedule* schedule, cXMLTVE
int maxdiff=INT_MAX;
int eventTimeDiff=0;
if (xevent->Duration()) eventTimeDiff=xevent->Duration()/4;
- if (eventTimeDiff<780) eventTimeDiff=780;
+ if (eventTimeDiff<100) eventTimeDiff=100;
+ if (eventTimeDiff>780) eventTimeDiff=780;
for (cEvent *p = schedule->Events()->First(); p; p = schedule->Events()->Next(p))
{
@@ -116,7 +125,7 @@ cEvent *cImport::SearchVDREvent(cEPGSource *source, cSchedule* schedule, cXMLTVE
if (diff<=eventTimeDiff)
{
// found event with exact the same title
- if (!strcmp(p->Title(),conv->Convert(xevent->Title())))
+ if (!strcmp(p->Title(),cxTitle))
{
if (diff<=maxdiff)
{
@@ -136,7 +145,7 @@ cEvent *cImport::SearchVDREvent(cEPGSource *source, cSchedule* schedule, cXMLTVE
// 0x20,0x30-0x39,0x41-0x5A,0x61-0x7A
int wfound=0;
char *s1=RemoveNonASCII(p->Title());
- char *s2=RemoveNonASCII(conv->Convert(xevent->Title()));
+ char *s2=RemoveNonASCII(cxTitle);
if (s1 && s2)
{
if (!strcmp(s1,s2))
@@ -170,7 +179,7 @@ cEvent *cImport::SearchVDREvent(cEPGSource *source, cSchedule* schedule, cXMLTVE
if (diff<=maxdiff)
{
if (!WasChanged(p))
- tsyslogs(source,"found '%s' for '%s'",p->Title(),conv->Convert(xevent->Title()));
+ tsyslogs(source,"found '%s' for '%s'",p->Title(),cxTitle);
f=p;
maxdiff=diff;
}