diff options
author | Jochen Dolze <vdr@dolze.de> | 2012-08-09 22:47:54 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2012-08-09 22:47:54 +0200 |
commit | dab5ddc6d04a3f26ca3552aebb051f4d437a7434 (patch) | |
tree | fb8185ac5a98e790d77fb65c6480edbbb2041af3 /import.cpp | |
parent | 13ef0038c75ec2a0e81712ee0cb2fae65c272da8 (diff) | |
download | vdr-plugin-xmltv2vdr-dab5ddc6d04a3f26ca3552aebb051f4d437a7434.tar.gz vdr-plugin-xmltv2vdr-dab5ddc6d04a3f26ca3552aebb051f4d437a7434.tar.bz2 |
Added check for soundex function
Diffstat (limited to 'import.cpp')
-rw-r--r-- | import.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
@@ -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; } |