diff options
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | global.cpp | 52 | ||||
-rw-r--r-- | infosatepg.h | 2 | ||||
-rw-r--r-- | process.cpp | 12 |
4 files changed, 46 insertions, 24 deletions
@@ -1,5 +1,9 @@ VDR Plugin 'infosatepg' Revision History ---------------------------------------- +2009-12-22: Version 0.0.10 + +- Changed wakeup and reset of received data + 2009-07-12: Version 0.0.9 - Added patch from Jowi24 (channel not available) @@ -82,9 +82,9 @@ 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)); + ret=read (fd,&Unlocated,sizeof (Unlocated)); if (ret!=sizeof (Unlocated)) return -1; ret=read (fd,&bitfield,sizeof (bitfield)); if (ret!=sizeof (bitfield)) return -1; @@ -371,6 +371,8 @@ void cGlobalInfosatepg::ResetReceivedAll(void) Infosatdata[mac].ResetReceivedAll(); } wakeuptime=-1; + this_day=-1; + this_month=-1; } void cGlobalInfosatepg::ResetProcessed (void) @@ -380,6 +382,8 @@ void cGlobalInfosatepg::ResetProcessed (void) Infosatdata[mac].Processed=false; } wakeuptime=-1; + this_day=-1; + this_month=-1; } bool cGlobalInfosatepg::ProcessedAll() @@ -410,36 +414,40 @@ bool cGlobalInfosatepg::ReceivedAll(int *Day, int *Month) // All days fully received if (numReceived==EPG_DAYS) { - // First entry from today? - if ((Infosatdata[EPG_FIRST_DAY_MAC].Day() ==tm.tm_mday) && - (Infosatdata[EPG_FIRST_DAY_MAC].Month() ==tm.tm_mon+1)) + if ((this_day==-1) && (this_month==-1)) + { + isyslog ("infosatepg: all data received"); + this_day=tm.tm_mday; + this_month=tm.tm_mon+1; + } + // From today? + if ((this_day==tm.tm_mday) && (this_month==tm.tm_mon+1)) { - // Yes - if ((this_day!=tm.tm_mday) || (this_month!=tm.tm_mon+1)) - { - isyslog ("infosatepg: all data received"); - this_day=tm.tm_mday; - this_month=tm.tm_mon+1; - } res=true; } else { // New day, but new data is ready only after wakeup-time - time_t Now = time(NULL); - time_t Time; - if (WakeupTime()==-1) Time=Now+301; // If no wakeup set, just wait - else Time = WakeupTime(); - if (Now>=(Time-300)) + time_t Time=WakeupTime(); + if (Time==-1) { - // new day and new data should be available - ResetReceivedAll(); - res=false; + // no wakeuptime set, just wait + res=true; } else { - // wait till we are after wakeuptime - res=true; + Time-=300; + if (Now>=Time) + { + // new day and new data should be available + ResetReceivedAll(); + res=false; + } + else + { + // wait till we are after wakeuptime + res=true; + } } } } diff --git a/infosatepg.h b/infosatepg.h index a4b2b9e..efed463 100644 --- a/infosatepg.h +++ b/infosatepg.h @@ -13,7 +13,7 @@ #include "status.h" #include "process.h" -static const char *VERSION = "0.0.9"; +static const char *VERSION = "0.0.10"; static const char *DESCRIPTION = trNOOP("Read EPG info from infosat"); class cPluginInfosatepg : public cPlugin { diff --git a/process.cpp b/process.cpp index f835353..7969136 100644 --- a/process.cpp +++ b/process.cpp @@ -636,7 +636,17 @@ void cProcessInfosatepg::Action() time_t firststarttime=-1; if (ParseInfosatepg(f,&firststarttime)) { - global->SetWakeupTime(firststarttime); + if (firststarttime>time(NULL)) + { + global->SetWakeupTime(firststarttime); + } + else + { + isyslog("infosatepg: wakeuptime from infosat is in the past"); + firststarttime=cTimer::SetTime(time(NULL),cTimer::TimeToInt(300)); + firststarttime+=79200; // add 20 hours + global->SetWakeupTime(firststarttime); + } global->Infosatdata[mac].Processed=true; } else |