summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMidas <vdrportal_midas@gmx.de>2012-04-03 17:39:46 (GMT)
committerMidas <vdrportal_midas@gmx.de>2012-04-03 17:39:46 (GMT)
commite78b814fe5f52e4bbcd63842adefe0e44016ec43 (patch)
treef8df9ed569bee47c3b68f29a570e22f452642c43
parente64b78a1f6313623035fb8e2a7de1fc8fea24d75 (diff)
downloadvdr-plugin-block-e78b814fe5f52e4bbcd63842adefe0e44016ec43.tar.gz
vdr-plugin-block-e78b814fe5f52e4bbcd63842adefe0e44016ec43.tar.bz2
Bugfixes: Applied patch by Joe_D. Closes #928 @ vdr-developer.org
Features: Plugin now may take care of age rating information derived from the stream.
-rw-r--r--HISTORY11
-rw-r--r--Makefile2
-rw-r--r--README40
-rw-r--r--block.c47
-rw-r--r--config.c4
-rw-r--r--config.h1
-rw-r--r--event.c11
-rw-r--r--event.h8
-rw-r--r--i18n.c25
-rw-r--r--po/de_DE.po6
-rw-r--r--po/it_IT.po5
-rw-r--r--setup.c9
-rw-r--r--status.c15
-rw-r--r--status.h1
14 files changed, 157 insertions, 28 deletions
diff --git a/HISTORY b/HISTORY
index 244ee60..1938025 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,17 @@
VDR Plugin 'block' Revision History
-----------------------------------
+2012/04/03: Version 0.1.2
+Bugfix:
+ -Joe_D sent a patch which exposes myself coding JAVA for too long.
+ Several memory leaks and issues have been fixed. Thank you Joe_D.
+Features:
+ -The plugin now may take care of age rating information derived from
+ the DVB stream as suggested by Grindo. See 'DVB rating' in the plugins
+ setup and README for more information.
+
+
+**************************************************************************
2010/11/12: Version 0.1.1
Bugfix:
-In some cases plugin wrongly switched to a blacklisted channel, if all
diff --git a/Makefile b/Makefile
index a3b4f8c..942c3b0 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -O2 -Wall -Woverloaded-virtual
+CXXFLAGS ?= -fPIC -O2 -Wall -Wextra -Woverloaded-virtual
### The directory environment:
diff --git a/README b/README
index cfdb5fc..0255f6e 100644
--- a/README
+++ b/README
@@ -116,6 +116,25 @@ Fuzzy Fallback: As of version 0.1.0 whitelisting function was added which
the plugin falls back to the value fo Fuzzy Fallback which
could be set to black or white.
+DVB rating: As of version 0.1.2 the block plugins Parental Guidance mode
+ can verify against the Parental Rating stream information sent
+ by the broadcaster. Unfortunately this information seems not
+ to be very reliable as most stations have the value set to 0
+ (at least here in Germany and on DVB-S/T), which would be ok
+ for lets say Sesamy Street but not for action movies or even
+ the news depending on your point of view. That said the
+ current implementation only takes care of values > 0.
+
+ So the actual benefit of block taking care of the streams
+ rating information is that it will block every show with a
+ rating < 1 and additionally deblock shows that are broadcasted
+ with valid rating information (ie > 0) and the value being
+ lower than 'DVB rating' in the plugins setup.
+
+ Setting the value to 0 means disabled.
+
+ NOTE: DVB rating requires at least VDR 1.7.11.
+
Parental Guidance Setup
(Experimental as of version 0.0.2+dev):
@@ -125,8 +144,8 @@ First of all: I can't guarantee a perfectly failsafe childprotection.
Feel free to test the Parental Guidance config at your
own risk but don't forget, that it is you not me who
takes care of your children. Nevertheless the method
- used by the plugin should work quite good, as long as
- the stations are updating their epg signal in sync
+ used by the plugin should work quite well, as long as
+ the stations are updating their epg information in sync
with the current show.
How to: Several prerequisites have to be configured in the plugins
@@ -146,15 +165,16 @@ How to: Several prerequisites have to be configured in the plugins
(again with vdr being stopped) or by removing the row from
setup.conf.
- Setting ParentalGuidance to 1 overrides three other setup
+ Setting ParentalGuidance to 1 overrides four other setup
options: 'Detection Method' is set to 'Channel EPG',
- 'Ok deblocks temporarily' is set to 'No' and 'Fuzzy fallback'
- is set to 'black', as obviously other settings would undermine
- Parental Guidance mode. Furthermore the color keys yellow
- (Delete) and blue (switch black/white) are deactivated in the
- plugins setup. Editing is only allowed for new entries, for
- which you are only allowed to change the pattern and to set
- regular expression mode.
+ 'Ok deblocks temporarily' is set to 'No', 'Fuzzy fallback'
+ is set to 'black' and DVB rating becomes deactivated, as
+ other settings obviously would undermine Parental Guidance
+ mode. Furthermore the color keys yellow (Delete) and blue
+ (switch black/white) are deactivated in the plugins setup.
+ Editing is only allowed for new entries, for which you are
+ only allowed to change the pattern and to set regular
+ expression mode.
diff --git a/block.c b/block.c
index a0aa345..b8e8dd6 100644
--- a/block.c
+++ b/block.c
@@ -11,6 +11,7 @@
#include <vdr/plugin.h>
#include <vdr/menu.h>
+#include <libsi/descriptor.h>
#include "status.h"
#include "setup.h"
@@ -19,8 +20,7 @@
#include <fstream>
using namespace std;
-
-static const char *VERSION = "0.1.1";
+static const char *VERSION = "0.1.2";
static const char *DESCRIPTION = trNOOP("Block unwanted shows by EPG title");
static const char *MAINMENUENTRY = trNOOP("(De)Block broadcast");
@@ -107,6 +107,7 @@ bool cPluginBlock::Initialize(void)
outfile<<infile.rdbuf();
infile.close();
outfile.close();
+ free((void *) source_file);
}
}
@@ -122,6 +123,10 @@ bool cPluginBlock::Initialize(void)
outfile<<infile.rdbuf();
infile.close();
outfile.close();
+ free((void *)blacklist_path);
+ free((void *)blacklist_file);
+ free((void *) backup_file);
+
}
}
@@ -142,6 +147,8 @@ bool cPluginBlock::Initialize(void)
EventsBlock.Del(listptr->Next(),true);
continue;
}
+ free((void *)src);
+ free((void *)cmp);
listptr=EventsBlock.Next(listptr);
}
@@ -184,7 +191,7 @@ cOsdObject *cPluginBlock::MainMenuAction(void)
- if (!acceptable && cSetupBlock::ParentalGuidance)//TODO check if works
+ if (!acceptable && cSetupBlock::ParentalGuidance)
{
dsyslog("plugin-block: Parental Guidance: Attempt to deblock '%s' from main menu! Permission denied!",current_title);
cSkinDisplayChannel* mOsd = Skins.Current()->DisplayChannel(true);
@@ -305,6 +312,7 @@ void cPluginBlock::MainThreadHook()
const char* title=NULL;
const cEvent *present=NULL;
const cEvent *follow=NULL;
+ const char* description=NULL;
if (channel != NULL && !channel->GroupSep())
{
/*//only for debugging purposes:
@@ -337,7 +345,10 @@ void cPluginBlock::MainThreadHook()
}
}
}
- if (title==NULL) title="";
+ if (title==NULL) title="";//TODO this means even if title is NULL the whole procedure of verifying is being done
+ //absolutely unnecessary! if NULL && PR just block! otherwise do not!
+ //except if PR && rating check rating and then decide
+ //the following check still must stay included as it detects new titles !!!!!
if (strcmp(title,cEventBlock::LastTitle)==0)
{
@@ -357,12 +368,34 @@ void cPluginBlock::MainThreadHook()
cSetupBlock::LastcChannel=(cChannel*)channel;
-
+
#ifdef LOGGING
dsyslog("plugin-block: new EPG title detected: '%s' - comparing with '%s'",title, cEventBlock::LastTitle);
- #endif
+ #endif
+
+ int rating=-1;//in case VDRVERSNUM is < 10711 this being <0 makes sure we do not run into complications see below
+ if (present==NULL) description="present event is null. No info from EPG.";
+ else
+ {
+ description=present->Description();
+#if VDRVERSNUM>10711
+ rating=present->ParentalRating();
+ dsyslog ("plugin-block: detected Rating: %i",rating);
+#endif
+ }
+
cEventBlock::LastTitle=(char*)title;
- if (!EventsBlock.Acceptable(title))
+ if (rating<1) rating=100; // Unfortunately most of the channels do not broadcast valuable rating information
+ // eg Sesamy Street would of course be ok to have a rating of 0
+ // but lots of adult shows and so forth also are broadcasted with rating 0 :/
+ // so we only explicitly check ratings > 0
+ // if ParentalGuidance is active
+ // this gives us another few shows which are deblocked automatically
+ // hopefully the ratings > 0 are broadcasted correctly btw
+ // two rating states are checked here:
+ // 0 means sent by broadcaster
+ // -1 the initial value; may still be set if there is no epg etc
+ if ((VDRVERSNUM > 10710 && cSetupBlock::ParentalGuidance > 0 && cSetupBlock::DVBRating < rating ) || !EventsBlock.Acceptable(title))
{
dsyslog("plugin-block: channel %i blocked", channelnumber);
diff --git a/config.c b/config.c
index 5b5c0e8..539ac82 100644
--- a/config.c
+++ b/config.c
@@ -15,6 +15,7 @@ int cSetupBlock::DetectionMethod=0;
int cSetupBlock::OkAllowed=1;
int cSetupBlock::ParentalGuidance=-1; //negative value to check later if already set by commandline argument
int cSetupBlock::FuzzyFallback=0;
+int cSetupBlock::DVBRating=0;
int cSetupBlock::MessageTimeout=2;
char cSetupBlock::ReplayingName[256]={' '}; //256 corresponds to the initial EVMAXLINELENGTH in event.h; may have a more reliable implementation
cChannel* cSetupBlock::LastcChannel=NULL;
@@ -34,7 +35,8 @@ bool cSetupBlock::Parse(const char *Name, const char *Value)
else if (strcmp(Name, "OkAllowed")==0) OkAllowed = atoi(Value);
else if (strcmp(Name, "ParentalGuidance") == 0) ParentalGuidance=atoi(Value); //if cl is parsed a check has to be implemented here, to let cl value override setup.conf
else if (strcmp(Name, "FuzzyFallback")==0) FuzzyFallback=atoi(Value);
- else return false;
+ else if (strcmp(Name, "DVBRating")==0) DVBRating=atoi(Value);
+ else return false;
if (ParentalGuidance!=-1 && ParentalGuidance!=0) //-1 if not set by cl oder setup.conf - 0 if set to disabled - other value = enabled
{
cSetupBlock::DetectionMethod=1;
diff --git a/config.h b/config.h
index 611c088..c1edc9c 100644
--- a/config.h
+++ b/config.h
@@ -18,6 +18,7 @@ public:
static int ParentalGuidance;
static int OkAllowed;
static int FuzzyFallback;
+ static int DVBRating;
static char ReplayingName[256];
static cChannel *LastcChannel;
static int user_direction;
diff --git a/event.c b/event.c
index f6142ec..8060724 100644
--- a/event.c
+++ b/event.c
@@ -101,7 +101,9 @@ bool cEventBlock::Parse(char *s)
{
char *patternbuf=NULL;
int fields=sscanf(s,"%d:%d:%a[^\n]", &mRegularExp, &mIgnoreCase, &patternbuf);
-
+
+ if (!patternbuf) return true;
+
if (fields==3)
{
strncpy(mPattern,patternbuf,sizeof(mPattern));
@@ -281,6 +283,11 @@ void cEventsBlock::ListMatches(const char *title, cVector <cEventBlock*> *match_
#endif
stringmatch=*event;
}
+ if (event->IgnoreCase())
+ {
+ free(temp_title);
+ free(temp_pattern);
+ }
}
event = Next(event);
}
@@ -351,4 +358,4 @@ int cEventsBlock::getIndexOf(cEventBlock *src)
}
return -1;
}
- \ No newline at end of file
+
diff --git a/event.h b/event.h
index 280ef64..a9af5fa 100644
--- a/event.h
+++ b/event.h
@@ -55,9 +55,11 @@ public:
virtual int Compare(const cListObject &src) const
{
cEventBlock* rhs=(cEventBlock*)&src;
- char* l=cEventBlock::duptolower(mPattern);
- char* r=cEventBlock::duptolower(rhs->mPattern);
- return strcmp(l,r); }//TODO check if the code relies on this because in fact we have to return !strcmp(r,l) here!!!
+ char* l=duptolower(mPattern);
+ char* r=duptolower(rhs->mPattern);
+ int ret=strcmp(l,r);
+ free(l); free(r);
+ return ret; }//TODO check if the code relies on this because in fact we have to return !strcmp(r,l) here!!!
};
class cEventsBlock : public cConfig<cEventBlock> {
diff --git a/i18n.c b/i18n.c
index 88f8e70..de24a13 100644
--- a/i18n.c
+++ b/i18n.c
@@ -632,6 +632,31 @@ const tI18nPhrase Phrases[] = {
"",
#endif
},
+ { "DVB rating",
+ "Altersfreigabe (DVB)",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+#if VDRVERSNUM >= 10313
+ "",
+#endif
+#if VDRVERSNUM >= 10316
+ "",
+#endif
+ },
{ NULL }
};
diff --git a/po/de_DE.po b/po/de_DE.po
index 434a990..5d72d18 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,10 +7,11 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR 1.5.7\n"
"Report-Msgid-Bugs-To: <vdrportal_midas at gmx dot de>\n"
-"POT-Creation-Date: 2010-11-05 00:55+0100\n"
+"POT-Creation-Date: 2012-03-29 07:01+0200\n"
"PO-Revision-Date: 2010-11-05 00:53+0100\n"
"Last-Translator: Klaus Schmidinger <kls@cadsoft.de>\n"
"Language-Team: <vdr@linuxtv.org>\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -80,3 +81,6 @@ msgstr "Ungültiger regulärer Ausdruck!"
msgid "Please edit duplicate instead"
msgstr "Bitte vorhandenen Eintrag editieren"
+
+msgid "DVB rating"
+msgstr "Altersfreigabe (DVB)"
diff --git a/po/it_IT.po b/po/it_IT.po
index ee45cea..4105c41 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -9,10 +9,11 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR 1.5.7\n"
"Report-Msgid-Bugs-To: <vdrportal_midas at gmx dot de>\n"
-"POT-Creation-Date: 2010-11-05 00:55+0100\n"
+"POT-Creation-Date: 2012-03-29 07:01+0200\n"
"PO-Revision-Date: 2010-11-06 19:52+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: <vdr@linuxtv.org>\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -83,3 +84,5 @@ msgstr "Espressione regolare mal costruita!"
msgid "Please edit duplicate instead"
msgstr "Modifica invece i duplicati"
+msgid "DVB rating"
+msgstr "DVB rating"
diff --git a/setup.c b/setup.c
index c5500e5..9ba697b 100644
--- a/setup.c
+++ b/setup.c
@@ -35,17 +35,21 @@ void cMenuSetupBlock::Set(void) {
cMenuEditStraItem *methoditem = new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods);
cMenuEditBoolItem *okitem = new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.OkAllowed);
cMenuEditStraItem *whitelistitem = new cMenuEditStraItem(tr("Fuzzy fallback"), &mSetupData.FuzzyFallback, 2, FuzzyFallsback);
+ cMenuEditIntItem *dvbratingitem = new cMenuEditIntItem(tr("DVB rating"), &mSetupData.DVBRating,0,21);
+// cMenuEditIntItem *ratingitem = new cMenuEditIntItem(tr("Rating"), &mSetupData.Rating, 0, 21));
if(cSetupBlock::ParentalGuidance==1)
{
methoditem->SetSelectable(false);
okitem->SetSelectable(false);
whitelistitem->SetSelectable(false);
+ dvbratingitem->SetSelectable(false);
}
Add(methoditem);
Add(okitem);
Add(whitelistitem);
-
+ Add(dvbratingitem);
+//TODO translation, setup menü einrichten ->define mit if versehen für ein/ausblenden von options? variablen deklarieren
item = new cOsdItem("");
item->SetSelectable(false);
Add(item);
@@ -54,7 +58,7 @@ void cMenuSetupBlock::Set(void) {
item->SetSelectable(false);
Add(item);
-#define NONKEYWORDITEMS 7
+#define NONKEYWORDITEMS 8
int index = 0;
cEventBlock *event = mEventsData.First();
@@ -112,6 +116,7 @@ void cMenuSetupBlock::Store(void)
SetupStore("DetectionMethod", SetupBlock.DetectionMethod);
SetupStore("OkAllowed", SetupBlock.OkAllowed);
SetupStore("FuzzyFallback", SetupBlock.FuzzyFallback);
+ SetupStore("DVBRating", SetupBlock.DVBRating);
cEventBlock::LastTitle=(char*)"force recheck from setup";
}
diff --git a/status.c b/status.c
index 80b107e..aff12ac 100644
--- a/status.c
+++ b/status.c
@@ -134,8 +134,10 @@ void cStatusBlock::Replaying(const cControl *Control,
const char *FileName, bool On)
{
char *replaystate;
+#ifdef LOGGING
if (On) replaystate=(char*)"started";
else replaystate=(char*)"stopped";
+#endif
cEventBlock::ReplayingRecording=(bool*)On;
if (Name!=NULL) strncpy(cSetupBlock::ReplayingName,Name,sizeof(cSetupBlock::ReplayingName));
#ifdef LOGGING
@@ -143,3 +145,16 @@ void cStatusBlock::Replaying(const cControl *Control,
#endif
}
+void cStatusBlock::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
+{
+/* char buffer[25];
+ struct tm tm_r;
+ dsyslog("status: cStatusBlock::OsdProgramme");
+ strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
+ dsyslog("%5s %s", buffer, PresentTitle);
+ dsyslog("%5s %s", "", PresentSubtitle);
+ strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
+ dsyslog("%5s %s", buffer, FollowingTitle);
+ dsyslog("%5s %s", "", FollowingSubtitle);
+*/
+} \ No newline at end of file
diff --git a/status.h b/status.h
index bfa0fd5..ece85e2 100644
--- a/status.h
+++ b/status.h
@@ -18,6 +18,7 @@ protected:
virtual void Replaying(const cControl *Control,
const char *Name,
const char *FileName, bool On);
+ virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
public:
cStatusBlock(void);