diff options
-rw-r--r-- | global.cpp | 20 | ||||
-rw-r--r-- | global.h | 9 | ||||
-rw-r--r-- | infosatepg.cpp | 13 | ||||
-rw-r--r-- | po/de_DE.po | 6 | ||||
-rw-r--r-- | po/it_IT.po | 6 | ||||
-rw-r--r-- | process.cpp | 52 | ||||
-rw-r--r-- | readline.cpp | 36 | ||||
-rw-r--r-- | setup.cpp | 17 | ||||
-rw-r--r-- | setup.h | 2 |
9 files changed, 95 insertions, 66 deletions
@@ -30,6 +30,7 @@ void cGlobalInfosatdata::Init(char *File,int Day,int Month,int Packetcount) Processed=false; receivedall=false; missed=0; + Unlocated=0; lastpkt=-1; receivedpercent=0; day=Day; @@ -57,6 +58,8 @@ int cGlobalInfosatdata::Save(int fd) if (ret!=sizeof (pktcnt)) return -1; ret=write (fd,&missed,sizeof (missed)); if (ret!=sizeof (missed)) return -1; + ret=write (fd,&Unlocated,sizeof (Unlocated)); + if (ret!=sizeof (Unlocated)) return -1; ret=write (fd,&bitfield,sizeof (bitfield)); if (ret!=sizeof (bitfield)) return -1; ret=write (fd,&file,sizeof (file)); @@ -79,8 +82,10 @@ int cGlobalInfosatdata::Load(int fd) if (ret!=sizeof (month)) return -1; ret=read (fd,&pktcnt,sizeof (pktcnt)); if (ret!=sizeof (pktcnt)) return -1; - ret=read (fd,&missed,sizeof (missed)); + ret=read (fd,&missed,sizeof (missed)); if (ret!=sizeof (missed)) return -1; + ret=read (fd,&Unlocated,sizeof (Unlocated)); + if (ret!=sizeof (Unlocated)) return -1; ret=read (fd,&bitfield,sizeof (bitfield)); if (ret!=sizeof (bitfield)) return -1; ret=read (fd,&file,sizeof (file)); @@ -95,7 +100,6 @@ int cGlobalInfosatdata::Load(int fd) Init(file,day,month,pktcnt); } } - return ret; } @@ -111,11 +115,12 @@ void cGlobalInfosatdata::Debug(const char *Directory) void cGlobalInfosatdata::CheckMissed(int ActualPacket) { - if (receivedall) return; // count missed packets while receiving - if ((ActualPacket!=(lastpkt+1)) && (lastpkt!=-1)) { - missed++; - } - lastpkt=ActualPacket; + if (receivedall) return; // count missed packets while receiving + if ((ActualPacket!=(lastpkt+1)) && (lastpkt!=-1)) + { + missed++; + } + lastpkt=ActualPacket; } bool cGlobalInfosatdata::CheckReceivedAll() @@ -152,7 +157,6 @@ cGlobalInfosatepg::cGlobalInfosatepg() Srate = 22000; Frequency = 12604; Polarization ='h'; - EventTimeDiff=480; // default 8 minutes channel=-1; MAC[0]=0x01; MAC[1]=0x00; @@ -18,8 +18,6 @@ #define MIN_WAITTIME 10 // s #define MAX_WAITTIME 120 // s -#define MIN_EVENTTIMEDIFF 5 // min -#define MAX_EVENTTIMEDIFF 10 // min class cGlobalInfosatdata { @@ -41,6 +39,7 @@ private: public: cGlobalInfosatdata(); bool Processed; + int Unlocated; // unlocated events int Missed() { return missed; @@ -55,7 +54,10 @@ public: } bool CheckReceivedAll(); void CheckMissed(int ActualPacket); - void SetLastPkt(int ActualPacket) { lastpkt = ActualPacket; } + void SetLastPkt(int ActualPacket) + { + lastpkt = ActualPacket; + } int ReceivedPercent() { return receivedpercent; @@ -154,7 +156,6 @@ public: char Polarization; int Srate; int Pid; - int EventTimeDiff; int WaitTime; const char *Directory() { diff --git a/infosatepg.cpp b/infosatepg.cpp index 2c1b974..bf1c80f 100644 --- a/infosatepg.cpp +++ b/infosatepg.cpp @@ -105,6 +105,7 @@ bool cPluginInfosatepg::Start(void) { isyslog("infosatepg: failed to load plugin status"); } + statusMonitor = new cStatusInfosatepg(global); return true; } @@ -289,7 +290,6 @@ bool cPluginInfosatepg::SetupParse(const char *Name, const char *Value) else if (!strcasecmp(Name,"NoDeferredShutdown")) global->NoDeferredShutdown=atoi(Value); else if (!strcasecmp(Name,"HideMainMenu")) global->HideMainMenu=atoi(Value); else if (!strcasecmp(Name,"WaitTime")) global->WaitTime=atoi(Value); - else if (!strcasecmp(Name,"EventTimeDiff")) global->EventTimeDiff=60*atoi(Value); else if (!strncasecmp(Name,"Channel",7)) { if (strlen(Name)<10) return false; @@ -387,9 +387,9 @@ cString cPluginInfosatepg::SVDRPCommand(const char *Command, const char *Option, } asprintf(&output,"%s\n",output); - asprintf(&output,"%s | | missed | | \n",output); - asprintf(&output,"%s Day | Date | Packets | Received %% | Processed\n",output); - asprintf(&output,"%s------+--------+---------+------------+-----------\n",output); + asprintf(&output,"%s | | missed | | | unlocated\n",output); + asprintf(&output,"%s Day | Date | Packets | Received %% | Processed | Events\n",output); + asprintf(&output,"%s------+--------+---------+------------+------------+----------\n",output); for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { @@ -402,12 +402,13 @@ cString cPluginInfosatepg::SVDRPCommand(const char *Command, const char *Option, asprintf(&output,"%s ",output); } - asprintf(&output,"%s %i | %02i.%02i. | %3i | %3i | %s\n", + asprintf(&output,"%s %i | %02i.%02i. | %3i | %3i | %s | %3i\n", output,mac,global->Infosatdata[mac].Day(), global->Infosatdata[mac].Month(), global->Infosatdata[mac].Missed(), global->Infosatdata[mac].ReceivedPercent(), - global->Infosatdata[mac].Processed ? "yes" : "no"); + global->Infosatdata[mac].Processed ? "yes" : " no", + global->Infosatdata[mac].Unlocated); } } return output; diff --git a/po/de_DE.po b/po/de_DE.po index 97d354a..aea277c 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-02-21 08:20+0100\n" +"POT-Creation-Date: 2009-03-12 13:00+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" @@ -303,9 +303,6 @@ msgstr "Ereignis Optionen" msgid "Wait time [s]" msgstr "Wartezeit [s]" -msgid "Time difference [min]" -msgstr "Zeitdifferenz [min]" - msgid "General options" msgstr "Sonstige Optionen" @@ -356,3 +353,4 @@ msgstr "Einstellungen auf alle Kanäle kopieren?" 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 0a126aa..d304a98 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-02-21 08:20+0100\n" +"POT-Creation-Date: 2009-03-12 13:00+0100\n" "PO-Revision-Date: 2009-02-17 23:15+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -306,9 +306,6 @@ msgstr "Opzioni evento" msgid "Wait time [s]" msgstr "Tempo di attesa [s]" -msgid "Time difference [min]" -msgstr "Differenza tempo [min]" - msgid "General options" msgstr "Opzioni generali" @@ -359,3 +356,4 @@ msgstr "Copiare impostazioni nei canali?" msgid "Read EPG info from infosat" msgstr "Legge info EPG da Infosat" + diff --git a/process.cpp b/process.cpp index 9e8cd9e..30b82d6 100644 --- a/process.cpp +++ b/process.cpp @@ -659,7 +659,9 @@ void cProcessInfosatepg::Action() cEvent *cProcessInfosatepg::SearchEvent(cSchedule* Schedule, cInfosatevent *iEvent) { cEvent *f=NULL; - int maxdiff=MAX_EVENTTIMEDIFF*60; + int maxdiff=INT_MAX; + int eventTimeDiff=iEvent->Duration()/5; + if (eventTimeDiff<600) eventTimeDiff=600; for (cEvent *p = Schedule->Events()->First(); p; p = Schedule->Events()->Next(p)) { @@ -667,7 +669,7 @@ cEvent *cProcessInfosatepg::SearchEvent(cSchedule* Schedule, cInfosatevent *iEve { // found event with same title int diff=abs((int) difftime(p->StartTime(),iEvent->StartTime())); - if (diff<=global->EventTimeDiff) + if (diff<=eventTimeDiff) { if (diff<=maxdiff) { @@ -700,6 +702,12 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven cEvent *Event=NULL; const cEvent *lastEvent=Schedule->Events()->Last(); + if (iEvent->Duration()==0) + { + start=iEvent->StartTime(); + isyslog("infosatepg: event %s [%li (%s)] without duration", iEvent->Title(),start,ctime(&start)); + } + if ((lastEvent) && (iEvent->StartTime()<lastEvent->EndTime())) { // try to find, 1st with StartTime @@ -712,6 +720,7 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven { start=iEvent->StartTime(); dsyslog("infosatepg: failed to find event %s [%li (%s)]", iEvent->Title(),start,ctime(&start)); + global->Infosatdata[mac].Unlocated++; return true; // just bail out with ok } start=Event->StartTime(); @@ -758,6 +767,14 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven iEvent->SetShortText(NULL); } } + // if shorttext is the same as the description -> skip short text + if (iEvent->ShortText() && Event->Description()) + { + if (!strcmp(iEvent->ShortText(),Event->Description())) + { + iEvent->SetShortText(NULL); + } + } Event->SetShortText(iEvent->ShortText()); } @@ -1239,12 +1256,35 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,time_t *firststarttime) break; case 'Q': if (ignore) continue; - if (ievent) + if (!ievent) continue; + if ((ievent->Duration()==0) && (ievent->StartTime()!=0)) { - if (!AddInfosatEvent(chan,ievent)) abort=true; - delete ievent; - ievent=NULL; + int ehour,eminute; + fields=sscanf(s,"%d:%d",&ehour,&eminute); + if (fields==2) + { + tm.tm_hour=ehour; + tm.tm_min=eminute; + tm.tm_isdst=-1; + time_t end=mktime(&tm); + if (difftime(end,ievent->StartTime())<0) + { + // last ievent was yesterday + tm.tm_isdst=-1; + tm.tm_mday++; + end=mktime(&tm); + } + double duration=difftime(end,ievent->StartTime()); + if (duration>0) + { + ievent->SetDuration((int) (duration+60)); + } + } + } + if (!AddInfosatEvent(chan,ievent)) abort=true; + delete ievent; + ievent=NULL; default: continue; } diff --git a/readline.cpp b/readline.cpp index f13852e..50d2b2b 100644 --- a/readline.cpp +++ b/readline.cpp @@ -10,6 +10,8 @@ #include <stdio.h> #include "readline.h" +extern char *strcatrealloc(char *dest, const char *src); + // --- cReadLineInfosatepg --------------------------------------------------- cReadLineInfosatepg::cReadLineInfosatepg(void) @@ -19,52 +21,52 @@ cReadLineInfosatepg::cReadLineInfosatepg(void) cReadLineInfosatepg::~cReadLineInfosatepg() { - free(buffer); + if (buffer) free(buffer); } char *cReadLineInfosatepg::Read(FILE *f,size_t *size) { - free(buffer); buffer=NULL; + if (buffer) free(buffer); + buffer=NULL; if ((!size) || (!f)) return NULL; bool ext=false; *size=0; + char *tempbuffer=NULL; + size_t tempsize=0; do { - char *tempbuffer=NULL; - size_t tempsize=0; - ext=false; int n = getline(&tempbuffer, &tempsize, f); if (n > 0) { if (tempbuffer[n-1] == '\n') { - n--; - tempbuffer[n] = 0; + tempbuffer[--n] = 0; if (n > 0) { if (tempbuffer[n-1] == '\r') - n--; - tempbuffer[n] = 0; + tempbuffer[--n] = 0; } } if (n>0) { if (tempbuffer[n-1] == '\\') { - n--; - tempbuffer[n]=0; + tempbuffer[--n]=0; ext=true; } } - - buffer=(char*) realloc(buffer,*size+(n+1)); - snprintf(&buffer[*size],n+1,tempbuffer); - free(tempbuffer); - *size+=n; + if (n>0) { + buffer=strcatrealloc(buffer,tempbuffer); + //tempbuffer[0]=0; + *size+=n; + } else { + //tempbuffer[0]=0; + ext=true; + } } } while (ext==true); - + if (tempbuffer) free(tempbuffer); return buffer; } @@ -18,7 +18,6 @@ cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global) newSrate = global->Srate; newPid = global->Pid; newWaitTime = global->WaitTime; - newEventTimeDiff= (int) (global->EventTimeDiff/60); newNoWakeup=global->NoWakeup; newNoDeferredShutdown=global->NoDeferredShutdown; newHideMainMenu=global->HideMainMenu; @@ -44,8 +43,6 @@ cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global) 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 ("General options"))); Add (new cMenuEditBoolItem(tr("Hide main menu"),&newHideMainMenu)); @@ -77,11 +74,8 @@ cOsdItem *cMenuSetupInfosatepg::NewTitle (const char *s) void cMenuSetupInfosatepg::Store (void) { - bool bResetProcessed=false; bool bResetReceivedAll=false; - if (global->EventTimeDiff!= (60*newEventTimeDiff)) bResetProcessed=true; - if ((global->Frequency!=newFrequency) || (global->Polarization!=newPolarization) || (global->Srate!=newSrate) || (global->Pid!=newPid)) { @@ -94,13 +88,10 @@ void cMenuSetupInfosatepg::Store (void) SetupStore ("Pid", global->Pid = newPid); SetupStore ("WaitTime", global->WaitTime = newWaitTime); - SetupStore ("EventTimeDiff", newEventTimeDiff); SetupStore ("NoWakeup",global->NoWakeup=newNoWakeup); SetupStore ("NoDeferredShutdown",global->NoDeferredShutdown=newNoDeferredShutdown); SetupStore ("HideMainMenu",global->HideMainMenu=newHideMainMenu); - global->EventTimeDiff = 60*newEventTimeDiff; - if (bResetReceivedAll) { if (global->FindReceiverChannel()) @@ -113,11 +104,6 @@ void cMenuSetupInfosatepg::Store (void) esyslog("infosatepg: found no channel to receive, check setup"); } } - else if (bResetProcessed) - { - dsyslog ("infosatepg: reprocess files (later)"); - global->ResetProcessed(); - } } eOSState cMenuSetupInfosatepg::Edit() @@ -201,7 +187,8 @@ cMenuSetupChannelMenu::cMenuSetupChannelMenu (cGlobalInfosatepg *Global, int Ind 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)); + if ((newChannelUse & USE_APPEND)!=USE_APPEND) + 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)); @@ -19,8 +19,6 @@ private: cGlobalInfosatepg *global; //int newChannel; int newWaitTime; - int newWakeupTime; - int newEventTimeDiff; int newFrequency; char newPolarization; int newSrate; |