summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMidas <vdrportal_midas@gmx.de>2010-08-10 00:39:25 +0200
committerMidas <vdrportal_midas@gmx.de>2010-08-10 00:39:25 +0200
commitf55dac3011baefcb9a92d9fc046a72afe08bf9ec (patch)
treeafd3ed7eb0cfd730e18238ddfcbe65999746eaad
parent935840d74b9af4fa9fac5a882d436075fc188fa8 (diff)
downloadvdr-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.c33
-rw-r--r--event.c13
-rw-r--r--event.h3
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 <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;
diff --git a/event.h b/event.h
index bd8fa09..91af368 100644
--- a/event.h
+++ b/event.h
@@ -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; }