From e01f4889d18b73e586a00265ba608cdfafc18e03 Mon Sep 17 00:00:00 2001 From: Midas Date: Fri, 5 Nov 2010 12:41:07 +0100 Subject: Bugfix: In Parental Guidance mode the plugin deblocked the last channel if automatic switching reached an end of the channel list. Fixed. --- block.c | 2 +- control.c | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 0269839..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"); diff --git a/control.c b/control.c index d10212c..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 @@ -77,8 +78,29 @@ cControlBlock::~cControlBlock() } } - 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!"); + + } + + } } -- cgit v1.2.3