diff options
author | Jochen Dolze <vdr@dolze.de> | 2009-01-30 00:14:56 +0100 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2009-01-30 00:14:56 +0100 |
commit | 54a468314486b9c5e9ea34d36791873d54fb8365 (patch) | |
tree | 6bd9b2fa8a6f2a7afacc9acd7156281e7057f0c9 | |
parent | 6fb31a9477d93e019b0a2b4ef8457288ab0a40f4 (diff) | |
download | vdr-plugin-infosatepg-54a468314486b9c5e9ea34d36791873d54fb8365.tar.gz vdr-plugin-infosatepg-54a468314486b9c5e9ea34d36791873d54fb8365.tar.bz2 |
Added extened EPG
New setup for channels
-rw-r--r-- | global.cpp | 21 | ||||
-rw-r--r-- | global.h | 53 | ||||
-rw-r--r-- | infosatepg.cpp | 3 | ||||
-rw-r--r-- | po/de_DE.po | 27 | ||||
-rw-r--r-- | po/it_IT.po | 27 | ||||
-rw-r--r-- | process.cpp | 244 | ||||
-rw-r--r-- | process.h | 13 | ||||
-rw-r--r-- | setup.cpp | 112 | ||||
-rw-r--r-- | setup.h | 2 |
9 files changed, 294 insertions, 208 deletions
@@ -174,13 +174,16 @@ bool cGlobalInfosatepg::CheckMAC(struct ethhdr *eth_hdr) return true; } -void cGlobalInfosatepg::AddChannel(tChannelID ChannelID,int Usage) +void cGlobalInfosatepg::AddChannel(tChannelID ChannelID,int Usage,int Days) { infosatchannels= (struct infosatchannels *) realloc (infosatchannels, (numinfosatchannels+1) *sizeof (struct infosatchannels)); if (!infosatchannels) return; infosatchannels[numinfosatchannels].ChannelID=ChannelID; - infosatchannels[numinfosatchannels].Usage=Usage; + infosatchannels[numinfosatchannels].Usage=Usage & 0xFFFF; + if (Days<=0) Days=1; + if (Days>EPG_DAYS) Days=EPG_DAYS; + infosatchannels[numinfosatchannels].Days=Days; numinfosatchannels++; } @@ -220,23 +223,31 @@ bool cGlobalInfosatepg::ChannelExists(tChannelID ChannelID,int *Index) return false; } -bool cGlobalInfosatepg::SetChannelUse(int Index,int Usage) +bool cGlobalInfosatepg::SetChannelOptions(int Index,int Usage,int Days) { if (numinfosatchannels==0) return false; if ((Index<0) || (Index>numinfosatchannels-1)) return false; bool ret=false; - if (infosatchannels[Index].Usage!=Usage) ret=true; + if ((infosatchannels[Index].Usage!=Usage) | (infosatchannels[Index].Days!=Days)) ret=true; infosatchannels[Index].Usage=Usage; + infosatchannels[Index].Days=Days; return ret; } -int cGlobalInfosatepg::GetChannelUse(int Index) +int cGlobalInfosatepg::GetChannelUsage(int Index) { if (numinfosatchannels==0) return USE_NOTHING; if ((Index<0) || (Index>numinfosatchannels-1)) return USE_NOTHING; return infosatchannels[Index].Usage; } +int cGlobalInfosatepg::GetChannelDays(int Index) +{ + if (numinfosatchannels==0) return 0; + if ((Index<0) || (Index>numinfosatchannels-1)) return 0; + return infosatchannels[Index].Days; +} + int cGlobalInfosatepg::Save() { char file[1024]; @@ -16,10 +16,10 @@ #include <vdr/timers.h> #include <vdr/device.h> -#define MIN_WAITTIME 10 -#define MAX_WAITTIME 120 -#define MIN_EVENTTIMEDIFF 5 -#define MAX_EVENTTIMEDIFF 10 +#define MIN_WAITTIME 10 // s +#define MAX_WAITTIME 120 // s +#define MIN_EVENTTIMEDIFF 5 // min +#define MAX_EVENTTIMEDIFF 10 // min class cGlobalInfosatdata { @@ -76,39 +76,37 @@ public: void Init (char *File, int Day, int Month, int Packetcount); int Load (int fd); int Save (int fd); -#ifdef INFOSATEPG_DEBUG - void Debug (const char *Directory); -#endif + #ifdef INFOSATEPG_DEBUG + void Debug (const char *Directory); + #endif }; class cGlobalInfosatepg { -#define USE_NOTHING 0 - - -#define USE_SHORTTEXT 1 -#define USE_SHORTLONGTEXT 2 -#define USE_SHORTTEXTEPG 3 -#define USE_INTELLIGENT 4 -#define USE_ALL 5 + // Usage field definition + // Bit 0-15 USE_ flags + // Bit 16-19 DAYS in advance + // Bit 20-30 reserved for future used + // Bit 31 always zero - /* - #define USE_NOTHING 0 #define USE_SHORTTEXT 1 #define USE_LONGTEXT 2 #define USE_EXTEPG 4 - #define - */ + #define USE_MERGELONGTEXT 8 + #define USE_APPEND 16 + + #define USE_NOTHING 0 struct infosatchannels { tChannelID ChannelID; + int Days; int Usage; }; -#define EPG_FIRST_DAY_MAC 1 -#define EPG_LAST_DAY_MAC 7 -#define EPG_DAYS 7 + #define EPG_FIRST_DAY_MAC 1 + #define EPG_LAST_DAY_MAC 7 + #define EPG_DAYS 7 private: const char *directory; @@ -169,18 +167,21 @@ public: } int Load(); int Save(); + bool ProcessedAll; + void ResetProcessed (void); bool ReceivedAll (int *Day, int *Month); bool ReceivedAll() { return ReceivedAll (NULL,NULL); } - void AddChannel (tChannelID ChannelID,int Usage); + + void AddChannel (tChannelID ChannelID,int Usage, int Days); void RemoveChannel(int Index); tChannelID GetChannelID (int Index); - bool SetChannelUse (int Index,int Usage); - void ResetProcessed (void); - int GetChannelUse (int Index); + bool SetChannelOptions(int Index,int Usage,int Days); + int GetChannelUsage(int Index); + int GetChannelDays(int Index); bool ChannelExists (tChannelID ChannelID,int *Index); int InfosatChannels() { diff --git a/infosatepg.cpp b/infosatepg.cpp index 47c7da7..46ed9d3 100644 --- a/infosatepg.cpp +++ b/infosatepg.cpp @@ -255,7 +255,8 @@ bool cPluginInfosatepg::SetupParse(const char *Name, const char *Value) if (strlen(Name)<10) return false; tChannelID ChannelID=tChannelID::FromString(&Name[8]); if (ChannelID==tChannelID::InvalidID) return false; - global->AddChannel(ChannelID,atoi(Value)); + int val=atoi(Value); + global->AddChannel(ChannelID,(val & 0xFFFF),(val & 0xF0000)>>16); } else return false; return true; diff --git a/po/de_DE.po b/po/de_DE.po index cbaf0dc..40cca4e 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-1.6.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2009-01-02 01:28+0100\n" +"POT-Creation-Date: 2009-01-20 23:36+0100\n" "PO-Revision-Date: 2008-05-02 16:20+0200\n" "Last-Translator: Jochen Dolze <infosatepg@dolze.de>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -42,23 +42,26 @@ msgstr "Zeitdifferenz [min]" msgid "Infosat channels" msgstr "Infosat Kanäle" -msgid "no" -msgstr "nein" +msgid "used" +msgstr "ausgewählt" -msgid "short text" +msgid "Days in advance" +msgstr "Anzahl Tage" + +msgid "Short text" msgstr "Kurztext" -msgid "short/long text" -msgstr "Kurz-/Langtext" +msgid "Long text" +msgstr "Langtext" -msgid "short text/extEPG" -msgstr "Kurztext/erwEPG" +msgid "Merge long texts" +msgstr "Langtexte zusammenführen" -msgid "intelligent" -msgstr "intelligent" +msgid "Extended EPG" +msgstr "Erweiterte EPG Infos" -msgid "complete" -msgstr "komplett" +msgid "Append non existing events" +msgstr "Erstelle neue Ereignisse" msgid "Read EPG info from infosat" msgstr "Liest EPG infos von Infosat" diff --git a/po/it_IT.po b/po/it_IT.po index 1974c4a..2e993e0 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-1.6.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2009-01-06 16:10+0100\n" +"POT-Creation-Date: 2009-01-20 23:36+0100\n" "PO-Revision-Date: 2008-12-24 19:16+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -44,23 +44,26 @@ msgstr "Differenza tempo [min]" msgid "Infosat channels" msgstr "Canali Infosat" -msgid "no" -msgstr "no" +msgid "used" +msgstr "uso" -msgid "short text" +msgid "Days in advance" +msgstr "" + +msgid "Short text" msgstr "testo breve" -msgid "short/long text" -msgstr "testo breve/lungo" +msgid "Long text" +msgstr "testo lungo" -msgid "short text/extEPG" -msgstr "testo breve/extEPG" +msgid "Merge long texts" +msgstr "" -msgid "intelligent" -msgstr "intelligente" +msgid "Extended EPG" +msgstr "" -msgid "complete" -msgstr "completa" +msgid "Append non existing events" +msgstr "" msgid "Read EPG info from infosat" msgstr "Legge info EPG da Infosat" diff --git a/process.cpp b/process.cpp index fde84be..e7698c4 100644 --- a/process.cpp +++ b/process.cpp @@ -14,6 +14,25 @@ #include "process.h" #include "readline.h" +char *strcatrealloc(char *dest, const char *src) +{ + if (!src || !*src) + return dest; + + size_t l = (dest ? strlen(dest) : 0) + strlen(src) + 1; + if (dest) + { + dest = (char *)realloc(dest, l); + strcat(dest, src); + } + else + { + dest = (char*)malloc(l); + strcpy(dest, src); + } + return dest; +} + // --- cInfosatevent cInfosatevent::cInfosatevent() { @@ -24,6 +43,7 @@ cInfosatevent::cInfosatevent() country=NULL; genre=NULL; original=NULL; + extepg=NULL; year=-1; fsk=-1; category=-1; @@ -40,6 +60,7 @@ cInfosatevent::~cInfosatevent() free(country); free(genre); free(original); + free(extepg); } void cInfosatevent::SetOriginal(const char *Original) @@ -77,57 +98,60 @@ void cInfosatevent::SetDescription(const char *Description) description = strcpyrealloc(description, Description); } -const char *cInfosatevent::Description(const char *oldDescription) +const char *cInfosatevent::ExtEPG(void) { - // Add Category:, Genre:, Year:, Country:, Originaltitle:, FSK: , Rating: [if available] ... - /* - char fmt[100]; - char *descr; - - if (oldDescription) { - descr=(char *) oldDescription; - char *extEPG=strstr(descr,"\n\n"); - if (extEPG) *extEPG=0; - } else { - descr=description; - } - - descr=strcatrealloc(descr,"\n\n"); - - if (category!=-1) { - descr=strcatrealloc(descr,"Category: "); - descr=strcatrealloc(descr,Category()); - descr=strcatrealloc(descr,"\n"); - } - if (genre) { - descr=strcatrealloc(descr,"Genre: "); - descr=strcatrealloc(descr,Genre()); - descr=strcatrealloc(descr,"\n"); - } - if (year!=-1) { - strncat(fmt,"Year: %i\n",9); - } - if (country) { - descr=strcatrealloc(descr,"Country: "); - descr=strcatrealloc(descr,Country()); - descr=strcatrealloc(descr,"\n"); - } - if (original) { - descr=strcatrealloc(descr,"Originaltitle: "); - descr=strcatrealloc(descr,Original()); - descr=strcatrealloc(descr,"\n"); - } - if (fsk!=-1) { - strncat(fmt,"FSK: %i\n",8); - } - if (announcement) { - descr=strcatrealloc(descr,"Rating: "); - descr=strcatrealloc(descr,Announcement()); - descr=strcatrealloc(descr,"\n"); - } - - */ - return (const char*) description; + // Returns Category:, Genre:, Year:, Country:, Originaltitle:, FSK: , Rating: [if available] ... + char fmt[100]; + + if (extepg) + { + free(extepg); + extepg=NULL; + } + + extepg=strcatrealloc(extepg,"\n\n"); + + if (category!=-1) + { + sprintf(fmt,"Category: %i\n",category); + extepg=strcatrealloc(extepg,fmt); + } + if (genre) + { + extepg=strcatrealloc(extepg,"Genre: "); + extepg=strcatrealloc(extepg,genre); + extepg=strcatrealloc(extepg,"\n"); + } + if (year!=-1) + { + sprintf(fmt,"Year: %i\n",year); + extepg=strcatrealloc(extepg,fmt); + } + if (country) + { + extepg=strcatrealloc(extepg,"Country: "); + extepg=strcatrealloc(extepg,country); + extepg=strcatrealloc(extepg,"\n"); + } + if (original) + { + extepg=strcatrealloc(extepg,"Originaltitle: "); + extepg=strcatrealloc(extepg,original); + extepg=strcatrealloc(extepg,"\n"); + } + if (fsk!=-1) + { + sprintf(fmt,"FSK: %i\n",fsk); + extepg=strcatrealloc(extepg,fmt); + } + if (announcement) + { + extepg=strcatrealloc(extepg,"Rating: "); + extepg=strcatrealloc(extepg,announcement); + extepg=strcatrealloc(extepg,"\n"); + } + + return (const char*) extepg; } // --- cProcessInfosatepg @@ -181,9 +205,11 @@ cEvent *cProcessInfosatepg::SearchEvent(cSchedule* Schedule, cInfosatevent *iEve bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEvent) { if ((!channel) || (!iEvent)) return true; - if (iEvent->GetEventUse()==USE_NOTHING) return true; // this should never happen! + if (iEvent->Usage()==USE_NOTHING) return true; // this should never happen! if (iEvent->StartTime()<time(NULL)) return true; // don't deal with old events - if (iEvent->StartTime()>(time(NULL)+86400)) return true; // don't deal with events to far in the future + + // don't deal with events to far in the future + if (iEvent->StartTime()>(time(NULL)+(iEvent->Days()*86400))) return true; cSchedulesLock SchedulesLock(true,2000); // to be safe ;) const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); @@ -191,13 +217,14 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven cSchedule* Schedule = (cSchedule *) Schedules->GetSchedule(channel,true); if (!Schedule) return true; - time_t start; - + time_t start=0; + cEvent *Event=NULL; const cEvent *lastEvent=Schedule->Events()->Last(); + if ((lastEvent) && (iEvent->StartTime()<lastEvent->EndTime())) { - // try to find, 1st with EventID - cEvent *Event = (cEvent *) Schedule->GetEvent(iEvent->EventID()); + // try to find, 1st with our own EventID + Event = (cEvent *) Schedule->GetEvent(iEvent->EventID()); // 2nd with StartTime +/- WaitTime if (!Event) Event= (cEvent *) SearchEvent(Schedule,iEvent); if (!Event) return true; // just bail out with ok @@ -206,50 +233,84 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven dsyslog("infosatepg: ievent %s [%s]", iEvent->Title(),ctime(&start)); // change existing event + Event->SetTableID(0); + } + else + { + // we are beyond the last event, so just add (if we should) + if ((iEvent->Usage() & USE_APPEND)!=USE_APPEND) return true; + Event = new cEvent(iEvent->EventID()); + if (!Event) return true; + Event->SetStartTime(iEvent->StartTime()); + Event->SetDuration(iEvent->Duration()); + Event->SetTitle(iEvent->Title()); + start=iEvent->StartTime(); + dsyslog("infosatepg: adding new event %s [%s]",iEvent->Title(),ctime(&start)); + Schedule->AddEvent(Event); + } + + if ((iEvent->Usage() & USE_SHORTTEXT) == USE_SHORTTEXT) + { Event->SetShortText(iEvent->ShortText()); - if (iEvent->GetEventUse()==USE_SHORTLONGTEXT) + } + + if ((iEvent->Usage() & USE_LONGTEXT) == USE_LONGTEXT) + { + if ((iEvent->Usage() & USE_MERGELONGTEXT)==USE_MERGELONGTEXT) { - Event->SetDescription(iEvent->Description(NULL)); + // first check if we have a description + const char *iDescr=iEvent->Description(); + if (iDescr) + { + const char *oDescr=Event->Description(); + if (oDescr) + { + // there is an "old" description + if (strlen(iDescr)>strlen(oDescr)) + { + // more text in infosat + Event->SetDescription(iEvent->Description()); + } + } + else + { + // event has no description, just use infosat one + Event->SetDescription(iEvent->Description()); + } + } } - if (iEvent->GetEventUse()==USE_SHORTTEXTEPG) + else { - Event->SetDescription(iEvent->Description(Event->Description())); + // just do it the easy way + Event->SetDescription(iEvent->Description()); } - if (iEvent->GetEventUse()==USE_INTELLIGENT) + } + + if ((iEvent->Usage() & USE_EXTEPG)==USE_EXTEPG) + { + const char *oDescr=Event->Description(); + const char *extEPG=iEvent->ExtEPG(); + + if (extEPG) { - if (!Event->Description() || (!iEvent->Description(NULL))) + // we have extended EPG info + if (!oDescr) { - Event->SetDescription(iEvent->Description(NULL)); + // no old description -> just use extEPG + Event->SetDescription(extEPG); } else { - if (strlen(iEvent->Description(NULL))>strlen(Event->Description())) - { - Event->SetDescription(iEvent->Description(NULL)); - } + // add extEPG to description + char *nDescr=strdup(oDescr); + + strreplace(nDescr,extEPG,""); + + nDescr=strcatrealloc(nDescr,extEPG); + Event->SetDescription(nDescr); + free(nDescr); } } - Event->SetTableID(0); - Event->SetSeen(); - start=Event->StartTime(); - dsyslog("infosatepg: changed event %s [%s]",Event->Title(),ctime(&start)); - } - else - { - // we are beyond the last event, so just add (if we should) - if (iEvent->GetEventUse()!=USE_ALL) return true; - start=iEvent->StartTime(); - cEvent *Event = new cEvent(iEvent->EventID()); - if (!Event) return true; - Event->SetTitle(iEvent->Title()); - Event->SetShortText(iEvent->ShortText()); - Event->SetDescription(iEvent->Description(NULL)); - Event->SetStartTime(iEvent->StartTime()); - Event->SetDuration(iEvent->Duration()); - Event->SetVersion(0); - start=iEvent->StartTime(); - dsyslog("infosatepg: adding new event %s [%s]",iEvent->Title(),ctime(&start)); - Schedule->AddEvent(Event); } return true; @@ -387,11 +448,11 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) Skins.QueueMessage(mtInfo,tr("Infosat channellist available")); } // Channel is not in global list->add - global->AddChannel(chan->GetChannelID(),USE_NOTHING); + global->AddChannel(chan->GetChannelID(),USE_NOTHING,1); } else { - if (global->GetChannelUse(index)!=USE_NOTHING) + if (global->GetChannelUsage(index)!=USE_NOTHING) { memset(&tm,0,sizeof(tm)); tm.tm_sec=0; @@ -455,7 +516,8 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) ievent->SetStartTime(start); ievent->SetTitle(conv->Convert(title)); free(title); - ievent->SetEventUse(global->GetChannelUse(index)); + ievent->SetEventUsage(global->GetChannelUsage(index)); + ievent->SetEventDays(global->GetChannelDays(index)); ievent->SetEventID(DoSum(ieventnr++,ievent->Title(),strlen(ievent->Title()))); } else @@ -28,6 +28,8 @@ private: int fsk; int year; int usage; + int days; + char *extepg; tEventID eventID; public: cInfosatevent(); @@ -37,18 +39,17 @@ public: void SetDescription(const char *Description); void SetStartTime(time_t StartTime) { startTime=StartTime; } void SetDuration(int Duration) { duration=Duration; } - void SetEventUse(int Usage) { usage=Usage; } + void SetEventUsage(int Usage) { usage=Usage; } + void SetEventDays(int Days) { days=Days; } void SetYear(int Year) { year=Year; } void SetEventID(tEventID EventID) { eventID=EventID; } void SetCategory(int Category) { category=Category; } void SetFSK(int FSK) { fsk=FSK; } - void SetAnnouncement(const char *Announcement); void SetCountry(const char *Country); void SetGenre(const char *Genre); void SetOriginal(const char *Original); - const char *Description(const char *oldDescription); - + const char *Description(void) const { return description; } const char *Title(void) const { return title; } const char *ShortText(void) const { return shortText; } const char *Announcement(void) const { return announcement; } @@ -60,8 +61,10 @@ public: int FSK(void) const { return fsk; } int Category(void) const { return category; } time_t StartTime(void) const { return startTime; } - int GetEventUse() { return usage; } + int Usage() { return usage; } + int Days() { return days; } tEventID EventID(void) const { return eventID; } + const char *ExtEPG(void); }; // --- cProcessInfosatepg @@ -9,78 +9,80 @@ #include "setup.h" // --- cMenuSetupInfosatepg -cMenuSetupInfosatepg::cMenuSetupInfosatepg(cGlobalInfosatepg *Global) +cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global) { global=Global; newChannel = global->Channel; newPid = global->Pid; newWaitTime = global->WaitTime; - newEventTimeDiff=(int) (global->EventTimeDiff/60); + newEventTimeDiff= (int) (global->EventTimeDiff/60); - Add(NewTitle(tr("Scan parameter"))); - cOsdItem *firstItem = new cMenuEditIntItem( tr("Channel"), &newChannel,1,Channels.MaxNumber()); - Add(firstItem); - Add(new cMenuEditIntItem( tr("Pid"), &newPid,1,8191)); - Add(NewTitle(tr("Event options"))); - Add(new cMenuEditIntItem( tr("Wait time [s]"), &newWaitTime,MIN_WAITTIME,MAX_WAITTIME)); - Add(new cMenuEditIntItem( tr("Time difference [min]"), &newEventTimeDiff, - MIN_EVENTTIMEDIFF,MAX_EVENTTIMEDIFF)); + Add (NewTitle (tr ("Scan parameter"))); + cOsdItem *firstItem = new cMenuEditIntItem (tr ("Channel"), &newChannel,1,Channels.MaxNumber()); + Add (firstItem); + Add (new cMenuEditIntItem (tr ("Pid"), &newPid,1,8191)); + Add (NewTitle (tr ("Event options"))); + Add (new cMenuEditIntItem (tr ("Wait time [s]"), &newWaitTime,MIN_WAITTIME,MAX_WAITTIME)); + Add (new cMenuEditIntItem (tr ("Time difference [min]"), &newEventTimeDiff, + MIN_EVENTTIMEDIFF,MAX_EVENTTIMEDIFF)); if (global->InfosatChannels()) { - Add(NewTitle(tr("Infosat channels")),true); - chanCurrent=Current()+1; - SetCurrent(firstItem); + Add (NewTitle (tr ("Infosat channels")),true); + chanCurrent=Current() +1; + SetCurrent (firstItem); for (int i=0; i<global->InfosatChannels(); i++) { - cChannel *chan = Channels.GetByChannelID(global->GetChannelID(i)); + cChannel *chan = Channels.GetByChannelID (global->GetChannelID (i)); if (!chan) continue; - Add(new cOsdItem(chan->Name())); + int chanuse=global->GetChannelUsage(i); + cString buffer = cString::sprintf ("%s:\t%s",chan->Name(),chanuse ? tr ("used") : ""); + Add (new cOsdItem (buffer)); } } } -cOsdItem *cMenuSetupInfosatepg::NewTitle(const char *s) +cOsdItem *cMenuSetupInfosatepg::NewTitle (const char *s) { char *str; - asprintf(&str,"---- %s ----", s); - cOsdItem *tmp = new cOsdItem(str); - tmp->SetSelectable(false); - free(str); + asprintf (&str,"---- %s ----", s); + cOsdItem *tmp = new cOsdItem (str); + tmp->SetSelectable (false); + free (str); return tmp; } -void cMenuSetupInfosatepg::Store(void) +void cMenuSetupInfosatepg::Store (void) { bool bReprocess=false; - if (global->EventTimeDiff!=(60*newEventTimeDiff)) bReprocess=true; + if (global->EventTimeDiff!= (60*newEventTimeDiff)) bReprocess=true; - SetupStore("Channel", global->Channel = newChannel); - SetupStore("Pid", global->Pid = newPid); - SetupStore("WaitTime", global->WaitTime = newWaitTime); - SetupStore("EventTimeDiff", newEventTimeDiff); + SetupStore ("Channel", global->Channel = newChannel); + SetupStore ("Pid", global->Pid = newPid); + SetupStore ("WaitTime", global->WaitTime = newWaitTime); + SetupStore ("EventTimeDiff", newEventTimeDiff); global->EventTimeDiff = 60*newEventTimeDiff; if (bReprocess) { - dsyslog("infosatepg: reprocess files (later)"); + dsyslog ("infosatepg: reprocess files (later)"); global->ResetProcessed(); } } eOSState cMenuSetupInfosatepg::Edit() { - if (HasSubMenu() || Count()==0) + if (HasSubMenu() || Count() ==0) return osUnknown; - if (Current()>=chanCurrent) + if (Current() >=chanCurrent) { int chanIndex=Current()-chanCurrent; if (chanIndex<global->InfosatChannels()) - return AddSubMenu(new cMenuSetupChannelMenu(global,chanIndex)); + return AddSubMenu (new cMenuSetupChannelMenu (global,chanIndex)); else return osUnknown; } @@ -88,9 +90,9 @@ eOSState cMenuSetupInfosatepg::Edit() return osUnknown; } -eOSState cMenuSetupInfosatepg::ProcessKey(eKeys Key) +eOSState cMenuSetupInfosatepg::ProcessKey (eKeys Key) { - eOSState state = cOsdMenu::ProcessKey(Key); + eOSState state = cOsdMenu::ProcessKey (Key); switch (state) { @@ -100,7 +102,7 @@ eOSState cMenuSetupInfosatepg::ProcessKey(eKeys Key) switch (Key) { case kOk: - state=Edit(); + state=Edit(); if (state==osUnknown) { Store(); @@ -115,50 +117,50 @@ eOSState cMenuSetupInfosatepg::ProcessKey(eKeys Key) return state; } -cMenuSetupChannelMenu::cMenuSetupChannelMenu(cGlobalInfosatepg *Global, int Index) +cMenuSetupChannelMenu::cMenuSetupChannelMenu (cGlobalInfosatepg *Global, int Index) { - SetPlugin(cPluginManager::GetPlugin(PLUGIN_NAME_I18N)); + SetPlugin (cPluginManager::GetPlugin (PLUGIN_NAME_I18N)); global=Global; index=Index; - ChannelUseText[0]=tr("no"); - ChannelUseText[1]=tr("short text"); - ChannelUseText[2]=tr("short/long text"); - ChannelUseText[3]=tr("short text/extEPG"); - ChannelUseText[4]=tr("intelligent"); - ChannelUseText[5]=tr("complete"); - - newChannelUse=global->GetChannelUse(index); + newChannelUse=global->GetChannelUsage(index); if (newChannelUse<0) newChannelUse=USE_NOTHING; // to be safe! + newDays=global->GetChannelDays(index); + if (newDays<=0) newDays=1; - channel = Channels.GetByChannelID(global->GetChannelID(index)); + channel = Channels.GetByChannelID (global->GetChannelID (index)); if (!channel) return; char *str; - asprintf(&str,"---- %s ----", channel->Name()); - Add(new cOsdItem(str,osUnknown,false)); - free(str); + asprintf (&str,"---- %s ----", channel->Name()); + Add (new cOsdItem (str,osUnknown,false)); + free (str); - Add(new cMenuEditStraItem("Usage",&newChannelUse, - sizeof(ChannelUseText)/sizeof(const char *),ChannelUseText)); + Add(new cMenuEditIntItem(tr("Days in advance"),&newDays,1,EPG_DAYS)); + Add(new cMenuEditBitItem(tr("Short text"),(uint *) &newChannelUse,USE_SHORTTEXT)); + Add(new cMenuEditBitItem(tr("Long text"),(uint *) &newChannelUse,USE_LONGTEXT)); + Add(new cMenuEditBitItem(tr("Merge long texts"),(uint *) &newChannelUse,USE_MERGELONGTEXT)); + Add(new cMenuEditBitItem(tr("Extended EPG"),(uint *) &newChannelUse,USE_EXTEPG)); + Add(new cMenuEditBitItem(tr("Append non existing events"),(uint *) &newChannelUse,USE_APPEND)); } -void cMenuSetupChannelMenu::Store(void) +void cMenuSetupChannelMenu::Store (void) { bool bReprocess=false; if (!channel) return; cString ChannelID = channel->GetChannelID().ToString(); char *name; - asprintf(&name,"Channel-%s",*ChannelID); + asprintf (&name,"Channel-%s",*ChannelID); if (!name) return; - if (global->SetChannelUse(index,newChannelUse)) bReprocess=true; - SetupStore(name,newChannelUse); - free(name); + if (global->SetChannelOptions(index,newChannelUse,newDays)) bReprocess=true; + int setupval=newChannelUse+(newDays<<16); + SetupStore (name,setupval); + free (name); if (bReprocess) { - dsyslog("infosatepg: reprocess files (later)"); + dsyslog ("infosatepg: reprocess files (later)"); global->ResetProcessed(); } } @@ -37,7 +37,7 @@ class cMenuSetupChannelMenu : public cMenuSetupPage { private: cGlobalInfosatepg *global; - const char * ChannelUseText[6]; + int newDays; int newChannelUse; int index; cChannel *channel; |