summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMidas <vdrportal_midas@gmx.de>2010-11-05 12:38:06 +0100
committerMidas <vdrportal_midas@gmx.de>2010-11-05 12:38:06 +0100
commitb7d3cedf918a62951385e27ef2a7e54fd3651eaf (patch)
tree3a151f63a8b4a85f3ef9ce214020fa13224a96ab
parent204d2c6bac6cb134f73e39ee450c3e56a15ee06c (diff)
downloadvdr-plugin-block-b7d3cedf918a62951385e27ef2a7e54fd3651eaf.tar.gz
vdr-plugin-block-b7d3cedf918a62951385e27ef2a7e54fd3651eaf.tar.bz2
Hotfix 0.1.0a: In Parental Guidance mode the plugin deblocked the last
channel if automatic switching reached an end of the channel list. Fixed.
-rw-r--r--block.c6
-rw-r--r--control.c36
2 files changed, 32 insertions, 10 deletions
diff --git a/block.c b/block.c
index 39c18de..67ad63c 100644
--- a/block.c
+++ b/block.c
@@ -20,7 +20,7 @@
using namespace std;
-static const char *VERSION = "0.1.0";
+static const char *VERSION = "0.1.0a";
static const char *DESCRIPTION = trNOOP("Block unwanted shows by EPG title");
static const char *MAINMENUENTRY = trNOOP("(De)Block broadcast");
@@ -283,7 +283,7 @@ void cPluginBlock::MainThreadHook()
}
#endif
channelnumber=cDevice::CurrentChannel();
- if (channelnumber==0)
+ if (channelnumber==0) //TODO last check revealed this possibly would never be true because ChannelSwitch handles it?
{
#ifdef LOGGING
dsyslog("plugin-block: Channel number is 0 => Channel switch on primary device");
@@ -347,7 +347,7 @@ void cPluginBlock::MainThreadHook()
if (strcmp(temp_string,has_been_checked_string)!=0)
{
dsyslog("plugin-block: %s",temp_string); //outputs: 'bla' has already been checked
- has_been_checked_string=temp_string;
+ has_been_checked_string=temp_string; //TODO a bool may increase performance
}
#endif
return; //current show has already been checked
diff --git a/control.c b/control.c
index 3fb9b3f..1c7c0b5 100644
--- a/control.c
+++ b/control.c
@@ -61,7 +61,8 @@ cControlBlock::~cControlBlock()
mRequested=false;
}
- if (mSwitch) {
+ if (mSwitch)
+ {
int lastchannel=cSetupBlock::LastAcceptableChannel;
// possibly first or last available channel, fall back to old channel
@@ -73,12 +74,33 @@ cControlBlock::~cControlBlock()
}
else
{
- direction = 1;
+ direction = 1; //TODO could there be another way to switch somewhere if directions are 0?
}
}
- if (!cDevice::SwitchChannel(direction) && (lastchannel != 0))
- Channels.SwitchTo(lastchannel);
+ bool switch_success=cDevice::SwitchChannel(direction);
+
+ if (!switch_success)
+ {
+ if (cSetupBlock::ParentalGuidance==1)
+ {
+ direction=-direction;
+ cSetupBlock::user_direction=direction;
+ switch_success=cDevice::SwitchChannel(direction);
+ }
+ else
+ {
+ if (lastchannel != 0)
+ {
+ dsyslog("plugin-block: ERROR: Don't know where to switch - switching to last channel!");
+ switch_success=Channels.SwitchTo(lastchannel);
+ }
+ }
+ if (!switch_success) dsyslog("plugin-block: ERROR: Don't know where to switch - Giving up!");
+
+ }
+
+
}
}
@@ -134,7 +156,7 @@ eOSState cControlBlock::ProcessKey(eKeys Key)
dsyslog("plugin-block: userint Processing kNone (no user interaction)");
#endif
if (cSetupBlock::user_direction ==0)direction = cDevice::CurrentChannel() -cSetupBlock::LastAcceptableChannel;
- else direction =0;
+ else direction =0; //TODO cleanup this direction chaos (doubleset and doublechecked here and there...)
mSwitch = true;
return osEnd;
}
@@ -155,7 +177,7 @@ dsyslog("plugin-block: userint Processing up event (userrequest)");
Show();
else
{
- mRequested=false;
+ mRequested=false;//TODO:necessary? as above
cSetupBlock::user_direction = 1;
mSwitch = true;
return osEnd;
@@ -177,7 +199,7 @@ dsyslog("plugin-block: userint Processing down event (userrequest)");
Show();
else
{
- mRequested=false;
+ mRequested=false;//TODO:necessary? as above
cSetupBlock::user_direction = -1;
mSwitch = true;
return osEnd;