summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2013-09-08 14:55:49 +0200
committerJochen Dolze <vdr@dolze.de>2013-09-08 14:55:49 +0200
commited15b5cc16608842cfaad297c540b29c96e0e8c7 (patch)
tree0e65e6bec012ca321b873a607af77e2b65de846f
parente9c18b37837001d3ff78a1587dc2fcca6dc378fc (diff)
downloadvdr-plugin-xmltv2vdr-ed15b5cc16608842cfaad297c540b29c96e0e8c7.tar.gz
vdr-plugin-xmltv2vdr-ed15b5cc16608842cfaad297c540b29c96e0e8c7.tar.bz2
Changed parsing of eplist files
-rw-r--r--parse.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/parse.cpp b/parse.cpp
index a41a5d4..e70b795 100644
--- a/parse.cpp
+++ b/parse.cpp
@@ -294,6 +294,8 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
char *line=NULL;
size_t length;
found=false;
+ if (EPShortText) *EPShortText=NULL;
+ size_t charlen=0;
while (getline(&line,&length,f)!=-1)
{
if (line[0]=='#') continue;
@@ -303,6 +305,8 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
char depshorttext[1024]="";
char *lf=strchr(epshorttext,'\n');
if (lf) *lf=0;
+ char *tab=strchr(epshorttext,'\t');
+ if (tab) *tab=0;
slen=strlen(epshorttext);
dlen=sizeof(depshorttext);
FromPtr=(char *) epshorttext;
@@ -314,12 +318,33 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
{
strcpy(depshorttext,epshorttext); // ok lets try with the original text
}
- if (!strncasecmp(dshorttext,depshorttext,strlen(depshorttext)))
+ if (!strcasecmp(dshorttext,depshorttext))
{
+ // exact match
+ if (EPShortText)
+ {
+ if (*EPShortText) free(*EPShortText);
+ *EPShortText=strdup(epshorttext);
+ }
found=true;
- if (EPShortText) *EPShortText=strdup(epshorttext);
break;
}
+
+ dlen=strlen(depshorttext);
+ if (!strncasecmp(dshorttext,depshorttext,dlen))
+ {
+ // not exact match -> maybe better match available?
+ if (dlen>charlen)
+ {
+ if (EPShortText)
+ {
+ if (*EPShortText) free(*EPShortText);
+ *EPShortText=strdup(epshorttext);
+ }
+ charlen=dlen;
+ found=true;
+ }
+ }
}
else
{