diff options
author | Jochen Dolze <vdr@dolze.de> | 2012-04-15 09:52:58 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2012-04-15 09:52:58 +0200 |
commit | aab813ecd75842f49b0330a289a1ebac8845d883 (patch) | |
tree | 8255ac6183ec0549122d60e7daa5ff37e9b216ef | |
parent | 8233bd640dca1c2b856039a223a4d4e916a3aaf0 (diff) | |
download | vdr-plugin-xmltv2vdr-aab813ecd75842f49b0330a289a1ebac8845d883.tar.gz vdr-plugin-xmltv2vdr-aab813ecd75842f49b0330a289a1ebac8845d883.tar.bz2 |
Removed upstart option
Some code cleanups
-rw-r--r-- | po/de_DE.po | 14 | ||||
-rw-r--r-- | po/it_IT.po | 9 | ||||
-rw-r--r-- | setup.cpp | 29 | ||||
-rw-r--r-- | setup.h | 2 | ||||
-rw-r--r-- | source.cpp | 73 | ||||
-rw-r--r-- | source.h | 14 | ||||
-rw-r--r-- | xmltv2vdr.cpp | 23 | ||||
-rw-r--r-- | xmltv2vdr.h | 13 |
8 files changed, 81 insertions, 96 deletions
diff --git a/po/de_DE.po b/po/de_DE.po index 045d50f..bac9aa3 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2012-04-10 04:59+0200\n" +"POT-Creation-Date: 2012-04-14 18:03+0200\n" "PO-Revision-Date: 2010-12-23 23:59+0100\n" "Last-Translator: Jochen Dolze <vdr@dolze.de>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -103,14 +103,11 @@ msgstr "Info" msgid "Button$Debug" msgstr "Debug" -msgid "update" -msgstr "Ausführung" +msgid "update options" +msgstr "Ausführungsoptionen" -msgid "on time" -msgstr "Zeitpunkt" - -msgid "on start" -msgstr "beim Start" +msgid "update on" +msgstr "Ausführung am" msgid "update at" msgstr "Ausführung um" @@ -267,3 +264,4 @@ msgstr "xmltv2vdr plugin ist noch aktiv" msgid "Imports xmltv epg into vdr" msgstr "Importiert xmltv epg in den VDR" + diff --git a/po/it_IT.po b/po/it_IT.po index 3d724cf..48c9f59 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2012-04-10 04:59+0200\n" +"POT-Creation-Date: 2012-04-14 18:03+0200\n" "PO-Revision-Date: 2011-03-05 15:45+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -106,13 +106,10 @@ msgstr "" msgid "Button$Debug" msgstr "" -msgid "update" +msgid "update options" msgstr "" -msgid "on time" -msgstr "" - -msgid "on start" +msgid "update on" msgstr "" msgid "update at" @@ -58,6 +58,7 @@ void cMyMenuEditBitItem::Set(void) cMenuSetupXmltv2vdr::cMenuSetupXmltv2vdr(cPluginXmltv2vdr *Plugin) { baseplugin=Plugin; + baseplugin->SetSetupState(true); sourcesBegin=sourcesEnd=mappingBegin=mappingEnd=mappingEntry=0; epall=(int) baseplugin->EPAll(); wakeup=(int) baseplugin->WakeUp(); @@ -68,6 +69,7 @@ cMenuSetupXmltv2vdr::cMenuSetupXmltv2vdr(cPluginXmltv2vdr *Plugin) cMenuSetupXmltv2vdr::~cMenuSetupXmltv2vdr() { + baseplugin->SetSetupState(false); if (cs) cs->ClearMenu(); if (cm) cm->ClearMenu(); } @@ -707,20 +709,16 @@ cMenuSetupXmltv2vdrChannelSource::cMenuSetupXmltv2vdrChannelSource(cPluginXmltv2 day=0; weekday=127; - start=0; - upstart=1; + start=10; - days=0; + days=1; pin[0]=0; - updateEntry=0; - epgsrc=baseplugin->EPGSource(Index); if (!epgsrc) return; SetSection(cString::sprintf("%s '%s' : %s",trVDR("Plugin"), baseplugin->Name(), epgsrc->Name())); - upstart=epgsrc->ExecUpStart(); weekday=epgsrc->ExecWeekDay(); start=epgsrc->ExecTime(); days=epgsrc->DaysInAdvance(); @@ -742,15 +740,10 @@ void cMenuSetupXmltv2vdrChannelSource::output(void) { Clear(); - Add(NewTitle(tr("options"))); + Add(NewTitle(tr("update options"))); - Add(new cMenuEditBoolItem(tr("update"),&upstart,tr("on time"),tr("on start")),true); - updateEntry=Current(); - if (!upstart) - { - Add(new cMenuEditDateItem(trVDR("Day"),&day,&weekday)); - Add(new cMenuEditTimeItem(tr("update at"),&start)); - } + Add(new cMenuEditDateItem(tr("update on"),&day,&weekday)); + Add(new cMenuEditTimeItem(tr("update at"),&start)); Add(new cMenuEditIntItem(tr("days in advance"),&days,1,epgsrc->DaysMax())); if (epgsrc->NeedPin()) { @@ -790,12 +783,6 @@ eOSState cMenuSetupXmltv2vdrChannelSource::ProcessKey(eKeys Key) if (HasSubMenu()) return osContinue; switch (state) { - case osContinue: - if ((Key==kLeft) || (Key==kRight) || (Key==(kLeft|k_Repeat)) || (Key==(kRight|k_Repeat))) - { - if (Current()==updateEntry) output(); - } - case osUnknown: if (Key==kOk) { @@ -813,7 +800,7 @@ void cMenuSetupXmltv2vdrChannelSource::Store(void) { if ((!baseplugin) || (!sel) || (!epgsrc)) return; - epgsrc->ChangeExec(upstart,start,weekday); + epgsrc->ChangeExec(start,weekday); epgsrc->ChangeChannelSelection(sel); epgsrc->ChangeDaysInAdvance(days); if (epgsrc->NeedPin()) @@ -107,10 +107,8 @@ private: int *sel; time_t day; int weekday,start; - int upstart; int days; char pin[255]; - int updateEntry; void output(void); public: cMenuSetupXmltv2vdrChannelSource(cPluginXmltv2vdr *Plugin, cMenuSetupXmltv2vdr *Menu, int Index); @@ -55,7 +55,7 @@ void cEPGExecutor::Action() if (epgs->RunItNow()) { // if timer thread is runnung, wait till it's stopped - baseplugin->Wait4TimerThread(); + baseplugin->Wait4TimerThreadAndSetup(); int retries=0; while (retries<=2) @@ -116,13 +116,10 @@ cEPGSource::cEPGSource(const char *Name, const char *ConfDir, const char *EPGFil usepipe=false; needpin=false; running=false; - upstartdone=false; - daysinadvance=0; - exec_upstart=1; - exec_time=0; + daysinadvance=1; + exec_time=10; exec_weekday=127; // Mon->Sun lastretcode=255; - lastexec=(time_t) 0; disabled=false; if (strcmp(Name,EITSOURCE)) { @@ -156,7 +153,6 @@ cEPGSource::~cEPGSource() time_t cEPGSource::NextRunTime(time_t Now) { if (disabled) return 0; // never! - if (exec_upstart) return 0; // only once! time_t t; if (!Now) @@ -173,7 +169,6 @@ time_t cEPGSource::NextRunTime(time_t Now) if (t<Now) { t=cTimer::IncDay(t,1); - lastexec=(time_t) 0; } return t; } @@ -185,19 +180,11 @@ bool cEPGSource::RunItNow() if (stat(epgfile,&statbuf)==-1) return true; // no database? -> execute immediately if (!statbuf.st_size) return true; // no database? -> execute immediately - if (exec_upstart) - { - if (upstartdone) return false; - return true; - } - else - { - time_t t=(time(NULL)/60)*60; - time_t nrt=NextRunTime(t); - if (!nrt) return false; - if (t==nrt) return true; - return false; - } + time_t t=(time(NULL)/60)*60; + time_t nrt=NextRunTime(t); + if (!nrt) return false; + if (t==nrt) return true; + return false; } bool cEPGSource::ReadConfig() @@ -244,10 +231,17 @@ bool cEPGSource::ReadConfig() *pn=0; pn++; } - /* - newdatatime=atoi(ndt); - if (!newdatatime) Dlog("updates source data @%02i:%02i",1,2); - */ + int h,m; + sscanf(ndt,"%02i:%02i",&h,&m); + Dlog("updates data @%02i:%02i",h,m); + m+=10; + if (m>60) + { + m-=60; + h+=1; + if (h>23) h=0; + } + exec_time=(h*100)+m; if (pn) { pn=compactspace(pn); @@ -338,15 +332,12 @@ bool cEPGSource::ReadConfig() } if (linenr==2) { - sscanf(line,"%2d;%1d;%3d;%10d",&daysinadvance,&exec_upstart,&exec_weekday,&exec_time); + int reserve; + sscanf(line,"%2d;%1d;%3d;%10d",&daysinadvance,&reserve,&exec_weekday,&exec_time); Dlog("daysinadvance=%i",daysinadvance); - Dlog("upstart=%i",exec_upstart); - if (!exec_upstart) - { - Dlog("weekdays=%s",*cTimer::PrintDay(0,exec_weekday,true)); - time_t nrt=NextRunTime(); - Dlog("nextrun on %s",ctime(&nrt)); - } + Dlog("weekdays=%s",*cTimer::PrintDay(0,exec_weekday,true)); + time_t nrt=NextRunTime(); + Dlog("nextrun on %s",ctime(&nrt)); } if (linenr>2) { @@ -437,7 +428,7 @@ int cEPGSource::Execute(cEPGExecutor &myExecutor) int l_err=0; int ret=0; - if ((Log) && (lastexec)) + if (Log) { free(Log); Log=NULL; @@ -451,6 +442,7 @@ int cEPGSource::Execute(cEPGExecutor &myExecutor) return 134; } + int cu=0; for (int x=0; x<channels.Count(); x++) { if (channels.Get(x)->InUse()) @@ -468,8 +460,17 @@ int cEPGSource::Execute(cEPGExecutor &myExecutor) strcat(cmd," "); strcat(cmd,channels.Get(x)->Name()); strcat(cmd," "); + cu++; } } + + if (!cu) + { + free(cmd); + Ilog("no channels, please configure source"); + return 0; + } + char *pcmd=strdup(cmd); if (pcmd) { @@ -656,8 +657,6 @@ int cEPGSource::Execute(cEPGExecutor &myExecutor) if (!ret) { - lastexec=time(NULL); - upstartdone=true; lastretcode=ret; } @@ -719,7 +718,7 @@ void cEPGSource::Store(void) { fprintf(w,"#no pin\n"); } - fprintf(w,"%i;%i;%i;%i\n",daysinadvance,exec_upstart,exec_weekday,exec_time); + fprintf(w,"%i;%i;%i;%i\n",daysinadvance,0,exec_weekday,exec_time); for (int i=0; i<ChannelList()->Count(); i++) { if (ChannelList()->Get(i)->InUse()) @@ -59,14 +59,11 @@ private: bool usepipe; bool needpin; bool running; - bool upstartdone; bool disabled; int daysinadvance; - int exec_upstart; int exec_weekday; int exec_time; int daysmax; - time_t lastexec; int lastretcode; void add2Log(const char prefix, const char *line); bool ReadConfig(); @@ -111,10 +108,6 @@ public: { return exec_weekday; } - int ExecUpStart() - { - return exec_upstart; - } int DaysMax() { return daysmax; @@ -135,9 +128,8 @@ public: { return pin; } - void ChangeExec(int UpStart, int Time, int WeekDay) + void ChangeExec(int Time, int WeekDay) { - exec_upstart=UpStart; exec_time=Time; exec_weekday=WeekDay; } @@ -150,10 +142,6 @@ public: if (pin) free((void *) pin); pin=strdup(NewPin); } - time_t LastExecution() - { - return lastexec; - } void Tlog(const char *format, ...); void Dlog(const char *format, ...); void Elog(const char *format, ...); diff --git a/xmltv2vdr.cpp b/xmltv2vdr.cpp index 5ab5a0d..13ef222 100644 --- a/xmltv2vdr.cpp +++ b/xmltv2vdr.cpp @@ -412,6 +412,7 @@ cPluginXmltv2vdr::cPluginXmltv2vdr(void) : epgexecutor(this, &epgsources) last_maintime_t=0; last_epcheck_t=0; wakeup=0; + insetup=false; SetEPAll(false); TEXTMappingAdd(new cTEXTMapping("country",tr("country"))); TEXTMappingAdd(new cTEXTMapping("year",tr("year"))); @@ -451,20 +452,30 @@ bool cPluginXmltv2vdr::IsIdle(bool IncludeHandler) { if (IncludeHandler) { - if (!epgexecutor.Active() && (!epgtimer->Active()) && (!epghandler->Active())) return true; + if (!insetup && !epgexecutor.Active() && (!epgtimer->Active()) && (!epghandler->Active())) return true; } else { - if (!epgexecutor.Active() && (!epgtimer->Active())) return true; + if (!insetup && !epgexecutor.Active() && (!epgtimer->Active())) return true; } return false; } -void cPluginXmltv2vdr::Wait4TimerThread() +void cPluginXmltv2vdr::Wait4TimerThreadAndSetup() { - if (!epgtimer->Active()) return; - dsyslog("xmltv2vdr: wait for timer thread"); - pthread_join(epgtimer->ThreadId(),NULL); + if (epgtimer->Active()) + { + dsyslog("xmltv2vdr: wait for timer thread"); + pthread_join(epgtimer->ThreadId(),NULL); + } + if (insetup) + { + dsyslog("xmltv2vdr: wait for setup change"); + while (insetup) + { + usleep(200000); + } + } } bool cPluginXmltv2vdr::EPGSourceMove(int From, int To) diff --git a/xmltv2vdr.h b/xmltv2vdr.h index 0646724..90a2277 100644 --- a/xmltv2vdr.h +++ b/xmltv2vdr.h @@ -93,7 +93,6 @@ class cEPGHandler : public cEpgHandler { private: cPluginXmltv2vdr *baseplugin; - //const char *epgfile; cEPGMappings *maps; cEPGSources *sources; cImport *import; @@ -108,7 +107,10 @@ public: { epall=Value; } - bool Active() { return (db!=NULL); } + bool Active() + { + return (db!=NULL); + } virtual ~cEPGHandler(); virtual bool IgnoreChannel(const cChannel *Channel); virtual bool SetShortText(cEvent *Event, const char *ShortText); @@ -156,7 +158,12 @@ private: char *srcorder; bool epall; bool wakeup; + bool insetup; public: + void SetSetupState(bool Value) + { + insetup=Value; + } void SetEPAll(bool Value) { epall=Value; @@ -178,7 +185,7 @@ public: { epgsources.ReadIn(confdir,epgfile,&epgmappings,&textmappings,srcorder,Reload); } - void Wait4TimerThread(); + void Wait4TimerThreadAndSetup(); bool IsIdle(bool IncludeHandler=true); bool EPGSourceMove(int From, int To); int EPGSourceCount() |