From 210b6ab3d8a5367e116afefe31cea1d83fa094b9 Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Thu, 5 Feb 2009 17:58:15 +0100 Subject: Changed setup channel option into Frequency, Polarization, Srate Add setup option NoWakeup to prevent wakeup Improved parsing of Shorttext Fixed bug in event handling --- filter.cpp | 9 ++++--- global.cpp | 31 +++++++++++++++++++--- global.h | 10 +++++-- infosatepg.cpp | 21 ++++++++------- po/de_DE.po | 29 +++++++++++++++++--- po/it_IT.po | 27 ++++++++++++++++--- process.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++++------------- process.h | 8 ++++-- setup.cpp | 81 ++++++++++++++++++++++++++++++++++++++++--------------- setup.h | 6 ++++- status.cpp | 4 +-- 11 files changed, 239 insertions(+), 71 deletions(-) diff --git a/filter.cpp b/filter.cpp index 2eacea6..b98f873 100644 --- a/filter.cpp +++ b/filter.cpp @@ -136,9 +136,6 @@ void cFilterInfosatepg::Process(u_short Pid, u_char Tid, const u_char *Data, int // Check if we already have this packet if (global->Infosatdata[mac].GetBit(ntohs(ishdr->pktnr))) return; - // set bit in Infosatdata bitfield - global->Infosatdata[mac].SetBit(ntohs(ishdr->pktnr),true); - #ifdef VDRDEBUG dsyslog("infosatepg: mac=%02x-%02x-%02x-%02x-%02x-%02x",eth_hdr.h_dest[0],eth_hdr.h_dest[1], eth_hdr.h_dest[2],eth_hdr.h_dest[3],eth_hdr.h_dest[4],eth_hdr.h_dest[5] ); @@ -165,7 +162,11 @@ void cFilterInfosatepg::Process(u_short Pid, u_char Tid, const u_char *Data, int #ifdef VDRDEBUG dsyslog("infosatepg: writing to %li",offset); #endif - write(f,infosatdata,len); + if (write(f,infosatdata,len)==len) + { + // set bit in Infosatdata bitfield + global->Infosatdata[mac].SetBit(ntohs(ishdr->pktnr),true); + } } close(f); diff --git a/global.cpp b/global.cpp index 7cb9bd8..c3ca300 100644 --- a/global.cpp +++ b/global.cpp @@ -79,7 +79,7 @@ int cGlobalInfosatdata::Load(int fd) if (ret!=sizeof (bitfield)) return -1; ret=read (fd,&file,sizeof (file)); if (ret!=sizeof (file)) return -1; - dsyslog ("infosatepg: loaded file=%s",file); + if (file[0]!=0) dsyslog ("infosatepg: loaded file=%s",file); return ret; } @@ -124,8 +124,11 @@ cGlobalInfosatepg::cGlobalInfosatepg() // set public member LastCurrentChannel=-1; Pid=1809; + Srate = 22000; + Frequency = 12604; + Polarization ='h'; EventTimeDiff=480; // default 8 minutes - Channel=1; + channel=-1; MAC[0]=0x01; MAC[1]=0x00; MAC[2]=0x5e; @@ -134,6 +137,7 @@ cGlobalInfosatepg::cGlobalInfosatepg() WaitTime=10; // default 10 seconds SetDirectory ("/tmp"); ProcessedAll=false; + NoWakeup=false; } cGlobalInfosatepg::~cGlobalInfosatepg() @@ -196,7 +200,6 @@ void cGlobalInfosatepg::RemoveChannel(int Index) infosatchannels[i].ChannelID=infosatchannels[i+1].ChannelID; infosatchannels[i].Usage=infosatchannels[i+1].Usage; } - //infosatchannels[numinfosatchannels].Usage=0; numinfosatchannels--; } @@ -403,3 +406,25 @@ bool cGlobalInfosatepg::ReceivedAll(int *Day, int *Month) return res; } + +bool cGlobalInfosatepg::FindReceiverChannel() +{ + cChannel *chan; + int source = cSource::FromString("S19.2E"); // only from astra 19.2E + + for (int i=0; i<=Channels.MaxNumber(); i++) + { + chan = Channels.GetByNumber(i,0); + if (chan) + { + if (chan->Source()!=source) continue; + if (chan->Srate()!=Srate) continue; + if (chan->Frequency()!=Frequency) continue; + if (chan->Polarization()!=Polarization) continue; + channel=i; + return true; + } + } + channel=-1; + return false; +} diff --git a/global.h b/global.h index 79f6cb5..fa52fda 100644 --- a/global.h +++ b/global.h @@ -118,7 +118,7 @@ private: int numinfosatchannels; int wakeuptime; struct infosatchannels *infosatchannels; - void ResetReceivedAll(void); + int channel; public: cGlobalInfosatepg(); ~cGlobalInfosatepg(); @@ -134,12 +134,17 @@ public: minute=wakeuptime-(hour*100); isyslog("infosatepg: wakeup set to %02i:%02i", hour,minute); } + bool NoWakeup; int WakeupTime() { return wakeuptime; } int LastCurrentChannel; - int Channel; + int Channel() { return channel; } + bool FindReceiverChannel(); + int Frequency; + char Polarization; + int Srate; int Pid; int EventTimeDiff; int WaitTime; @@ -170,6 +175,7 @@ public: bool ProcessedAll; void ResetProcessed (void); + void ResetReceivedAll(void); bool ReceivedAll (int *Day, int *Month); bool ReceivedAll() { diff --git a/infosatepg.cpp b/infosatepg.cpp index 46ed9d3..c218bf2 100644 --- a/infosatepg.cpp +++ b/infosatepg.cpp @@ -90,6 +90,8 @@ bool cPluginInfosatepg::Initialize(void) // Removing entries from setup.conf is not possible! } } + if (!global->FindReceiverChannel()) + esyslog("infosatepg: found no channel to receive, check setup"); return true; } @@ -102,10 +104,6 @@ bool cPluginInfosatepg::Start(void) } statusMonitor = new cStatusInfosatepg(global); -#ifdef INFOSATEPG_DEBUG - global->Infosatdata[2].Debug(global->Directory()); - cProcessInfosatepg process(2,global); -#endif return true; } @@ -127,7 +125,8 @@ void cPluginInfosatepg::Housekeeping(void) { isyslog ("infosatepg: janitor found data to be processed: day=%i month=%i", global->Infosatdata[mac].Day(),global->Infosatdata[mac].Month()); - cProcessInfosatepg process (mac,global); + cProcessInfosatepg process(mac,global); + //process.Start(); } } int numprocessed=0; @@ -143,9 +142,10 @@ void cPluginInfosatepg::Housekeeping(void) void cPluginInfosatepg::MainThreadHook(void) { // Perform actions in the context of the main program thread. - if ((!global->WaitOk()) || (global->Switched()) || (global->ReceivedAll())) return; + if ((!global->WaitOk()) || (global->Switched()) || (global->ReceivedAll()) || + (global->Channel()==-1)) return; - cChannel *chan=Channels.GetByNumber(global->Channel); + cChannel *chan=Channels.GetByNumber(global->Channel()); if (!chan) return; if (ShutdownHandler.IsUserInactive()) @@ -205,7 +205,7 @@ cString cPluginInfosatepg::Active(void) if (global->LastCurrentChannel!=-1) { // we switched from users last channel - if (cDevice::PrimaryDevice()->CurrentChannel()==global->Channel) + if (cDevice::PrimaryDevice()->CurrentChannel()==global->Channel()) { // we are still on infosatepg channel cChannel *chan=Channels.GetByNumber(global->LastCurrentChannel); @@ -223,6 +223,7 @@ cString cPluginInfosatepg::Active(void) time_t cPluginInfosatepg::WakeupTime(void) { // Returns custom wakeup time for shutdown script + if (global->NoWakeup) return 0; if (global->WakeupTime()==-1) global->SetWakeupTime(300); // just to be safe time_t Now = time(NULL); time_t Time = cTimer::SetTime(Now,cTimer::TimeToInt(global->WakeupTime())); @@ -246,8 +247,7 @@ cMenuSetupPage *cPluginInfosatepg::SetupMenu(void) bool cPluginInfosatepg::SetupParse(const char *Name, const char *Value) { // Parse your own setup parameters and store their values. - if (!strcasecmp(Name,"Channel")) global->Channel=atoi(Value); - else if (!strcasecmp(Name,"Pid")) global->Pid=atoi(Value); + if (!strcasecmp(Name,"Pid")) global->Pid=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)) @@ -297,6 +297,7 @@ cString cPluginInfosatepg::SVDRPCommand(const char *Command, const char *Option, if (global->WakeupTime()!=-1) { asprintf(&output,"%s WakeupTime: %04i ", output,global->WakeupTime()); + if (global->NoWakeup) asprintf(&output,"%s (blocked) ",output); } else { diff --git a/po/de_DE.po b/po/de_DE.po index 40cca4e..7f2879d 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: \n" -"POT-Creation-Date: 2009-01-20 23:36+0100\n" +"POT-Creation-Date: 2009-02-01 12:25+0100\n" "PO-Revision-Date: 2008-05-02 16:20+0200\n" "Last-Translator: Jochen Dolze \n" "Language-Team: \n" @@ -24,14 +24,29 @@ msgstr "Infosat Kanalliste verfügbar" msgid "Scan parameter" msgstr "Scan Parameter" -msgid "Channel" -msgstr "Kanal" +msgid "Source" +msgstr "Quelle" + +msgid "Frequency" +msgstr "Frequenz" + +msgid "Polarization" +msgstr "Polarisation" + +msgid "Srate" +msgstr "Symbolrate" msgid "Pid" msgstr "Pid" +msgid "Using channel" +msgstr "Verwende Kanal" + +msgid "none" +msgstr "keinen" + msgid "Event options" -msgstr "Ereignis-Optionen" +msgstr "Ereignis Optionen" msgid "Wait time [s]" msgstr "Wartezeit [s]" @@ -39,6 +54,12 @@ msgstr "Wartezeit [s]" msgid "Time difference [min]" msgstr "Zeitdifferenz [min]" +msgid "General options" +msgstr "Sonstige Optionen" + +msgid "Prevent wakeup" +msgstr "Verhindere autom. aufwachen" + msgid "Infosat channels" msgstr "Infosat Kanäle" diff --git a/po/it_IT.po b/po/it_IT.po index 2e993e0..a6f131e 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: \n" -"POT-Creation-Date: 2009-01-20 23:36+0100\n" +"POT-Creation-Date: 2009-02-01 12:25+0100\n" "PO-Revision-Date: 2008-12-24 19:16+0100\n" "Last-Translator: Diego Pierotto \n" "Language-Team: \n" @@ -26,12 +26,27 @@ msgstr "Lista canale Infosat disponibile" msgid "Scan parameter" msgstr "Parametri scansione" -msgid "Channel" -msgstr "Canale" +msgid "Source" +msgstr "Sorgente" + +msgid "Frequency" +msgstr "Frequenza" + +msgid "Polarization" +msgstr "Polarizzazione" + +msgid "Srate" +msgstr "SymbolRate" msgid "Pid" msgstr "PID" +msgid "Using channel" +msgstr "Canali usato" + +msgid "none" +msgstr "" + msgid "Event options" msgstr "Opzioni evento" @@ -41,6 +56,12 @@ msgstr "Tempo di attesa [s]" msgid "Time difference [min]" msgstr "Differenza tempo [min]" +msgid "General options" +msgstr "Opzioni generali" + +msgid "Prevent wakeup" +msgstr "" + msgid "Infosat channels" msgstr "Canali Infosat" diff --git a/process.cpp b/process.cpp index e7698c4..bd7fe3c 100644 --- a/process.cpp +++ b/process.cpp @@ -7,8 +7,6 @@ */ #include -#include -#include #include #include #include "process.h" @@ -44,6 +42,7 @@ cInfosatevent::cInfosatevent() genre=NULL; original=NULL; extepg=NULL; + episode=NULL; year=-1; fsk=-1; category=-1; @@ -61,41 +60,68 @@ cInfosatevent::~cInfosatevent() free(genre); free(original); free(extepg); + free(episode); } void cInfosatevent::SetOriginal(const char *Original) { original = strcpyrealloc(original, Original); + original = compactspace(original); } void cInfosatevent::SetGenre(const char *Genre) { genre = strcpyrealloc(genre, Genre); + genre = compactspace(genre); } void cInfosatevent::SetCountry(const char *Country) { country = strcpyrealloc(country, Country); + country = compactspace(country); } void cInfosatevent::SetAnnouncement(const char *Announcement) { announcement = strcpyrealloc(announcement, Announcement); + announcement = compactspace(announcement); } void cInfosatevent::SetTitle(const char *Title) { title = strcpyrealloc(title, Title); + title = compactspace(title); +} + +void cInfosatevent::SetEpisode(const char *Episode) +{ + episode=strcpyrealloc(episode,Episode); + episode=compactspace(episode); } void cInfosatevent::SetShortText(const char *ShortText) { - shortText = strcpyrealloc(shortText, ShortText); + if (!ShortText) return; + + char *tmpText=strcpyrealloc(shortText,ShortText); + if (!tmpText) return; + tmpText=compactspace(tmpText); + + if (title) + { + if (!strcmp(title,tmpText)) + { + free(tmpText); + return; // ShortText same as title -> ignore + } + } + shortText = tmpText; } void cInfosatevent::SetDescription(const char *Description) { description = strcpyrealloc(description, Description); + description = compactspace(description); } const char *cInfosatevent::ExtEPG(void) @@ -144,6 +170,12 @@ const char *cInfosatevent::ExtEPG(void) sprintf(fmt,"FSK: %i\n",fsk); extepg=strcatrealloc(extepg,fmt); } + if (episode) + { + extepg=strcatrealloc(extepg,"Episode: "); + extepg=strcatrealloc(extepg,episode); + extepg=strcatrealloc(extepg,"\n"); + } if (announcement) { extepg=strcatrealloc(extepg,"Rating: "); @@ -156,9 +188,12 @@ const char *cInfosatevent::ExtEPG(void) // --- cProcessInfosatepg cProcessInfosatepg::cProcessInfosatepg(int Mac, cGlobalInfosatepg *Global) +//void cProcessInfosatepg::Action() //int Mac, cGlobalInfosatepg *Global) { - global=Global; +// int Mac=0; +// cGlobalInfosatepg *Global=NULL; + global=Global; FILE *f; const char *file = global->Infosatdata[Mac].GetFile(); f=fopen(file,"r"); @@ -207,7 +242,6 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven if ((!channel) || (!iEvent)) return true; if (iEvent->Usage()==USE_NOTHING) return true; // this should never happen! if (iEvent->StartTime()StartTime()>(time(NULL)+(iEvent->Days()*86400))) return true; @@ -215,7 +249,7 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); if (!Schedules) return false; // No write lock -> try later! cSchedule* Schedule = (cSchedule *) Schedules->GetSchedule(channel,true); - if (!Schedule) return true; + if (!Schedule) return true; // No schedule -> do nothing (is this ok?) time_t start=0; cEvent *Event=NULL; @@ -230,10 +264,12 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven if (!Event) return true; // just bail out with ok start=iEvent->StartTime(); - dsyslog("infosatepg: ievent %s [%s]", iEvent->Title(),ctime(&start)); + dsyslog("infosatepg: changing event %s [%s]", iEvent->Title(),ctime(&start)); - // change existing event + // change existing event, prevent EIT EPG to update Event->SetTableID(0); + Event->SetVersion(0xff); // is that ok? + Event->SetSeen(); // meaning of this? } else { @@ -316,7 +352,7 @@ bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEven return true; } -cChannel *cProcessInfosatepg::GetInfosatChannel(int frequency, int sid) +cChannel *cProcessInfosatepg::GetVDRChannel(int frequency, int sid) { cChannel *chan; int source = cSource::FromString("S19.2E"); // only from astra 19.2E @@ -348,11 +384,26 @@ bool cProcessInfosatepg::CheckOriginal(char *s,cInfosatevent *iEvent,cCharSetCon if (!pEOT) return false; if (pEOT[1]!=0) return false; + if (pEOT[-1]==')') + { + char *pTMP = strchr(&pOT[1],'('); + if (pTMP) + { + pOT=pTMP; + } + } + else + { + // just one brace + if (isdigit(pOT[1])) return false; + } + *pOT=*pEOT=0; *pOT++; if (pOT[-1]==' ') pOT[-1]=0; // check some things if (!strcmp(pOT,"TM")) return false; + // check for (number) char *endp=NULL; long int ret =strtol(pOT,&endp,10); if ((ret!=0) && (*endp==0)) return false; @@ -389,7 +440,7 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) char *s,tag; int fields,index; size_t size; - time_t oldstart; + time_t oldstart=-1; bool ignore=true; bool abort=false; struct tm tm; @@ -437,7 +488,7 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) if (fields==7) { // got all fields - chan=GetInfosatChannel(frequency,sid); + chan=GetVDRChannel(frequency,sid); if (chan) { if (!global->ChannelExists(chan->GetChannelID(),&index)) @@ -464,8 +515,8 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) tm.tm_isdst=-1; oldstart=mktime(&tm); dsyslog("infosatepg: using '%s'",s); - dsyslog("infosatepg: start on %02i.%02i.%04i %02i:%02i",tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900, - tm.tm_hour,tm.tm_min); + dsyslog("infosatepg: start on %02i.%02i.%04i %02i:%02i (%s)",tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900, + tm.tm_hour,tm.tm_min,asctime(&tm)); ignore=false; ieventnr=1; } @@ -480,14 +531,9 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) { // There was an event without long description -> add if (!AddInfosatEvent(chan,ievent)) abort=true; - oldstart=ievent->StartTime(); delete ievent; // delete old event ievent =NULL; } - else - { - oldstart=(time_t) -1; - } int shour,sminute; char *title; fields=sscanf(s,"%d:%d %a[^^]",&shour,&sminute,&title); @@ -513,6 +559,7 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) tm.tm_mday++; start=mktime(&tm); } + oldstart=start; ievent->SetStartTime(start); ievent->SetTitle(conv->Convert(title)); free(title); @@ -626,7 +673,6 @@ bool cProcessInfosatepg::ParseInfosatepg(FILE *f,int *firststarttime) strreplace(s,0x8A,'\n'); ievent->SetDescription(conv->Convert(s)); if (!AddInfosatEvent(chan,ievent)) abort=true; - oldstart=ievent->StartTime(); delete ievent; ievent=NULL; break; diff --git a/process.h b/process.h index 4bc19f9..958f6c4 100644 --- a/process.h +++ b/process.h @@ -24,6 +24,7 @@ private: char *country; char *genre; char *original; + char *episode; int category; int fsk; int year; @@ -49,6 +50,7 @@ public: void SetCountry(const char *Country); void SetGenre(const char *Genre); void SetOriginal(const char *Original); + void SetEpisode(const char *Episode); const char *Description(void) const { return description; } const char *Title(void) const { return title; } const char *ShortText(void) const { return shortText; } @@ -56,6 +58,7 @@ public: const char *Genre(void) const { return genre; } const char *Country(void) const { return country; } const char *Original(void) const { return original; } + const char *Episode(void) const { return episode; } int Year(void) const { return year; } int Duration(void) const { return duration; } int FSK(void) const { return fsk; } @@ -68,7 +71,7 @@ public: }; // --- cProcessInfosatepg -class cProcessInfosatepg +class cProcessInfosatepg //: public cThread { private: cGlobalInfosatepg *global; @@ -76,10 +79,11 @@ private: bool CheckOriginal(char *s,cInfosatevent *iEvent,cCharSetConv *conv); bool CheckAnnouncement(char *s,cInfosatevent *iEvent); bool ParseInfosatepg(FILE *f,int *firststarttime); - cChannel *GetInfosatChannel(int frequency, int sid); + cChannel *GetVDRChannel(int frequency, int sid); u_long DoSum(u_long sum, const char *buf, int nBytes); cEvent *SearchEvent(cSchedule* Schedule, cInfosatevent *iEvent); public: + //virtual void Action(); //(int Mac, cGlobalInfosatepg *Global); cProcessInfosatepg(int Mac, cGlobalInfosatepg *Global); }; diff --git a/setup.cpp b/setup.cpp index ec465ea..9c6abe2 100644 --- a/setup.cpp +++ b/setup.cpp @@ -13,19 +13,41 @@ cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global) { global=Global; - newChannel = global->Channel; + newFrequency = global->Frequency; + newPolarization = global->Polarization; + newSrate = global->Srate; newPid = global->Pid; newWaitTime = global->WaitTime; newEventTimeDiff= (int) (global->EventTimeDiff/60); + newNoWakeup=global->NoWakeup; Add (NewTitle (tr ("Scan parameter"))); - cOsdItem *firstItem = new cMenuEditIntItem (tr ("Channel"), &newChannel,1,Channels.MaxNumber()); + cString buffer = cString::sprintf("%s:\t%s",tr("Source"), "S19.2E"); // just for info + Add (new cOsdItem (buffer,osUnknown,false)); + cOsdItem *firstItem = new cMenuEditIntItem (tr ("Frequency"), &newFrequency); Add (firstItem); + Add (new cMenuEditChrItem (tr ("Polarization"), &newPolarization,"hlvr")); + Add (new cMenuEditIntItem (tr ("Srate"), &newSrate)); Add (new cMenuEditIntItem (tr ("Pid"), &newPid,1,8191)); + + if (global->Channel()>0) + { + buffer = cString::sprintf("-> %s:\t%i",tr("Using channel"), global->Channel()); + } + else + { + buffer = cString::sprintf("-> %s:\t%s",tr("Using channel"),tr("none")); + } + Add (new cOsdItem (buffer,osUnknown,false)); + 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)); + MIN_EVENTTIMEDIFF,MAX_EVENTTIMEDIFF)); + + Add (NewTitle (tr ("General options"))); + + Add (new cMenuEditBoolItem(tr("Prevent wakeup"),&newNoWakeup)); if (global->InfosatChannels()) { @@ -46,27 +68,47 @@ cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global) cOsdItem *cMenuSetupInfosatepg::NewTitle (const char *s) { - char *str; - asprintf (&str,"---- %s ----", s); - cOsdItem *tmp = new cOsdItem (str); - tmp->SetSelectable (false); - free (str); - return tmp; + cString buffer = cString::sprintf("---- %s ----", s); + return new cOsdItem (buffer,osUnknown,false); } void cMenuSetupInfosatepg::Store (void) { - bool bReprocess=false; + bool bResetProcessed=false; + bool bResetReceivedAll=false; + + if (global->EventTimeDiff!= (60*newEventTimeDiff)) bResetProcessed=true; - if (global->EventTimeDiff!= (60*newEventTimeDiff)) bReprocess=true; + if ((global->Frequency!=newFrequency) || (global->Polarization!=newPolarization) || + (global->Srate!=newSrate) || (global->Pid!=newPid)) + { + bResetReceivedAll=true; + } - SetupStore ("Channel", global->Channel = newChannel); + SetupStore ("Frequency", global->Frequency = newFrequency); + SetupStore ("Polarization", global->Polarization = newPolarization); + SetupStore ("Srate", global->Srate = newSrate); SetupStore ("Pid", global->Pid = newPid); + SetupStore ("WaitTime", global->WaitTime = newWaitTime); SetupStore ("EventTimeDiff", newEventTimeDiff); + SetupStore ("NoWakeup",global->NoWakeup=newNoWakeup); + global->EventTimeDiff = 60*newEventTimeDiff; - if (bReprocess) + if (bResetReceivedAll) + { + if (global->FindReceiverChannel()) + { + dsyslog ("infosatepg: receive files again"); + global->ResetReceivedAll(); + } + else + { + esyslog("infosatepg: found no channel to receive, check setup"); + } + } + else if (bResetProcessed) { dsyslog ("infosatepg: reprocess files (later)"); global->ResetProcessed(); @@ -131,10 +173,8 @@ cMenuSetupChannelMenu::cMenuSetupChannelMenu (cGlobalInfosatepg *Global, int Ind channel = Channels.GetByChannelID (global->GetChannelID (index)); if (!channel) return; - char *str; - asprintf (&str,"---- %s ----", channel->Name()); - Add (new cOsdItem (str,osUnknown,false)); - free (str); + cString buffer = cString::sprintf("---- %s ----", channel->Name()); + Add (new cOsdItem (buffer,osUnknown,false)); Add(new cMenuEditIntItem(tr("Days in advance"),&newDays,1,EPG_DAYS)); Add(new cMenuEditBitItem(tr("Short text"),(uint *) &newChannelUse,USE_SHORTTEXT)); @@ -151,13 +191,12 @@ void cMenuSetupChannelMenu::Store (void) if (!channel) return; cString ChannelID = channel->GetChannelID().ToString(); - char *name; - asprintf (&name,"Channel-%s",*ChannelID); - if (!name) return; + cString name = cString::sprintf("Channel-%s",*ChannelID); + if (!*name) return; 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)"); diff --git a/setup.h b/setup.h index 56533e1..f683e7f 100644 --- a/setup.h +++ b/setup.h @@ -17,11 +17,15 @@ class cMenuSetupInfosatepg : public cMenuSetupPage { private: cGlobalInfosatepg *global; - int newChannel; + //int newChannel; int newWaitTime; int newWakeupTime; int newEventTimeDiff; + int newFrequency; + char newPolarization; + int newSrate; int newPid; + int newNoWakeup; int chanCurrent; protected: virtual void Store(void); diff --git a/status.cpp b/status.cpp index 3b51370..2af95fe 100644 --- a/status.cpp +++ b/status.cpp @@ -29,9 +29,9 @@ void cStatusInfosatepg::ChannelSwitch(const cDevice *Device, int ChannelNumber) bool bAddFilter=false; // just add filter if we aren't locked - if (ChannelNumber==global->Channel) + if (ChannelNumber==global->Channel()) { - cChannel *chan=Channels.GetByNumber(global->Channel); + cChannel *chan=Channels.GetByNumber(global->Channel()); if (!chan) return; if (!Device->ProvidesTransponder(chan)) return; // ignore virtual devices if (Device==myFilterDevice) return; // already attached to this device -- cgit v1.2.3