diff options
| -rw-r--r-- | maps.h | 2 | ||||
| -rw-r--r-- | parse.cpp | 62 | ||||
| -rw-r--r-- | parse.h | 6 | ||||
| -rw-r--r-- | po/de_DE.po | 11 | ||||
| -rw-r--r-- | po/it_IT.po | 8 | ||||
| -rw-r--r-- | setup.cpp | 30 | ||||
| -rw-r--r-- | setup.h | 1 | ||||
| -rw-r--r-- | xmltv2vdr.cpp | 1 | 
8 files changed, 100 insertions, 21 deletions
| @@ -23,7 +23,7 @@  #define USE_LONGTEXT           0x2  #define USE_COUNTRYDATE        0x4  #define USE_ORIGTITLE          0x8 -#define USE_CATEGORY           0x10 +#define USE_CATEGORIES         0x10  #define USE_CREDITS            0x20  #define USE_RATING             0x40  #define USE_REVIEW             0x80 @@ -104,6 +104,11 @@ void cXMLTVEvent::SetRating(const char *System, const char *Rating)      if (rating) rating=compactspace(rating);  } +void cXMLTVEvent::AddCategory(const char *Category) +{ +    categories.Append(compactspace(strdup(Category))); +    categories.Sort(); +}  void cXMLTVEvent::AddCredits(const char *CreditType, const char *Credit, const char *Addendum)  { @@ -168,6 +173,7 @@ void cXMLTVEvent::Clear()      vps= (time_t) 0;      eventid=0;      credits.Clear(); +    categories.Clear();  }  cXMLTVEvent::cXMLTVEvent() @@ -425,6 +431,25 @@ bool cParse::PutEvent(cSchedule* schedule, cEvent *event, cXMLTVEvent *xevent, c      {          if ((map->Flags() & OPT_APPEND)==OPT_APPEND)          { +            /* checking the event sequence */ +            cEvent *last=NULL; +            if (schedule->Index()) last=schedule->Events()->Last(); +            if (last) +            { +                if (xevent->StartTime()<last->StartTime()) +                { +                    esyslog("xmltv2vdr: '%s' ERROR xmltv data overlaps",name); +                    return false; +                } +                /* set duration, if it doesn't exist */ +                if (!last->Duration()) last->SetDuration((int) difftime(xevent->StartTime(),last->StartTime())); +                if (xevent->StartTime()!=last->EndTime()) +                { +                    esyslog("xmltv2vdr: '%s' detected gap of %is between events",name, +                            (int) difftime(xevent->StartTime(),last->EndTime())); +                } +            } +            /* add event */              start=xevent->StartTime();              event=new cEvent(xevent->EventID());              if (!event) return false; @@ -560,18 +585,31 @@ bool cParse::PutEvent(cSchedule* schedule, cEvent *event, cXMLTVEvent *xevent, c      }      if (((map->Flags() & USE_ORIGTITLE)==USE_ORIGTITLE) && (xevent->OrigTitle()))      { -        cTEXTMapping *text; -        text=TEXTMapping("originaltitle"); +        cTEXTMapping *text=TEXTMapping("originaltitle");          if (text) addExt=xevent->Add2Description(text->Value(),xevent->OrigTitle());      } +    if (((map->Flags() & USE_CATEGORIES)==USE_CATEGORIES) && (xevent->Categories()->Size())) +    { +        cTEXTMapping *text=TEXTMapping("category"); +        if (text) +        { +            cStringList *categories=xevent->Categories(); +            addExt=xevent->Add2Description(text->Value(),(*categories)[0]); +            for (int i=1; i<categories->Size(); i++) +            { +                // prevent duplicates +                if (strcasecmp((*categories)[i],(*categories)[i-1])) +                    addExt=xevent->Add2Description(text->Value(),(*categories)[i]); +            } +        } +    }      if (((map->Flags() & USE_RATING)==USE_RATING) && (xevent->Rating()) && (xevent->RatingSystem()))      {          addExt=xevent->Add2Description(xevent->RatingSystem(),xevent->Rating());      }      if (((map->Flags() & USE_REVIEW)==USE_REVIEW) && (xevent->Review()))      { -        cTEXTMapping *text; -        text=TEXTMapping("review"); +        cTEXTMapping *text=TEXTMapping("review");          if (text) addExt=xevent->Add2Description(text->Value(),xevent->Review());      }      if (addExt) event->SetDescription(xevent->Description()); @@ -710,6 +748,7 @@ bool cParse::FetchEvent(xmlNodePtr enode)                      }                      else                      { +                        xevent.AddCategory(conv->Convert((const char *) content));                      }                      xmlFree(content);                  } @@ -904,12 +943,15 @@ bool cParse::Process(char *buffer, int bufsize)          oldmap=map;          xmlFree(channelid); -        xmlChar *vpsstart=xmlGetProp(node,(const xmlChar *) "vps-start"); -        if (vpsstart) +        if ((map->Flags() & OPT_VPS)==OPT_VPS)          { -            time_t vps=ConvertXMLTVTime2UnixTime((char *) vpsstart); -            xevent.SetVps(vps); -            xmlFree(vpsstart); +            xmlChar *vpsstart=xmlGetProp(node,(const xmlChar *) "vps-start"); +            if (vpsstart) +            { +                time_t vps=ConvertXMLTVTime2UnixTime((char *) vpsstart); +                xevent.SetVps(vps); +                xmlFree(vpsstart); +            }          }          xevent.SetStartTime(starttime); @@ -919,7 +961,7 @@ bool cParse::Process(char *buffer, int bufsize)              node=node->next;              continue;          } -        cSchedulesLock *schedulesLock = new cSchedulesLock(true,2000); // to be safe ;) +        cSchedulesLock *schedulesLock = new cSchedulesLock(true,5000); // to be safe ;)          const cSchedules *schedules = cSchedules::Schedules(*schedulesLock);          if (!schedules)          { @@ -32,6 +32,7 @@ private:      time_t vps;      tEventID eventid;      cStringList credits; +    cStringList categories;  #if VDRVERSNUM >= 10711      uchar parentalRating;      uchar contents[MaxEventContents]; @@ -49,6 +50,7 @@ public:      void SetShortText(const char *ShortText);      void SetDescription(const char *Description);      void AddCredits(const char *CreditType, const char *Credit, const char *Addendum=NULL); +    void AddCategory(const char *Category);      void SetCountry(const char *Country);      void SetReview(const char *Review);      void SetRating(const char *System, const char *Rating); @@ -128,6 +130,10 @@ public:      {          return &credits;      } +    cStringList *Categories(void) +    { +        return &categories; +    }  };  class cParse diff --git a/po/de_DE.po b/po/de_DE.po index bfaeea9..758ee81 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-07-05 20:47+0200\n" +"POT-Creation-Date: 2011-07-06 20:45+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" @@ -93,6 +93,9 @@ msgstr "Gaststar"  msgid "review"  msgstr "Kritik" +msgid "category" +msgstr "Kategorie" +  msgid "country and date"  msgstr "Ort und Jahr" @@ -132,9 +135,6 @@ msgstr "Langtext"  msgid " merge long texts"  msgstr " Langtexte zusammenführen" -msgid "category" -msgstr "Kategorie" -  msgid " actors"  msgstr " Darsteller" @@ -186,3 +186,6 @@ msgstr "xmltv2vdr plugin ist noch aktiv"  msgid "Imports xmltv epg into vdr"  msgstr "Importiert xmltv epg in den VDR" +#, fuzzy +#~ msgid "update" +#~ msgstr "Adapter" diff --git a/po/it_IT.po b/po/it_IT.po index 32d41ac..4b9a1d7 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-07-05 20:47+0200\n" +"POT-Creation-Date: 2011-07-06 20:45+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" @@ -96,6 +96,9 @@ msgstr "Ospite"  msgid "review"  msgstr "Anteprima" +msgid "category" +msgstr "Categoria" +  msgid "country and date"  msgstr "Paese e data" @@ -135,9 +138,6 @@ msgstr "Testo completo"  msgid " merge long texts"  msgstr " Unisci testi completi" -msgid "category" -msgstr "Categoria" -  msgid " actors"  msgstr " Attore" @@ -246,7 +246,11 @@ eOSState cMenuSetupXmltv2vdr::ProcessKey (eKeys Key)                      SetHelp(NULL,NULL,NULL,tr("edit"));                  }              } -            else if (((Current()>=mappingBegin) && (Current()<=mappingEnd)) || (Current()==mappingEntry)) +            else if (Current()==mappingEntry) +            { +                SetHelp(NULL,NULL,NULL,tr("edit")); +            } +            else if ((Current()>=mappingBegin) && (Current()<=mappingEnd))              {                  SetHelp(NULL,NULL,NULL,tr("edit"));              } @@ -425,6 +429,15 @@ cMenuSetupXmltv2vdrTextMap::cMenuSetupXmltv2vdrTextMap(cPluginXmltv2vdr *Plugin)          strcpy(review,tr("review"));      } +    textmap=baseplugin->TEXTMapping("category"); +    if (textmap) +    { +        strn0cpy(review,textmap->Value(),strlen(textmap->Value())+1); +    } +    else +    { +        strcpy(review,tr("category")); +    }      Add(newtitle(tr("country and date")));      Add(new cMenuEditStrItem("country",country,sizeof(country))); @@ -433,6 +446,9 @@ cMenuSetupXmltv2vdrTextMap::cMenuSetupXmltv2vdrTextMap(cPluginXmltv2vdr *Plugin)      Add(newtitle(tr("original title")));      Add(new cMenuEditStrItem("originaltitle",originaltitle,sizeof(originaltitle))); +    Add(newtitle(tr("category"))); +    Add(new cMenuEditStrItem("category",category,sizeof(category))); +      Add(newtitle(tr("credits")));      Add(new cMenuEditStrItem("actor",actor,sizeof(actor)));      Add(new cMenuEditStrItem("guest",guest,sizeof(guest))); @@ -486,6 +502,15 @@ void cMenuSetupXmltv2vdrTextMap::Store()      {          baseplugin->TEXTMappingAdd(new cTEXTMapping("originaltitle",originaltitle));      } +    textmap=baseplugin->TEXTMapping("category"); +    if (textmap) +    { +        textmap->ChangeValue(originaltitle); +    } +    else +    { +        baseplugin->TEXTMappingAdd(new cTEXTMapping("category",originaltitle)); +    }      textmap=baseplugin->TEXTMapping("actor");      if (textmap)      { @@ -589,6 +614,7 @@ void cMenuSetupXmltv2vdrTextMap::Store()      SetupStore("textmap.country",country);      SetupStore("textmap.date",date);      SetupStore("textmap.originaltitle",originaltitle); +    SetupStore("textmap.category",category);      SetupStore("textmap.actor",actor);      SetupStore("textmap.adapter",adapter);      SetupStore("textmap.commentator",commentator); @@ -824,7 +850,7 @@ void cMenuSetupXmltv2vdrChannelMap::output(void)      }      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("category"),&flags,USE_CATEGORIES),true);      Add(new cMyMenuEditBitItem(tr("credits"),&flags,USE_CREDITS),true);      c3=Current();      if ((flags & USE_CREDITS)==USE_CREDITS) @@ -82,6 +82,7 @@ private:      char commentator[255];      char guest[255];      char review[255]; +    char category[255];      cOsdItem *newtitle (const char *s);  public:      cMenuSetupXmltv2vdrTextMap(cPluginXmltv2vdr *Plugin); diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp index e91689c..7a2a83d 100644 --- a/xmltv2vdr.cpp +++ b/xmltv2vdr.cpp @@ -496,6 +496,7 @@ cPluginXmltv2vdr::cPluginXmltv2vdr(void) : epgexecutor(&epgsources)      TEXTMappingAdd(new cTEXTMapping("country",tr("country")));      TEXTMappingAdd(new cTEXTMapping("date",tr("year")));      TEXTMappingAdd(new cTEXTMapping("originaltitle",tr("originaltitle"))); +    TEXTMappingAdd(new cTEXTMapping("category",tr("category")));      TEXTMappingAdd(new cTEXTMapping("actor",tr("actor")));      TEXTMappingAdd(new cTEXTMapping("adapter",tr("adapter")));      TEXTMappingAdd(new cTEXTMapping("commentator",tr("commentator"))); | 
