summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2012-06-18 22:10:01 +0200
committerJochen Dolze <vdr@dolze.de>2012-06-18 22:10:01 +0200
commit529b82d09b0eb4395ed194075ac38a298c834e47 (patch)
tree12069e142ec21a3a3d07f2dd828a6129c6e4dca7
parent3b4ec4e7f4b33eb5738481c6b8f577179d4275e3 (diff)
downloadvdr-plugin-xmltv2vdr-529b82d09b0eb4395ed194075ac38a298c834e47.tar.gz
vdr-plugin-xmltv2vdr-529b82d09b0eb4395ed194075ac38a298c834e47.tar.bz2
Add values from episode-num field
Small bugfixes on several places
-rw-r--r--parse.cpp56
-rw-r--r--source.h1
-rw-r--r--xmltv2vdr.cpp6
-rw-r--r--xmltv2vdr.h7
4 files changed, 65 insertions, 5 deletions
diff --git a/parse.cpp b/parse.cpp
index d4f965c..2169384 100644
--- a/parse.cpp
+++ b/parse.cpp
@@ -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")))
{
diff --git a/source.h b/source.h
index 6af848c..cee3e35 100644
--- a/source.h
+++ b/source.h
@@ -209,6 +209,7 @@ public:
void SetForceDownload()
{
forcedownload=true;
+ forceimportsrc=-1;
}
void SetForceImport(int SourceIdx)
{
diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp
index b514818..8be1334 100644
--- a/xmltv2vdr.cpp
+++ b/xmltv2vdr.cpp
@@ -229,6 +229,7 @@ cGlobals::cGlobals()
wakeup=false;
epghandler=NULL;
epgtimer=NULL;
+ epgseasonepisode=NULL;
epall=0;
epgsearchexists=(cPluginManager::GetPlugin("epgsearch")!=NULL);
order=strdup(GetDefaultOrder());
@@ -293,6 +294,11 @@ cGlobals::~cGlobals()
epgtimer->Stop();
delete epgtimer;
}
+ if (epgseasonepisode)
+ {
+ epgseasonepisode->Stop();
+ delete epgseasonepisode;
+ }
epgsources.Remove();
epgmappings.Remove();
textmappings.Remove();
diff --git a/xmltv2vdr.h b/xmltv2vdr.h
index 4da19f9..3644969 100644
--- a/xmltv2vdr.h
+++ b/xmltv2vdr.h
@@ -270,6 +270,13 @@ public:
{
epall=Value;
if (epghandler) epghandler->SetEPAll(Value);
+ if (!epgtimer)
+ {
+ if (Value!=0)
+ {
+ AllocateEPGTimerThread();
+ }
+ }
if (epgtimer) epgtimer->SetEPAll(Value);
}
int EPAll()