From f55dac3011baefcb9a92d9fc046a72afe08bf9ec Mon Sep 17 00:00:00 2001 From: Midas Date: Tue, 10 Aug 2010 00:39:25 +0200 Subject: Bugfix. Shows were still not blocked after switching from a channel without or with empty EPG. Code changes - internal. --- block.c | 33 +++++++++++++++------------------ event.c | 13 +++++++++++++ event.h | 3 +++ 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/block.c b/block.c index eb932a0..c424575 100644 --- a/block.c +++ b/block.c @@ -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) diff --git a/event.c b/event.c index 5e7fb80..69700cd 100644 --- a/event.c +++ b/event.c @@ -7,6 +7,7 @@ #include "event.h" +#include "common.h" #include 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; diff --git a/event.h b/event.h index bd8fa09..91af368 100644 --- a/event.h +++ b/event.h @@ -14,6 +14,7 @@ #include #include + #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; } -- cgit v1.2.3