diff options
author | Jochen Dolze <vdr@dolze.de> | 2009-02-08 17:44:41 +0100 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2009-02-08 17:44:41 +0100 |
commit | 51ab5ce2f55399f7229ba5ea41edc4225dd7f412 (patch) | |
tree | 24b8ed79a6cac21ebabb5ef12e6c7f5bc766b1d1 /infosatepg.cpp | |
parent | ce9f6ffc44cc41dfbe9320650391ddcef5d86d3d (diff) | |
download | vdr-plugin-infosatepg-51ab5ce2f55399f7229ba5ea41edc4225dd7f412.tar.gz vdr-plugin-infosatepg-51ab5ce2f55399f7229ba5ea41edc4225dd7f412.tar.bz2 |
Added content handling
Improved event processing
Diffstat (limited to 'infosatepg.cpp')
-rw-r--r-- | infosatepg.cpp | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/infosatepg.cpp b/infosatepg.cpp index 955d0dd..4cb1811 100644 --- a/infosatepg.cpp +++ b/infosatepg.cpp @@ -26,6 +26,7 @@ cPluginInfosatepg::cPluginInfosatepg(void) // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! statusMonitor=NULL; global=new cGlobalInfosatepg; + numprocessed=0; mac=EPG_FIRST_DAY_MAC; } @@ -120,34 +121,38 @@ void cPluginInfosatepg::Stop(void) void cPluginInfosatepg::Housekeeping(void) { // Perform any cleanup or other regular tasks. - if (!global->ReceivedAll()) return; - if (global->ProcessedAll) return; - - if (!global->Infosatdata[mac].Processed) - { - isyslog ("infosatepg: janitor found data to be processed: day=%i month=%i", - global->Infosatdata[mac].Day(),global->Infosatdata[mac].Month()); - cProcessInfosatepg process(mac,global); - } - mac++; +} - int numprocessed=0; - for (int pmac=EPG_FIRST_DAY_MAC; pmac<=EPG_LAST_DAY_MAC; pmac++) +void cPluginInfosatepg::MainThreadHook(void) +{ + // Perform actions in the context of the main program thread. + if (!global->WaitOk()) return; + if (global->ReceivedAll() && !global->ProcessedAll) { - if (global->Infosatdata[pmac].Processed) numprocessed++; + if (!global->Infosatdata[mac].Processed) + { + isyslog ("infosatepg: found data to be processed: day=%i month=%i", + global->Infosatdata[mac].Day(),global->Infosatdata[mac].Month()); + cProcessInfosatepg process(mac,global); + global->SetWaitTimer(); + } + if (global->Infosatdata[mac].Processed) + { + numprocessed++; + mac++; + } + if (numprocessed==EPG_DAYS) + { + global->ProcessedAll=true; + } } - if (numprocessed==EPG_DAYS) + else { - global->ProcessedAll=true; + numprocessed=0; mac=EPG_FIRST_DAY_MAC; } -} -void cPluginInfosatepg::MainThreadHook(void) -{ - // Perform actions in the context of the main program thread. - if ((!global->WaitOk()) || (global->Switched()) || (global->ReceivedAll()) || - (global->Channel()==-1)) return; + if ((global->Switched()) || (global->ReceivedAll()) || (global->Channel()==-1)) return; cChannel *chan=Channels.GetByNumber(global->Channel()); if (!chan) return; @@ -283,8 +288,12 @@ const char **cPluginInfosatepg::SVDRPHelpPages(void) // Returns help text for SVDRP static const char *HelpPages[] = { - "STATE\n" + "STAT\n" " Return actual state of the plugin", + "RESR\n" + " Reset received all", + "REPR\n" + " Reprocess again", NULL }; return HelpPages; @@ -294,7 +303,17 @@ cString cPluginInfosatepg::SVDRPCommand(const char *Command, const char *Option, { // Process SVDRP commands char *output=NULL; - if (!strcasecmp(Command,"STATE")) + if (!strcasecmp(Command,"RESR")) + { + global->ResetReceivedAll(); + asprintf(&output,"OK\n"); + } + if (!strcasecmp(Command,"REPR")) + { + global->ResetProcessed(); + asprintf(&output,"OK\n"); + } + if (!strcasecmp(Command,"STAT")) { int day,month; asprintf(&output,"InfosatEPG state:\n"); |