summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2011-06-30 17:31:49 +0200
committerJochen Dolze <vdr@dolze.de>2011-06-30 17:31:49 +0200
commitc2a87a3ebfa0f904aad1e5cba2ca31eb13d06395 (patch)
tree6da0f02bab73f99eed923d6031cb19c868eaa627
parentf9949593c25ae2d7e71f01f7a9ca80dccd2ef096 (diff)
downloadvdr-plugin-xmltv2vdr-c2a87a3ebfa0f904aad1e5cba2ca31eb13d06395.tar.gz
vdr-plugin-xmltv2vdr-c2a87a3ebfa0f904aad1e5cba2ca31eb13d06395.tar.bz2
Added changes recommended by iNOB
-rw-r--r--maps.cpp1
-rw-r--r--maps.h4
-rw-r--r--parse.cpp168
-rw-r--r--parse.h23
-rw-r--r--po/de_DE.po19
-rw-r--r--po/it_IT.po23
-rw-r--r--setup.cpp10
-rw-r--r--setup.h2
8 files changed, 118 insertions, 132 deletions
diff --git a/maps.cpp b/maps.cpp
index 8963af5..884a23f 100644
--- a/maps.cpp
+++ b/maps.cpp
@@ -74,7 +74,6 @@ cEPGMapping::~cEPGMapping()
cEPGMapping::cEPGMapping(cEPGMapping&copy)
{
- if (channelname) free((void *) channelname);
channelname=strdup(copy.channelname);
channelids=NULL;
numchannelids=0;
diff --git a/maps.h b/maps.h
index 4249a9d..989a945 100644
--- a/maps.h
+++ b/maps.h
@@ -31,9 +31,9 @@
#define USE_AUDIO 0x200
#define CREDITS_ACTORS 0x100000
-#define CREDITS_DIRECTOR 0x200000
+#define CREDITS_DIRECTORS 0x200000
#define CREDITS_OTHERS 0x400000
-#define CREDITS_ACTORS_LIST 0x800000
+#define CREDITS_LIST 0x800000
#define OPT_MERGELTEXT 0x10000000
#define OPT_VPS 0x20000000
diff --git a/parse.cpp b/parse.cpp
index 0bb0813..e197de8 100644
--- a/parse.cpp
+++ b/parse.cpp
@@ -46,10 +46,19 @@ void cXMLTVEvent::SetDescription(const char *Description)
}
}
+bool cXMLTVEvent::RemoveLastCharFromDescription()
+{
+ if (!description) return false;
+ int len=strlen(description);
+ if (!len) return true;
+ description[len-1]=0;
+ return true;
+}
+
bool cXMLTVEvent::Add2Description(const char *Value)
{
description = strcatrealloc(description,Value);
- return (description);
+ return (description!=NULL);
}
@@ -59,7 +68,7 @@ bool cXMLTVEvent::Add2Description(const char *Name, const char *Value)
description = strcatrealloc(description,": ");
description = strcatrealloc(description,Value);
description = strcatrealloc(description,"\n");
- return (description);
+ return (description!=NULL);
}
bool cXMLTVEvent::Add2Description(const char *Name, int Value)
@@ -71,7 +80,7 @@ bool cXMLTVEvent::Add2Description(const char *Name, int Value)
description = strcatrealloc(description,value);
description = strcatrealloc(description,"\n");
free(value);
- return (description);
+ return (description!=NULL);
}
void cXMLTVEvent::SetCountry(const char *Country)
@@ -95,31 +104,20 @@ void cXMLTVEvent::SetRating(const char *System, const char *Rating)
if (rating) rating=compactspace(rating);
}
-void cXMLTVEvent::SetDirector(const char *Director)
-{
- director=strcpyrealloc(director,Director);
- if (director) director=compactspace(director);
-}
-void cXMLTVEvent::AddActor(const char *Actor, const char *ActorRole)
+void cXMLTVEvent::AddCredits(const char *CreditType, const char *Credit, const char *Addendum)
{
- if (ActorRole)
+ char *value=NULL;
+ if (Addendum)
{
- char *value=NULL;
- if (asprintf(&value,"%s (%s)",Actor,ActorRole)==-1) return;
- actors.Append(value);
+ if (asprintf(&value,"%s|%s (%s)",CreditType,Credit,Addendum)==-1) return;
}
else
{
- actors.Append(strdup(Actor));
+ if (asprintf(&value,"%s|%s",CreditType,Credit)==-1) return;
}
-}
-
-void cXMLTVEvent::AddOther(const char *OtherType, const char *Other)
-{
- char *value=NULL;
- if (asprintf(&value,"%s|%s",OtherType,Other)==-1) return;
- others.Append(value);
+ credits.Append(value);
+ credits.Sort();
}
void cXMLTVEvent::Clear()
@@ -164,18 +162,12 @@ void cXMLTVEvent::Clear()
free(origtitle);
origtitle=NULL;
}
- if (director)
- {
- free(director);
- director=NULL;
- }
year=0;
starttime = 0;
duration = 0;
vps= (time_t) 0;
eventid=0;
- actors.Clear();
- others.Clear();
+ credits.Clear();
}
cXMLTVEvent::cXMLTVEvent()
@@ -188,7 +180,6 @@ cXMLTVEvent::cXMLTVEvent()
review=NULL;
rating=NULL;
origtitle=NULL;
- director=NULL;
Clear();
}
@@ -490,67 +481,63 @@ bool cParse::PutEvent(cSchedule* schedule, cEvent *event, cXMLTVEvent *xevent, c
bool addExt=false;
if ((map->Flags() & USE_CREDITS)==USE_CREDITS)
{
- cStringList *actors=xevent->Actors();
- cStringList *others=xevent->Others();
-
- if ((map->Flags() & CREDITS_ACTORS)==CREDITS_ACTORS)
- {
- if ((map->Flags() & CREDITS_ACTORS_LIST)==CREDITS_ACTORS_LIST)
- {
- if (actors->Size())
- {
- addExt=xevent->Add2Description(tr("With"));
- addExt=xevent->Add2Description(" ");
- }
- for (int i=0; i<actors->Size(); i++)
- {
- addExt=xevent->Add2Description((*actors)[i]);
- if (i<actors->Size()-1) addExt=xevent->Add2Description(",");
- }
- if (actors->Size()) addExt=xevent->Add2Description("\n");
- }
- else
- {
- cTEXTMapping *text=TEXTMapping("actor");
- if (text)
- {
- for (int i=0; i<actors->Size(); i++)
- {
- addExt=xevent->Add2Description(text->Value(),(*actors)[i]);
- }
- }
- }
- }
-
- if ((map->Flags() & CREDITS_OTHERS)==CREDITS_OTHERS)
+ cStringList *credits=xevent->Credits();
+ if (credits->Size())
{
- for (int i=0; i<others->Size(); i++)
+ cTEXTMapping *oldtext=NULL;
+ for (int i=0; i<credits->Size(); i++)
{
- char *val=strdup((*others)[i]);
- if (val)
+ char *ctype=strdup((*credits)[i]);
+ if (ctype)
{
- char *oth=strchr(val,'|');
- if (oth)
+ char *cval=strchr(ctype,'|');
+ if (cval)
{
- *oth=0;
- oth++;
- cTEXTMapping *text=TEXTMapping(val);
- if (text)
+ *cval=0;
+ cval++;
+ bool add=true;
+ if (((map->Flags() & CREDITS_ACTORS)!=CREDITS_ACTORS) &&
+ (!strcasecmp(ctype,"actor"))) add=false;
+ if (((map->Flags() & CREDITS_DIRECTORS)!=CREDITS_DIRECTORS) &&
+ (!strcasecmp(ctype,"director"))) add=false;
+ if (((map->Flags() & CREDITS_OTHERS)!=CREDITS_OTHERS) && (add)) add=false;
+ if (add)
{
- addExt=xevent->Add2Description(text->Value(),oth);
+ cTEXTMapping *text=TEXTMapping(ctype);
+ if ((map->Flags() & CREDITS_LIST)==CREDITS_LIST)
+ {
+ if (oldtext!=text)
+ {
+ if (oldtext)
+ {
+ addExt=xevent->RemoveLastCharFromDescription();
+ addExt=xevent->RemoveLastCharFromDescription();
+ addExt=xevent->Add2Description("\n");
+ }
+ addExt=xevent->Add2Description(text->Value());
+ addExt=xevent->Add2Description(": ");
+ }
+ addExt=xevent->Add2Description(cval);
+ addExt=xevent->Add2Description(", ");
+ }
+ else
+ {
+ if (text)
+ {
+ addExt=xevent->Add2Description(text->Value(),cval);
+ }
+ }
+ oldtext=text;
}
}
- free(val);
+ free(ctype);
}
}
- }
-
- if ((map->Flags() & CREDITS_DIRECTOR)==CREDITS_DIRECTOR)
- {
- if (xevent->Director())
+ if ((oldtext) && ((map->Flags() & CREDITS_LIST)==CREDITS_LIST))
{
- cTEXTMapping *text=TEXTMapping("director");
- if (text) addExt=xevent->Add2Description(text->Value(),xevent->Director());
+ addExt=xevent->RemoveLastCharFromDescription();
+ addExt=xevent->RemoveLastCharFromDescription();
+ addExt=xevent->Add2Description("\n");
}
}
}
@@ -675,16 +662,15 @@ bool cParse::FetchEvent(xmlNodePtr enode)
xmlChar *content=xmlNodeListGetString(vnode->doc,vnode->xmlChildrenNode,1);
if (content)
{
- xevent.AddActor(conv->Convert((const char *) content));
- xmlFree(content);
- }
- }
- else if ((!xmlStrcasecmp(vnode->name, (const xmlChar *) "director")))
- {
- xmlChar *content=xmlNodeListGetString(vnode->doc,vnode->xmlChildrenNode,1);
- if (content)
- {
- xevent.SetDirector(conv->Convert((const char *) content));
+ const char *role=NULL;
+ xmlChar *arole=xmlGetProp(node,(const xmlChar *) "actor role");
+ if (arole)
+ {
+ role=strdup(conv->Convert((const char *) arole));
+ xmlFree(arole);
+ }
+ xevent.AddCredits((const char *) vnode->name,conv->Convert((const char *) content),role);
+ if (role) free((void *) role);
xmlFree(content);
}
}
@@ -693,7 +679,7 @@ bool cParse::FetchEvent(xmlNodePtr enode)
xmlChar *content=xmlNodeListGetString(vnode->doc,vnode->xmlChildrenNode,1);
if (content)
{
- xevent.AddOther((const char *) vnode->name,conv->Convert((const char *) content));
+ xevent.AddCredits((const char *) vnode->name,conv->Convert((const char *) content));
xmlFree(content);
}
}
diff --git a/parse.h b/parse.h
index 08e4500..7d597fc 100644
--- a/parse.h
+++ b/parse.h
@@ -26,14 +26,12 @@ private:
char *review;
char *rating;
char *origtitle;
- char *director;
int year;
time_t starttime;
int duration;
time_t vps;
tEventID eventid;
- cStringList actors;
- cStringList others;
+ cStringList credits;
#if VDRVERSNUM >= 10711
uchar parentalRating;
uchar contents[MaxEventContents];
@@ -41,6 +39,7 @@ private:
public:
cXMLTVEvent();
~cXMLTVEvent();
+ bool RemoveLastCharFromDescription();
bool Add2Description(const char *Name, const char *Value);
bool Add2Description(const char *Name, int Value);
bool Add2Description(const char *Value);
@@ -49,9 +48,7 @@ public:
void SetOrigTitle(const char *OrigTitle);
void SetShortText(const char *ShortText);
void SetDescription(const char *Description);
- void SetDirector(const char *Director);
- void AddActor(const char *Actor, const char *ActorRole=NULL);
- void AddOther(const char *OtherType, const char *Other);
+ void AddCredits(const char *CreditType, const char *Credit, const char *Addendum=NULL);
void SetCountry(const char *Country);
void SetReview(const char *Review);
void SetRating(const char *System, const char *Rating);
@@ -127,17 +124,9 @@ public:
{
return eventid;
}
- cStringList *Actors(void)
+ cStringList *Credits(void)
{
- return &actors;
- }
- const char *Director(void) const
- {
- return director;
- }
- cStringList *Others(void)
- {
- return &others;
+ return &credits;
}
};
@@ -158,7 +147,7 @@ class cParse
PARSE_XMLTVERR=4,
PARSE_NOMAPPING=5,
PARSE_NOCHANNELID=6,
- PARSE_EMPTYSCHEDULE=7
+ PARSE_EMPTYSCHEDULE=7
};
private:
diff --git a/po/de_DE.po b/po/de_DE.po
index 6c26bef..eb35abf 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2011-05-14 18:48+0200\n"
+"POT-Creation-Date: 2011-06-29 15:11+0200\n"
"PO-Revision-Date: 2010-12-23 23:59+0100\n"
"Last-Translator: Jochen Dolze <vdr@dolze.de>\n"
"Language-Team: <vdr@linuxtv.org>\n"
@@ -12,9 +12,6 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-msgid "With"
-msgstr "Mit"
-
msgid "options"
msgstr "Optionen"
@@ -141,15 +138,21 @@ msgstr "Kategorie"
msgid " actors"
msgstr " Darsteller"
-msgid " add in a list"
-msgstr " in einer Liste hinzufügen"
-
msgid " director"
msgstr " Regisseur"
msgid " other crew"
msgstr " Sonstige"
+msgid " output"
+msgstr " Ausgabe"
+
+msgid "singleline"
+msgstr "einzeilig"
+
+msgid "multiline"
+msgstr "mehrzeilig"
+
msgid "rating"
msgstr "Freigabe"
@@ -183,3 +186,5 @@ msgstr "xmltv2vdr plugin ist noch aktiv"
msgid "Imports xmltv epg into vdr"
msgstr "Importiert xmltv epg in den VDR"
+#~ msgid "With"
+#~ msgstr "Mit"
diff --git a/po/it_IT.po b/po/it_IT.po
index 77489f9..8c51786 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2011-06-21 20:36+0200\n"
+"POT-Creation-Date: 2011-06-29 15:11+0200\n"
"PO-Revision-Date: 2011-03-05 15:45+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: <vdr@linuxtv.org>\n"
@@ -15,9 +15,6 @@ msgstr ""
"X-Poedit-Country: ITALY\n"
"X-Poedit-SourceCharset: utf-8\n"
-msgid "With"
-msgstr "Con "
-
msgid "options"
msgstr "Opzioni"
@@ -144,15 +141,21 @@ msgstr "Categoria"
msgid " actors"
msgstr " Attore"
-msgid " add in a list"
-msgstr " aggiungi ad una lista"
-
msgid " director"
msgstr " Regia"
msgid " other crew"
msgstr " altro gruppo"
+msgid " output"
+msgstr ""
+
+msgid "singleline"
+msgstr ""
+
+msgid "multiline"
+msgstr ""
+
msgid "rating"
msgstr "Valutazione"
@@ -186,3 +189,9 @@ msgstr "Plugin XMLTV2VDR ancora in esecuzione"
msgid "Imports xmltv epg into vdr"
msgstr "Importa EPG di XMLTV in VDR"
+#~ msgid "With"
+#~ msgstr "Con "
+
+#, fuzzy
+#~ msgid " add in a list"
+#~ msgstr " aggiungi ad una lista"
diff --git a/setup.cpp b/setup.cpp
index d447c18..bf2653f 100644
--- a/setup.cpp
+++ b/setup.cpp
@@ -722,7 +722,7 @@ cMenuSetupXmltv2vdrChannelMap::cMenuSetupXmltv2vdrChannelMap(cPluginXmltv2vdr *P
flags=map->Flags();
days=map->Days();
daysmax=getdaysmax();
- c1=c2=c3=c4=cm=0;
+ c1=c2=c3=cm=0;
output();
}
@@ -812,11 +812,9 @@ void cMenuSetupXmltv2vdrChannelMap::output(void)
if ((flags & USE_CREDITS)==USE_CREDITS)
{
Add(new cMyMenuEditBitItem(tr(" actors"),&flags,CREDITS_ACTORS),true);
- c4=Current();
- if ((flags & CREDITS_ACTORS)==CREDITS_ACTORS)
- Add(new cMyMenuEditBitItem(tr(" add in a list"),&flags,CREDITS_ACTORS_LIST),true);
- Add(new cMyMenuEditBitItem(tr(" director"),&flags,CREDITS_DIRECTOR),true);
+ Add(new cMyMenuEditBitItem(tr(" director"),&flags,CREDITS_DIRECTORS),true);
Add(new cMyMenuEditBitItem(tr(" other crew"),&flags,CREDITS_OTHERS),true);
+ Add(new cMyMenuEditBitItem(tr(" output"),&flags,CREDITS_LIST,tr("singleline"),tr("multiline")),true);
}
Add(new cMyMenuEditBitItem(tr("rating"),&flags,USE_RATING),true);
@@ -868,7 +866,7 @@ eOSState cMenuSetupXmltv2vdrChannelMap::ProcessKey (eKeys Key)
case kLeft:
case kRight:
if ((Current()==c1) || (Current()==c2) ||
- (Current()==c3) || (Current()==c4)) output();
+ (Current()==c3)) output();
break;
case kDown:
if (Current()>=cm)
diff --git a/setup.h b/setup.h
index f2fa95d..6dfa156 100644
--- a/setup.h
+++ b/setup.h
@@ -108,7 +108,7 @@ private:
cOsdItem *newtitle (const char *s);
cOsdItem *option(const char *s, bool yesno);
void epgmappingreplace(cEPGMapping *newmapping);
- int c1,c2,c3,c4,cm;
+ int c1,c2,c3,cm;
public:
cMenuSetupXmltv2vdrChannelMap(cPluginXmltv2vdr *Plugin, cMenuSetupXmltv2vdr *Menu, int Index);
~cMenuSetupXmltv2vdrChannelMap();