summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2012-08-09 22:47:54 +0200
committerJochen Dolze <vdr@dolze.de>2012-08-09 22:47:54 +0200
commitdab5ddc6d04a3f26ca3552aebb051f4d437a7434 (patch)
treefb8185ac5a98e790d77fb65c6480edbbb2041af3
parent13ef0038c75ec2a0e81712ee0cb2fae65c272da8 (diff)
downloadvdr-plugin-xmltv2vdr-dab5ddc6d04a3f26ca3552aebb051f4d437a7434.tar.gz
vdr-plugin-xmltv2vdr-dab5ddc6d04a3f26ca3552aebb051f4d437a7434.tar.bz2
Added check for soundex function
-rw-r--r--import.cpp38
-rw-r--r--xmltv2vdr.cpp2
-rw-r--r--xmltv2vdr.h9
3 files changed, 31 insertions, 18 deletions
diff --git a/import.cpp b/import.cpp
index de5d2a7..672e924 100644
--- a/import.cpp
+++ b/import.cpp
@@ -1411,27 +1411,29 @@ cXMLTVEvent *cImport::SearchXMLTVEvent(sqlite3 **Db,const char *ChannelID, const
xevent=PrepareAndReturn(Db,sql);
if (xevent) return xevent;
- char wstr[128];
- if (SoundEx((char *) &wstr,(char *) Event->Title(),0,1)==0)
+ if (g->SoundEx())
{
- esyslog("soundex of '%s' failed",Event->Title());
- return NULL;
- }
-
- if (asprintf(&sql,"select channelid,eventid,starttime,duration,title,origtitle,shorttext,description," \
- "country,year,credits,category,review,rating,starrating,video,audio,season,episode," \
- "episodeoverall,pics,src,eiteventid,eitdescription,alttitle,abs(starttime-%li) as diff from epg where " \
- " (starttime>=%li and starttime<=%li) and soundex(title)='%s' and channelid='%s' " \
- " order by diff,srcidx asc limit 1;",Event->StartTime(),Event->StartTime()-eventTimeDiff,
- Event->StartTime()+eventTimeDiff,wstr,ChannelID)==-1)
- {
- esyslog("out of memory");
- return NULL;
- }
+ char wstr[128];
+ if (SoundEx((char *) &wstr,(char *) Event->Title(),0,1)==0)
+ {
+ esyslog("soundex of '%s' failed",Event->Title());
+ return NULL;
+ }
- xevent=PrepareAndReturn(Db,sql);
- if (xevent) return xevent;
+ if (asprintf(&sql,"select channelid,eventid,starttime,duration,title,origtitle,shorttext,description," \
+ "country,year,credits,category,review,rating,starrating,video,audio,season,episode," \
+ "episodeoverall,pics,src,eiteventid,eitdescription,alttitle,abs(starttime-%li) as diff from epg where " \
+ " (starttime>=%li and starttime<=%li) and soundex(title)='%s' and channelid='%s' " \
+ " order by diff,srcidx asc limit 1;",Event->StartTime(),Event->StartTime()-eventTimeDiff,
+ Event->StartTime()+eventTimeDiff,wstr,ChannelID)==-1)
+ {
+ esyslog("out of memory");
+ return NULL;
+ }
+ xevent=PrepareAndReturn(Db,sql);
+ if (xevent) return xevent;
+ }
return NULL;
}
diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp
index b0e3b7e..69ace7e 100644
--- a/xmltv2vdr.cpp
+++ b/xmltv2vdr.cpp
@@ -268,6 +268,7 @@ cGlobals::cGlobals()
epall=0;
order=strdup(GetDefaultOrder());
imgdelafter=30;
+ soundex=false;
if (asprintf(&epgfile,"%s/epg.db",VideoDirectory)==-1) {};
if (asprintf(&imgdir,"%s","/var/cache/vdr/epgimages")==-1) {};
@@ -826,6 +827,7 @@ void cPluginXmltv2vdr::GetSqliteCompileOptions()
{
const char *option=(const char *) sqlite3_column_text(stmt,0);
tsyslog("option %s",option);
+ if (!strncasecmp(option,"SOUNDEX",7)) g.SetSoundEx();
}
else
{
diff --git a/xmltv2vdr.h b/xmltv2vdr.h
index 72702d9..1570d0c 100644
--- a/xmltv2vdr.h
+++ b/xmltv2vdr.h
@@ -176,6 +176,7 @@ private:
int epall;
int imgdelafter;
bool wakeup;
+ bool soundex;
cEPGMappings epgmappings;
cTEXTMappings textmappings;
cEPGSources epgsources;
@@ -302,6 +303,14 @@ public:
{
return wakeup;
}
+ void SetSoundEx()
+ {
+ soundex=true;
+ }
+ bool SoundEx()
+ {
+ return soundex;
+ }
};
class cPluginXmltv2vdr : public cPlugin