summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2014-03-23 16:08:53 +0100
committerJochen Dolze <vdr@dolze.de>2014-03-23 16:08:53 +0100
commit151296e1afce5284a90de2a6b4ed2d41979ca9dc (patch)
tree087f8eac52ac42423629168a35ec232d05efec34
parent15b1edfa5f0649dd83f9e98082f6a5f3be32a978 (diff)
downloadvdr-plugin-xmltv2vdr-151296e1afce5284a90de2a6b4ed2d41979ca9dc.tar.gz
vdr-plugin-xmltv2vdr-151296e1afce5284a90de2a6b4ed2d41979ca9dc.tar.bz2
Improved SxxExx handling
-rw-r--r--import.cpp40
-rw-r--r--parse.cpp95
2 files changed, 76 insertions, 59 deletions
diff --git a/import.cpp b/import.cpp
index e88ed34..c9af204 100644
--- a/import.cpp
+++ b/import.cpp
@@ -933,11 +933,22 @@ bool cImport::PutEvent(cEPGSource *Source, sqlite3 *Db, cSchedule* Schedule,
}
else
{
- const char *dp=conv->Convert(xEvent->ShortText());
- if (!Event->ShortText() || strcmp(Event->ShortText(),dp))
+ if (!strcmp(xEvent->ShortText(),"@"))
{
- Event->SetShortText(dp);
- changed|=CHANGED_SHORTTEXT; // shorttext really changed
+ if (!Event->ShortText() || strcmp(Event->ShortText(),""))
+ {
+ Event->SetShortText("");
+ changed|=CHANGED_SHORTTEXT; // shorttext really changed
+ }
+ }
+ else
+ {
+ const char *dp=conv->Convert(xEvent->ShortText());
+ if (!Event->ShortText() || strcmp(Event->ShortText(),dp))
+ {
+ Event->SetShortText(dp);
+ changed|=CHANGED_SHORTTEXT; // shorttext really changed
+ }
}
}
}
@@ -1258,14 +1269,7 @@ bool cImport::AddShortTextFromEITDescription(cXMLTVEvent *xEvent, const char *EI
if (epshorttext)
{
- if (strlen(epshorttext)>1)
- {
- xEvent->SetShortText(epshorttext);
- }
- else
- {
- xEvent->SetShortText("");
- }
+ xEvent->SetShortText(epshorttext);
free(epshorttext);
}
xEvent->SetSeason(season);
@@ -1318,17 +1322,7 @@ cXMLTVEvent *cImport::AddXMLTVEvent(cEPGSource *Source,sqlite3 *Db, const char *
if (UseEPText)
{
if (eptitle) xevent->SetAltTitle(eptitle);
- if (epshorttext)
- {
- if (strlen(epshorttext)>1)
- {
- xevent->SetShortText(epshorttext);
- }
- else
- {
- xevent->SetShortText("");
- }
- }
+ if (epshorttext) xevent->SetShortText(epshorttext);
}
else
{
diff --git a/parse.cpp b/parse.cpp
index 59f4447..82db42d 100644
--- a/parse.cpp
+++ b/parse.cpp
@@ -209,7 +209,52 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
}
}
closedir(dir);
- if (!found) return false;
+
+ int f_season=0,f_episode=0;
+ size_t slen;
+ if (ShortText)
+ {
+ slen=strlen(ShortText);
+ if ((slen<=7) && (ShortText[0]=='S') && (isdigit(ShortText[1])!=0) &&
+ (isdigit(ShortText[2])!=0) && (ShortText[3]=='E') && (isdigit(ShortText[4])!=0) &&
+ (isdigit(ShortText[5])!=0))
+ {
+ // special SxxExx-Format
+ char buf[5];
+ buf[0]=ShortText[1];
+ buf[1]=ShortText[2];
+ buf[2]=0;
+ f_season=atoi(buf);
+ buf[0]=ShortText[4];
+ buf[1]=ShortText[5];
+ if (slen==7)
+ {
+ buf[2]=ShortText[6];
+ buf[3]=0;
+ }
+ else
+ {
+ buf[2]=0;
+ }
+ f_episode=atoi(buf);
+ }
+ }
+
+ if (!found)
+ {
+ if ((f_season>0) && (f_episode>0))
+ {
+ if (EPShortText)
+ {
+ if (*EPShortText) free(*EPShortText);
+ *EPShortText=strdup("@");
+ }
+ Season=f_season;
+ Episode=f_episode;
+ return true;
+ }
+ return false;
+ }
char *epfile=NULL;
if (asprintf(&epfile,"%s/%s.episodes",EPDir,dirent->d_name)==-1) return false;
@@ -255,28 +300,7 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
free(epfile);
return false;
}
- int f_season=0,f_episode=0;
- size_t slen;
- if (ShortText)
- {
- slen=strlen(ShortText);
- if ((slen==6) && (ShortText[0]=='S') && (isdigit(ShortText[1])!=0) &&
- (isdigit(ShortText[2])!=0) && (ShortText[3]=='E') && (isdigit(ShortText[4])!=0) &&
- (isdigit(ShortText[5])!=0))
- {
- // special SxxExx-Format
- char buf[5];
- buf[0]=ShortText[1];
- buf[1]=ShortText[2];
- buf[2]=0;
- f_season=atoi(buf);
- buf[0]=ShortText[4];
- buf[1]=ShortText[5];
- buf[2]=0;
- f_episode=atoi(buf);
- }
- }
- else
+ if (!ShortText)
{
slen=strlen(Description);
if (slen>40) slen=40;
@@ -382,8 +406,9 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
if (EPShortText)
{
if (*EPShortText) free(*EPShortText);
- *EPShortText=strdup(" ");
+ *EPShortText=strdup("@");
}
+ isyslog("failed to find '%s' for '%s' in eplists",ShortText,Title);
}
else
{
@@ -396,7 +421,6 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
found=true;
break;
}
-
}
else
{
@@ -412,6 +436,15 @@ bool cParse::FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const cha
if ((!found) && (ShortText))
{
isyslog("failed to find '%s' for '%s' in eplists",ShortText,Title);
+ if ((f_season>0) && (f_episode>0))
+ {
+ if (EPShortText)
+ {
+ if (*EPShortText) free(*EPShortText);
+ *EPShortText=strdup("@");
+ }
+ found=true;
+ }
}
if ((found) && (!ShortText))
{
@@ -806,17 +839,7 @@ bool cParse::FetchEvent(xmlNodePtr enode, bool useeptext)
xevent.SetEpisodeOverall(episodeoverall);
if (epshorttext)
{
- if (useeptext)
- {
- if (strlen(epshorttext)>1)
- {
- xevent.SetShortText(epshorttext);
- }
- else
- {
- xevent.SetShortText("");
- }
- }
+ if (useeptext) xevent.SetShortText(epshorttext);
free(epshorttext);
}
}