diff options
author | Midas <vdrportal_midas@gmx.de> | 2010-08-10 00:39:25 +0200 |
---|---|---|
committer | Midas <vdrportal_midas@gmx.de> | 2010-08-10 00:39:25 +0200 |
commit | f55dac3011baefcb9a92d9fc046a72afe08bf9ec (patch) | |
tree | afd3ed7eb0cfd730e18238ddfcbe65999746eaad | |
parent | 935840d74b9af4fa9fac5a882d436075fc188fa8 (diff) | |
download | vdr-plugin-block-f55dac3011baefcb9a92d9fc046a72afe08bf9ec.tar.gz vdr-plugin-block-f55dac3011baefcb9a92d9fc046a72afe08bf9ec.tar.bz2 |
Bugfix. Shows were still not blocked after switching from
a channel without or with empty EPG.
Code changes - internal.
-rw-r--r-- | block.c | 33 | ||||
-rw-r--r-- | event.c | 13 | ||||
-rw-r--r-- | event.h | 3 |
3 files changed, 31 insertions, 18 deletions
@@ -195,22 +195,18 @@ void cPluginBlock::MainThreadHook() if (scheds == NULL) { -#ifdef LOGGING - dsyslog("plugin-block: doing nothing because scheds==NULL"); -#endif - return; + char *dummy=cEventBlock::getTimeStamp(); + dsyslog("plugin-block: no EPG data (scheds==NULL) - using dummy for LastTitle: %s",dummy); + cEventBlock::LastTitle=(char*)dummy; + return; } const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); if (sched == NULL) { - char *dummy; - asprintf(&dummy, "%jd", (intmax_t)time_ms()); - dsyslog("plugin-block: no EPG data - using dummy for LastTitle: %s",dummy); + char *dummy=cEventBlock::getTimeStamp(); + dsyslog("plugin-block: no EPG data (sched==NULL) - using dummy for LastTitle: %s",dummy); cEventBlock::LastTitle=(char*)dummy; -#ifdef LOGGING - dsyslog("plugin-block: doing nothing because sched==NULL"); -#endif return; } @@ -219,20 +215,21 @@ void cPluginBlock::MainThreadHook() if (present == NULL) { -#ifdef LOGGING - dsyslog("plugin-block: doing nothing because present==NULL"); -#endif - return; + char *dummy=cEventBlock::getTimeStamp(); + dsyslog("plugin-block: no EPG title (present==NULL) - using dummy for LastTitle: %s",dummy); + cEventBlock::LastTitle=(char*)dummy; + return; } //TODO: check if isrequested is still necessary // if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) const char* title=present->Title(); - if (strcmp(title,"")==0) + if (strcmp(title,"")==0) //dunno if this could ever be reached (most likely any of the above would be NULL before) { - char *dummy; - asprintf(&dummy, "%jd", (intmax_t)time_ms()); - dsyslog("plugin-block: no current EPG title - using dummy for LastTitle: %s",title); + char *dummy=cEventBlock::getTimeStamp(); + dsyslog("plugin-block: no EPG title ("") - using dummy for LastTitle: %s",dummy); + cEventBlock::LastTitle=(char*)dummy; + return; } if (strcmp(title,cEventBlock::LastTitle)==0) @@ -7,6 +7,7 @@ #include "event.h" +#include "common.h" #include <ctype.h> char* cEventBlock::duptolower(const char *s) { @@ -17,6 +18,18 @@ char* cEventBlock::duptolower(const char *s) { return c; } +char* cEventBlock::getTimeStamp() +//Attention: this one will not return the exact UNIX time! +//Some internal cast seems to blur the word length here. +//For use in the block plugin this implementation however +//suffices because it returns something in the millisecond +//range. If you want to improve please send me an email ;) +{ + char *dummy; + asprintf(&dummy, "%jd", (intmax_t)time_ms()); + return dummy; +} + const char* cEventBlock::LastTitle="block_dummy_title3"; const bool* cEventBlock::ReplayingRecording=false; @@ -14,6 +14,7 @@ #include <vdr/tools.h> #include <vdr/config.h> + #define EVLINELENGTH 256 class cEventBlock : public cListObject { @@ -44,6 +45,8 @@ public: static const bool *ReplayingRecording; static char *duptolower(const char*); +// static char *getTimeStamp(){ char *dummy; asprintf(&dummy, "%jd", (intmax_t)time_ms()); return dummy; }; + static char *getTimeStamp(); const char *Pattern(void) const { return mPattern; } |