diff options
-rw-r--r-- | global.h | 15 | ||||
-rw-r--r-- | infosatepg.cpp | 39 | ||||
-rw-r--r-- | process.cpp | 26 | ||||
-rw-r--r-- | process.h | 2 |
4 files changed, 47 insertions, 35 deletions
@@ -124,26 +124,23 @@ private: int this_day; int this_month; int numinfosatchannels; - int wakeuptime; + time_t wakeuptime; struct infosatchannels *infosatchannels; int channel; public: cGlobalInfosatepg(); ~cGlobalInfosatepg(); cGlobalInfosatdata Infosatdata[EPG_DAYS+1]; - void SetWakeupTime(int Time) + void SetWakeupTime(time_t Time) { - if (Time==-1) return; - if (wakeuptime!=-1) return; // already set + if (Time==(time_t) -1) return; + if ((Time>wakeuptime) && (wakeuptime!=(time_t) -1)) return; // already set wakeuptime=Time; - int hour,minute; - hour=(int) (wakeuptime/100); - minute=wakeuptime-(hour*100); - isyslog("infosatepg: wakeup set to %02i:%02i", hour,minute); + isyslog("infosatepg: wakeup set to %s", ctime(&wakeuptime)); } bool NoWakeup; bool NoDeferredShutdown; - int WakeupTime() + time_t WakeupTime() { return wakeuptime; } diff --git a/infosatepg.cpp b/infosatepg.cpp index f1ad47a..63035c2 100644 --- a/infosatepg.cpp +++ b/infosatepg.cpp @@ -230,9 +230,9 @@ time_t cPluginInfosatepg::WakeupTime(void) if (global->NoWakeup) return 0; // user option set -> don't wake up if (global->Channel()==-1) return 0; // we cannot receive, so we don't need to wake up - if (global->WakeupTime()==-1) global->SetWakeupTime(300); // just to be safe + if (global->WakeupTime()==-1) return 0; // just to be safe time_t Now = time(NULL); - time_t Time = cTimer::SetTime(Now,cTimer::TimeToInt(global->WakeupTime())); + time_t Time = global->WakeupTime(); double diff = difftime(Time,Now); if (diff<0) { @@ -323,39 +323,48 @@ cString cPluginInfosatepg::SVDRPCommand(const char *Command, const char *Option, global->ResetProcessed(); pmac=EPG_FIRST_DAY_MAC; - asprintf(&output,"Reprocess\n"); + asprintf(&output,"Reprocess files\n"); } if (!strcasecmp(Command,"SAVE")) { global->Save(); - asprintf(&output,"InfosatEPG state saved\n"); + asprintf(&output,"State saved\n"); } if (!strcasecmp(Command,"STAT")) { int day,month; asprintf(&output,"InfosatEPG state:\n"); + asprintf(&output,"%s Switched: %s",output,global->Switched() ? "yes" : "no"); + + if (global->LastCurrentChannel!=-1) + { + asprintf(&output,"%s Switchback to: %i\n", output, global->LastCurrentChannel); + } + else + { + asprintf(&output,"%s Switchback to: unset\n",output); + } + if (global->ReceivedAll(&day,&month)) asprintf(&output,"%s Received all: yes (%02i.%02i.)",output,day,month); else asprintf(&output,"%s Received all: no",output); asprintf(&output,"%s Processed all: %s",output,global->ProcessedAll() ? "yes" : "no"); - asprintf(&output,"%s Switched: %s\n",output,global->Switched() ? "yes" : "no"); + asprintf(&output,"%s\n",output); + + asprintf(&output,"%s Prevent shutdown until ready: %s", + output,global->NoDeferredShutdown ? "no" : "yes"); + asprintf(&output,"%s\n",output); + if (global->WakeupTime()!=-1) { - asprintf(&output,"%s WakeupTime: %04i ", output,global->WakeupTime()); + time_t wakeup = global->WakeupTime(); + asprintf(&output,"%s WakeupTime: %s ", output,ctime(&wakeup)); if (global->NoWakeup) asprintf(&output,"%s (blocked) ",output); } else { - asprintf(&output,"%s WakeupTime: unset ", output); - } - if (global->LastCurrentChannel!=-1) - { - asprintf(&output,"%s Switchback to: %i\n", output, global->LastCurrentChannel); - } - else - { - asprintf(&output,"%s Switchback to: unset\n",output); + asprintf(&output,"%s WakeupTime: unset\n", output); } asprintf(&output,"%s\n",output); diff --git a/process.cpp b/process.cpp index 14bb96c..1eda3db 100644 --- a/process.cpp +++ b/process.cpp @@ -619,7 +619,7 @@ cProcessInfosatepg::cProcessInfosatepg(int Mac, cGlobalInfosatepg *Global) f=fopen(file,"r"); if (f) { - int firststarttime=-1; + time_t firststarttime=-1; if (ParseInfosatepg(f,&firststarttime)) { global->SetWakeupTime(firststarttime); @@ -978,7 +978,7 @@ bool cProcessInfosatepg::CheckAnnouncement(char *s,cInfosatevent *iEvent) return ret; } -bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) +bool cProcessInfosatepg::ParseInfosatepg(FILE *f,time_t *firststarttime) { char *s,tag; int fields,index; @@ -1085,14 +1085,14 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) if (!ievent) ievent = new cInfosatevent; tm.tm_hour=shour; tm.tm_min=sminute; - - if (*firststarttime==-1) - { - shour-=2; - if (shour<0) shour=24+shour; - *firststarttime=(shour*100)+sminute; - } - + /* + if (*firststarttime==-1) + { + shour-=2; + if (shour<0) shour=24+shour; + *firststarttime=(shour*100)+sminute; + } + */ tm.tm_isdst=-1; time_t start=mktime(&tm); if ((oldstart!=(time_t) -1) && (difftime(start,oldstart)<0)) @@ -1102,6 +1102,12 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) tm.tm_mday++; start=mktime(&tm); } + + if (*firststarttime==(time_t) -1) + { + *firststarttime=start+79200; // add 20 hours + } + oldstart=start; ievent->SetStartTime(start); ievent->SetTitle(conv->Convert(title)); @@ -102,7 +102,7 @@ private: bool AddInfosatEvent(cChannel *channel, cInfosatevent *iEvent); bool CheckOriginal_and_Episode(char **s,cInfosatevent *iEvent,cCharSetConv *conv); bool CheckAnnouncement(char *s,cInfosatevent *iEvent); - bool ParseInfosatepg(FILE *f,int *firststarttime); + bool ParseInfosatepg(FILE *f,time_t *firststarttime); cChannel *GetVDRChannel(int frequency, int sid); u_long DoSum(u_long sum, const char *buf, int nBytes); cEvent *SearchEvent(cSchedule* Schedule, cInfosatevent *iEvent); |