diff options
-rw-r--r-- | README | 44 | ||||
-rw-r--r-- | maps.h | 2 | ||||
-rw-r--r-- | parse.cpp | 156 | ||||
-rw-r--r-- | parse.h | 23 | ||||
-rw-r--r-- | po/de_DE.po | 11 | ||||
-rw-r--r-- | po/it_IT.po | 187 | ||||
-rw-r--r-- | setup.cpp | 57 | ||||
-rw-r--r-- | setup.h | 11 | ||||
-rw-r--r-- | xmltv2vdr.cpp | 11 |
9 files changed, 467 insertions, 35 deletions
@@ -14,4 +14,46 @@ See the file COPYING for more information. Description: -Add epg info from epg sources into vdr +Add epg info from epg sources into vdr. xmltv2vdr just imports data in +xmltv format which must be provided by an external source (wich is not +part of this package) + +Interface for sources: + +All sources must provide a control file with a name similar to the +name of the source/source.xmltv (e.g. epgdata.xmltv -> epgdata). +In the first line you can decide if your source provides data by file +(file must be placed in /var/lib/epgsources with extension .xmltv) or +pipe (binary with the same name is called by xmltv2vdr-plugin, and +must be in the path), the second line shows the days which will be +read by the plugin, followed by the maximum days which will be provided. +The next lines are unique channelnames, provided by the source. +There can be application dependend data after each channelname. Note, +that the plugin/VDR must be able to change this control file (channels +will be marked with an asterisk if choosen in the setup). + +See this link for an list of unique channelnames (and please report +if there should be more) + +http://vdr-wiki.de/wiki/index.php/Xmltv2vdr-plugin#Kanalliste + +Examples of control files (in /var/lib/epgsources): + +pipe +1;16 +rtl.de;004 +sat1.de;005 +prosieben.de;006 + +pipe +1;10 +rtl.de +sat1.de +prosieben.de + +file +1;7 +rtl.de;004 +sat1.de;005 +nickcomedy;190:417 + @@ -32,7 +32,7 @@ #define CREDITS_ACTORS 0x100000 #define CREDITS_DIRECTOR 0x200000 -#define CREDITS_OTHER 0x400000 +#define CREDITS_OTHERS 0x400000 #define CREDITS_ACTORS_LIST 0x800000 #define OPT_MERGELTEXT 0x10000000 @@ -45,7 +45,14 @@ void cXMLTVEvent::SetDescription(const char *Description) } } -bool cXMLTVEvent::AddDescription(const char *Name, const char *Value) +bool cXMLTVEvent::Add2Description(const char *Value) +{ + description = strcatrealloc(description,Value); + return (description); +} + + +bool cXMLTVEvent::Add2Description(const char *Name, const char *Value) { description = strcatrealloc(description,Name); description = strcatrealloc(description,": "); @@ -54,7 +61,7 @@ bool cXMLTVEvent::AddDescription(const char *Name, const char *Value) return (description); } -bool cXMLTVEvent::AddDescription(const char *Name, int Value) +bool cXMLTVEvent::Add2Description(const char *Name, int Value) { char *value=NULL; if (asprintf(&value,"%i",Value)==-1) return false; @@ -87,6 +94,33 @@ void cXMLTVEvent::SetRating(const char *System, const char *Rating) rating=compactspace(rating); } +void cXMLTVEvent::SetDirector(const char *Director) +{ + director=strcpyrealloc(director,Director); + director=compactspace(director); +} + +void cXMLTVEvent::AddActor(const char *Actor, const char *ActorRole) +{ + if (ActorRole) + { + char *value=NULL; + if (asprintf(&value,"%s (%s)",Actor,ActorRole)==-1) return; + actors.Append(value); + } + else + { + actors.Append(strdup(Actor)); + } +} + +void cXMLTVEvent::AddOther(const char *OtherType, const char *Other) +{ + char *value=NULL; + if (asprintf(&value,"%s|%s",OtherType,Other)==-1) return; + others.Append(value); +} + void cXMLTVEvent::Clear() { if (title) @@ -129,6 +163,11 @@ void cXMLTVEvent::Clear() free(origtitle); origtitle=NULL; } + if (director) + { + free(director); + director=NULL; + } year=0; vps= (time_t) 0; starttime = 0; @@ -146,6 +185,7 @@ cXMLTVEvent::cXMLTVEvent() rating=NULL; review=NULL; origtitle=NULL; + director=NULL; Clear(); } @@ -319,35 +359,102 @@ bool cParse::PutEvent(cSchedule* schedule, cEvent *event, cXMLTVEvent *xevent, c xevent->SetDescription(event->Description()); } 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) + { + for (int i=0; i<others->Size(); i++) + { + char *val=strdup((*others)[i]); + if (val) + { + char *oth=strchr(val,'|'); + if (oth) + { + *oth=0; + oth++; + cTEXTMapping *text=TEXTMapping(val); + if (text) + { + addExt=xevent->Add2Description(text->Value(),oth); + free(val); + } + } + } + } + } + + if ((map->Flags() & CREDITS_DIRECTOR)==CREDITS_DIRECTOR) + { + if (xevent->Director()) + { + cTEXTMapping *text=TEXTMapping("director"); + if (text) addExt=xevent->Add2Description(text->Value(),xevent->Director()); + } + } + } + if ((map->Flags() & USE_COUNTRYDATE)==USE_COUNTRYDATE) { if (xevent->Country()) { cTEXTMapping *text=TEXTMapping("country"); - if (text) addExt=xevent->AddDescription(text->Value(),xevent->Country()); + if (text) addExt=xevent->Add2Description(text->Value(),xevent->Country()); } if (xevent->Year()) { cTEXTMapping *text=TEXTMapping("date"); - if (text) addExt=xevent->AddDescription(text->Value(),xevent->Year()); + if (text) addExt=xevent->Add2Description(text->Value(),xevent->Year()); } } if (((map->Flags() & USE_ORIGTITLE)==USE_ORIGTITLE) && (xevent->OrigTitle())) { cTEXTMapping *text; text=TEXTMapping("originaltitle"); - if (text) addExt=xevent->AddDescription(text->Value(),xevent->OrigTitle()); + if (text) addExt=xevent->Add2Description(text->Value(),xevent->OrigTitle()); } if (((map->Flags() & USE_RATING)==USE_RATING) && (xevent->Rating()) && (xevent->RatingSystem())) { - addExt=xevent->AddDescription(xevent->RatingSystem(),xevent->Rating()); + addExt=xevent->Add2Description(xevent->RatingSystem(),xevent->Rating()); } if (((map->Flags() & USE_REVIEW)==USE_REVIEW) && (xevent->Review())) { cTEXTMapping *text; text=TEXTMapping("review"); - if (text) addExt=xevent->AddDescription(text->Value(),xevent->Review()); + if (text) addExt=xevent->Add2Description(text->Value(),xevent->Review()); } if (addExt) event->SetDescription(xevent->Description()); event->SetTableID(0); // prevent EIT EPG to update this event @@ -427,6 +534,41 @@ bool cParse::FetchEvent(xmlNodePtr enode) } else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "credits"))) { + xmlNodePtr vnode=node->xmlChildrenNode; + while (vnode) + { + if (vnode->type==XML_ELEMENT_NODE) + { + if ((!xmlStrcasecmp(vnode->name, (const xmlChar *) "actor"))) + { + 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)); + xmlFree(content); + } + } + else + { + xmlChar *content=xmlNodeListGetString(vnode->doc,vnode->xmlChildrenNode,1); + if (content) + { + xevent.AddOther((const char *) vnode->name,conv->Convert((const char *) content)); + xmlFree(content); + } + } + } + vnode=vnode->next; + } } else if ((!xmlStrcasecmp(node->name, (const xmlChar *) "date"))) { @@ -31,6 +31,9 @@ private: int duration; time_t vps; tEventID eventid; + cStringList actors; + cStringList others; + char *director; #if VDRVERSNUM >= 10711 uchar parentalRating; uchar contents[MaxEventContents]; @@ -38,13 +41,17 @@ private: public: cXMLTVEvent(); ~cXMLTVEvent(); + bool Add2Description(const char *Name, const char *Value); + bool Add2Description(const char *Name, int Value); + bool Add2Description(const char *Value); void Clear(); void SetTitle(const char *Title); void SetOrigTitle(const char *OrigTitle); void SetShortText(const char *ShortText); void SetDescription(const char *Description); - bool AddDescription(const char *Name, const char *Value); - bool AddDescription(const char *Name, int Value); + void SetDirector(const char *Director); + void AddActor(const char *Actor, const char *ActorRole=NULL); + void AddOther(const char *OtherType, const char *Other); void SetCountry(const char *Country); void SetReview(const char *Review); void SetRating(const char *System, const char *Rating); @@ -120,6 +127,18 @@ public: { return eventid; } + cStringList *Actors(void) + { + return &actors; + } + const char *Director(void) const + { + return director; + } + cStringList *Others(void) + { + return &others; + } }; class cParse diff --git a/po/de_DE.po b/po/de_DE.po index 5aad20b..3f82a91 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-01-22 20:34+0100\n" +"POT-Creation-Date: 2011-02-27 17:16+0100\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,18 +12,21 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "With" +msgstr "Mit" + msgid "options" msgstr "Optionen" +msgid "update on start" +msgstr "ausführen beim Start" + msgid "automatic wakeup" msgstr "automatisch Aufwachen" msgid "execution time" msgstr "Ausführung um" -msgid "update on start" -msgstr "ausführen beim Start" - msgid "text mapping" msgstr "Textzuordnungen" diff --git a/po/it_IT.po b/po/it_IT.po new file mode 100644 index 0000000..d877226 --- /dev/null +++ b/po/it_IT.po @@ -0,0 +1,187 @@ +# This file is distributed under the same license as the xmltv2vdr package. +# +msgid "" +msgstr "" +"Project-Id-Version: vdr\n" +"Report-Msgid-Bugs-To: <see README>\n" +"POT-Creation-Date: 2011-02-27 17:20+0100\n" +"PO-Revision-Date: 2010-12-30 20:01+0100\n" +"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" +"Language-Team: <vdr@linuxtv.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Italian\n" +"X-Poedit-Country: ITALY\n" +"X-Poedit-SourceCharset: utf-8\n" + +msgid "With" +msgstr "" + +msgid "options" +msgstr "Opzioni" + +msgid "update on start" +msgstr "" + +msgid "automatic wakeup" +msgstr "Risveglio automatico" + +msgid "execution time" +msgstr "Ora esecuzione" + +msgid "text mapping" +msgstr "Mappatura testo" + +msgid "epg sources" +msgstr "Fonti EPG" + +msgid "no epgsources installed" +msgstr "Nessuna sorgente EPG installata" + +msgid "epg source channels" +msgstr "Canali sorgente EPG" + +msgid "mapped" +msgstr "Mappato" + +msgid "up" +msgstr "Su" + +msgid "down" +msgstr "Giù" + +msgid "edit" +msgstr "Modifica" + +msgid "texts" +msgstr "Testi" + +msgid "country" +msgstr "Paese" + +msgid "year" +msgstr "Anno" + +msgid "originaltitle" +msgstr "Titolo originale" + +msgid "director" +msgstr "Regista" + +msgid "actor" +msgstr "Attore" + +msgid "writer" +msgstr "Scrittore" + +msgid "adapter" +msgstr "Adattatore" + +msgid "producer" +msgstr "Produttore" + +msgid "composer" +msgstr "Compositore" + +msgid "editor" +msgstr "Editore" + +msgid "presenter" +msgstr "Presentatore" + +msgid "commentator" +msgstr "Commentatore" + +msgid "guest" +msgstr "Ospite" + +msgid "review" +msgstr "Anteprima" + +msgid "country and date" +msgstr "Paese e data" + +msgid "original title" +msgstr "Titolo originale" + +msgid "credits" +msgstr "Crediti" + +msgid "days in advance" +msgstr "Giorni in anticipo" + +msgid "channels provided" +msgstr "Canali forniti" + +msgid "selected" +msgstr "Selezionato" + +msgid "epg source channel options" +msgstr "Opzioni canali sorgente EPG" + +msgid "type of processing" +msgstr "Tipo elaborazione" + +msgid "merge" +msgstr "Unisci" + +msgid "append" +msgstr "Aggiungi" + +msgid "short text" +msgstr "Testo breve" + +msgid "long text" +msgstr "Testo completo" + +msgid " merge long texts" +msgstr " Unisci testi completi" + +msgid "category" +msgstr "Categoria" + +msgid " actors" +msgstr " Attore" + +msgid " add in a list" +msgstr "" + +msgid " director" +msgstr " Regia" + +msgid " other crew" +msgstr "" + +msgid "rating" +msgstr "Valutazione" + +msgid "video" +msgstr "Video" + +msgid "audio" +msgstr "Audio" + +msgid "vps" +msgstr "VPS" + +msgid "epg source channel mappings" +msgstr "Mappature canali sorgente EPG" + +msgid "none" +msgstr "Nessuno" + +msgid "unmap" +msgstr "Non mappare" + +msgid "map" +msgstr "Mappa" + +msgid "choose" +msgstr "Scegli" + +msgid "xmltv2vdr plugin still working" +msgstr "Plugin XMLTV2VDR ancora in esecuzione" + +msgid "Imports xmltv epg into vdr" +msgstr "" @@ -30,6 +30,26 @@ char *strcatrealloc(char *dest, const char *src) return dest; } + +// -------------------------------------------------------------------------------------------------------- + +cMyMenuEditBitItem::cMyMenuEditBitItem(const char *Name, uint *Value, uint Mask, const char *FalseString, const char *TrueString) + :cMenuEditBoolItem(Name,&(bit=0),FalseString,TrueString) +{ + value=Value; + bit=(*value & Mask)!=0; + mask=Mask; + Set(); +} + +void cMyMenuEditBitItem::Set(void) +{ + *value=bit?*value|mask:*value&~mask; + cMenuEditBoolItem::Set(); +} + +// -------------------------------------------------------------------------------------------------------- + cMenuSetupXmltv2vdr::cMenuSetupXmltv2vdr(cPluginXmltv2vdr *Plugin) { baseplugin=Plugin; @@ -47,10 +67,9 @@ void cMenuSetupXmltv2vdr::Output(void) Clear(); cOsdItem *first=newtitle(tr("options")); Add(first,true); - + Add(new cMenuEditBoolItem(tr("update on start"),&upstart),true); Add(new cMenuEditBoolItem(tr("automatic wakeup"),&wakeup),true); Add(new cMenuEditTimeItem(tr("execution time"),&exectime),true); - Add(new cMenuEditBoolItem(tr("update on start"),&upstart),true); Add(new cOsdItem(tr("text mapping")),true); mappingEntry=Current(); Add(newtitle(tr("epg sources")),true); @@ -767,16 +786,16 @@ void cMenuSetupXmltv2vdrChannelMap::output(void) Add(first,true); Add(new cMenuEditIntItem(tr("days in advance"),&days,1,daysmax),true); - Add(new cMenuEditBitItem(tr("type of processing"),&flags,OPT_APPEND,tr("merge"),tr("append")),true); + Add(new cMyMenuEditBitItem(tr("type of processing"),&flags,OPT_APPEND,tr("merge"),tr("append")),true); c1=Current(); if ((flags & OPT_APPEND)!=OPT_APPEND) { - Add(new cMenuEditBitItem(tr("short text"),&flags,USE_SHORTTEXT),true); - Add(new cMenuEditBitItem(tr("long text"),&flags,USE_LONGTEXT),true); + Add(new cMyMenuEditBitItem(tr("short text"),&flags,USE_SHORTTEXT),true); + Add(new cMyMenuEditBitItem(tr("long text"),&flags,USE_LONGTEXT),true); c2=Current(); if ((flags & USE_LONGTEXT)==USE_LONGTEXT) { - Add(new cMenuEditBitItem(tr(" merge long texts"),&flags,OPT_MERGELTEXT),true); + Add(new cMyMenuEditBitItem(tr(" merge long texts"),&flags,OPT_MERGELTEXT),true); } } else @@ -785,26 +804,26 @@ void cMenuSetupXmltv2vdrChannelMap::output(void) Add(option(tr("long text"),true),true); Add(option(tr(" merge long texts"),false),true); } - Add(new cMenuEditBitItem(tr("country and date"),&flags,USE_COUNTRYDATE),true); - Add(new cMenuEditBitItem(tr("original title"),&flags,USE_ORIGTITLE),true); - Add(new cMenuEditBitItem(tr("category"),&flags,USE_CATEGORY),true); - Add(new cMenuEditBitItem(tr("credits"),&flags,USE_CREDITS),true); + Add(new cMyMenuEditBitItem(tr("country and date"),&flags,USE_COUNTRYDATE),true); + Add(new cMyMenuEditBitItem(tr("original title"),&flags,USE_ORIGTITLE),true); + Add(new cMyMenuEditBitItem(tr("category"),&flags,USE_CATEGORY),true); + Add(new cMyMenuEditBitItem(tr("credits"),&flags,USE_CREDITS),true); c3=Current(); if ((flags & USE_CREDITS)==USE_CREDITS) { - Add(new cMenuEditBitItem(tr(" actors"),&flags,CREDITS_ACTORS),true); + Add(new cMyMenuEditBitItem(tr(" actors"),&flags,CREDITS_ACTORS),true); c4=Current(); if ((flags & CREDITS_ACTORS)==CREDITS_ACTORS) - Add(new cMenuEditBitItem(tr(" add in a list"),&flags,CREDITS_ACTORS_LIST),true); - Add(new cMenuEditBitItem(tr(" director"),&flags,CREDITS_DIRECTOR),true); - Add(new cMenuEditBitItem(tr(" other crew"),&flags,CREDITS_OTHER),true); + 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(" other crew"),&flags,CREDITS_OTHERS),true); } - Add(new cMenuEditBitItem(tr("rating"),&flags,USE_RATING),true); - Add(new cMenuEditBitItem(tr("review"),&flags,USE_REVIEW),true); - Add(new cMenuEditBitItem(tr("video"),&flags,USE_VIDEO),true); - Add(new cMenuEditBitItem(tr("audio"),&flags,USE_AUDIO),true); - Add(new cMenuEditBitItem(tr("vps"),&flags,OPT_VPS),true); + Add(new cMyMenuEditBitItem(tr("rating"),&flags,USE_RATING),true); + Add(new cMyMenuEditBitItem(tr("review"),&flags,USE_REVIEW),true); + Add(new cMyMenuEditBitItem(tr("video"),&flags,USE_VIDEO),true); + Add(new cMyMenuEditBitItem(tr("audio"),&flags,USE_AUDIO),true); + Add(new cMyMenuEditBitItem(tr("vps"),&flags,OPT_VPS),true); hasmaps=false; Add(newtitle(tr("epg source channel mappings")),true); @@ -11,6 +11,17 @@ #include <vdr/menuitems.h> #include "xmltv2vdr.h" +class cMyMenuEditBitItem : public cMenuEditBoolItem +{ +protected: + uint *value; + uint mask; + int bit; + virtual void Set(); +public: + cMyMenuEditBitItem(const char *Name, uint *Value, uint Mask, const char *FalseString=NULL, const char *TrueString=NULL); +}; + class cMenuSetupXmltv2vdr : public cMenuSetupPage { protected: diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp index 443be17..2f821a7 100644 --- a/xmltv2vdr.cpp +++ b/xmltv2vdr.cpp @@ -265,6 +265,7 @@ void cEPGSource::Store(void) umask(oldmask); if (!w) { + fclose(r); fclose(w); unlink(fname2); free(fname1); @@ -495,7 +496,15 @@ bool cPluginXmltv2vdr::Start(void) // Start any background activities the plugin shall perform. cParse::InitLibXML(); ReadInEPGSources(); - if (UpStart) exectime_t=time(NULL)+30; + if (UpStart) + { + exectime_t=time(NULL)+60; + } + else + { + exectime_t=time(NULL)-60; + last_exectime_t=exectime_t; + } return true; } |