diff options
author | Jochen Dolze <vdr@dolze.de> | 2012-06-18 22:10:01 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2012-06-18 22:10:01 +0200 |
commit | 529b82d09b0eb4395ed194075ac38a298c834e47 (patch) | |
tree | 12069e142ec21a3a3d07f2dd828a6129c6e4dca7 /parse.cpp | |
parent | 3b4ec4e7f4b33eb5738481c6b8f577179d4275e3 (diff) | |
download | vdr-plugin-xmltv2vdr-529b82d09b0eb4395ed194075ac38a298c834e47.tar.gz vdr-plugin-xmltv2vdr-529b82d09b0eb4395ed194075ac38a298c834e47.tar.bz2 |
Add values from episode-num field
Small bugfixes on several places
Diffstat (limited to 'parse.cpp')
-rw-r--r-- | parse.cpp | 56 |
1 files changed, 51 insertions, 5 deletions
@@ -189,7 +189,7 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha int tlen=strlen(Title); if (tlen>dlen) { - if (Title[dlen+1]==32) + if (Title[dlen]==32) { found=true; break; @@ -577,13 +577,59 @@ bool cParse::FetchEvent(xmlNodePtr enode, bool useeptext) } } - else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "length"))) + else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "episode-num"))) { - // length without advertisements -> just ignore + xmlChar *system=xmlGetProp(node,(const xmlChar *) "system"); + if (system && !xmlStrcasecmp(system,(const xmlChar *) "xmltv_ns")) + { + xmlChar *content=xmlNodeListGetString(node->doc,node->xmlChildrenNode,1); + if (content) + { + // format is: season[/max_season].episode[/max_episode_in_season].part[/max_part] + // all numbers are zero based, overallepisode is not representable, + // one or two (or even three?) numbers may be omitted, e.g. '0.5.' + // means episode 6 in season 1 + char *xmltv_ns=strdup((const char *) content); + if (xmltv_ns) + { + xmltv_ns=compactspace(xmltv_ns); // get rid of spaces + if (strlen(xmltv_ns)>1) + { + if (xmltv_ns[0]=='.') + { + // no season + if (xmltv_ns[1]!='.') + { + // extract episode + int episode=atoi(xmltv_ns+1)+1; + if (episode>0) xevent.SetEpisode(episode); + } + } + else + { + // extract season + int season=atoi(xmltv_ns)+1; + if (season>0) xevent.SetSeason(season); + char *p=strchr(xmltv_ns,'.'); + if (*p) + { + p++; + // extract episode + int episode=atoi(p)+1; + if (episode>0) xevent.SetEpisode(episode); + } + } + } + free(xmltv_ns); + } + xmlFree(content); + } + } + if (system) xmlFree(system); } - else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "episode-num"))) + else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "length"))) { - // episode-num in not usable format -> just ignore + // length without advertisements -> just ignore } else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "subtitles"))) { |