diff options
author | Midas <vdrportal_midas@gmx.de> | 2010-06-15 17:58:42 +0200 |
---|---|---|
committer | Midas <vdrportal_midas@gmx.de> | 2010-06-15 17:58:42 +0200 |
commit | 55b63ab8444ab93cc3851e22d99eeba832ffc3b4 (patch) | |
tree | 9847f43a4ea83a1a9261632e6e66c839d93a850e | |
parent | 56417444a0ad91164efcc094731a3206deed366b (diff) | |
download | vdr-plugin-block-55b63ab8444ab93cc3851e22d99eeba832ffc3b4.tar.gz vdr-plugin-block-55b63ab8444ab93cc3851e22d99eeba832ffc3b4.tar.bz2 |
Release of 0.0.3
First official release with parental guidance capability.
Please see README for details.
Changes in this commit:
-Command line parsing code added (function considered
as momentarily not useful - commented out).
-Potential bug sources eliminated - in rare cases the
plugin did not block
-Several strings changed / german translation updated
-Internal changes to ParentalGuidance setup (for command
line parsing see above)
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | block.c | 40 | ||||
-rw-r--r-- | config.c | 20 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | control.c | 5 | ||||
-rw-r--r-- | i18n.c | 29 | ||||
-rw-r--r-- | po/de_DE.po | 33 | ||||
-rw-r--r-- | setup.c | 31 | ||||
-rw-r--r-- | status.c | 42 |
9 files changed, 156 insertions, 52 deletions
@@ -67,9 +67,8 @@ Edit, delete or manually add new entries: Go to the plugins setup in the vdr menu, where you will find the blacklist. Use the color keys as shown in the osd. -Editing additionally allows you to ignore captialization, or to use -regular expressions. This way you for example you can use wildcards in -blacklist patterns and much more. +Editing additionally allows you to ignore case, or to use regular +expressions. Setup Options: @@ -9,6 +9,7 @@ * */ +#include <getopt.h> #include <vdr/plugin.h> #include "status.h" @@ -18,7 +19,7 @@ #include "i18n.h" #include "control.h" -static const char *VERSION = "0.0.2"; +static const char *VERSION = "0.0.3"; static const char *DESCRIPTION = trNOOP("Block unwanted shows by EPG title"); static const char *MAINMENUENTRY = trNOOP("Block broadcast"); @@ -42,6 +43,7 @@ public: virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); virtual void MainThreadHook(void); + //virtual bool ProcessArgs(int argc, char *argv[]); }; cPluginBlock::cPluginBlock(void): @@ -136,18 +138,46 @@ void cPluginBlock::MainThreadHook() //TODO: check if isrequested is still necessary // if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) const char* title=present->Title(); -// dsyslog("plugin-block-DEV: comparing '%s' with '%s'.",title,temptitle); if (strcmp(title,temptitle)==0) return; //current show has already been checked temptitle=(char*)title; if (!EventsBlock.Acceptable(title)) { - isyslog("plugin-block: channel %d is not acceptable at present", channelnumber); + isyslog("plugin-block: channel %d blocked", channelnumber); cControl::Launch(new cControlBlock(channel, present, follow)); } } } - - +/* +bool cPluginBlock::ProcessArgs (int argc, char *argv[]) +{ + static const char short_options[] = "p:"; + + static const struct option long_options[] = + { + { "ParentalGuidance", required_argument, NULL, 'p' }, + {NULL} + }; + + int c; + for (c=0;c<argc;c++) + { + dsyslog("plugin-block-DEV: argv[%d]=%s",c,argv[c]); + } + c=0; + while ((c = getopt_long(argc,argv,short_options,long_options,NULL))!=-1) + { + switch (c) + { + case 'p': cSetupBlock::ParentalGuidance=atoi(optarg); + //dsyslog("plugin-block-DEV: ParentalGuidance set to %s by cl argument.",optarg); + break; + default: //dsyslog("plugin-block-DEV: unrecognized command line option %s",optarg ); + break;//usually return false, but parental guidance could also be set in setup.conf or not at all! + } + } + return true; +} +*/ VDRPLUGINCREATOR(cPluginBlock); // Don't touch this! @@ -15,26 +15,28 @@ cSetupBlock SetupBlock; int cSetupBlock::LastChannel=0; int cSetupBlock::DetectionMethod=0; int cSetupBlock::OkAllowed=1; +int cSetupBlock::ParentalGuidance=-1;//negative value to check later if already set by commandline argument cSetupBlock::cSetupBlock(void): HideMenuEntry(0), - MessageTimeout(2), - ExtraOptionsVisible(1) + MessageTimeout(2) { } + bool cSetupBlock::Parse(const char *Name, const char *Value) { if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value); else if (strcmp(Name, "MessageTimeout") == 0) MessageTimeout = atoi(Value); else if (strcmp(Name, "DetectionMethod") == 0) DetectionMethod = atoi(Value); - - //if you want to make use of the following you have to manually add Block.ExtraOptionsVisible to your setup.conf - //0 means options 'Detection Method' and 'Ok temporarily deblocks' are not visible (eg for parental guidance) - //1 means the options are visible in the setup of vdr and everybody could alter the values - else if (strcmp(Name, "ExtraOptionsVisible") == 0) ExtraOptionsVisible = atoi(Value); - - else if (strcmp(Name, "OkAllowed")==0) OkAllowed = atoi(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 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; + cSetupBlock::OkAllowed=0; + } return true; } + @@ -14,12 +14,13 @@ public: int MessageTimeout; static int DetectionMethod; static int LastChannel; - int ExtraOptionsVisible; + static int ParentalGuidance; static int OkAllowed; cSetupBlock(void); bool Parse(const char *Name, const char *Value); + }; extern cSetupBlock SetupBlock; @@ -55,6 +55,7 @@ cControlBlock::~cControlBlock() //changed that to NULL dsyslog("plugin-block: userint Cannot switch - channel unknown!"); } + mRequested=false; } if (mSwitch) { @@ -76,7 +77,7 @@ void cControlBlock::Show(void) mOsd->SetChannel(mChannel, 0); mOsd->SetEvents(mPresent, mFollowing); - mOsd->SetMessage(mtError, tr("Channel not acceptable!")); + mOsd->SetMessage(mtError, tr("Current show blocked!")); mOsd->Flush(); mStart = time_ms(); @@ -106,7 +107,7 @@ eOSState cControlBlock::ProcessKey(eKeys Key) mSwitch = true; if (mOsd != NULL) { - mOsd->SetMessage(mtError, tr("No Permission!")); + mOsd->SetMessage(mtError, tr("Permission denied!")); mOsd->Flush(); } } @@ -82,8 +82,33 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Channel not acceptable", - "Aktuelle Sendung unzumutbar", + { "Permission denied!", + "Aktion nicht erlaubt!", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +#if VDRVERSNUM >= 10313 + "", +#endif +#if VDRVERSNUM >= 10316 + "", +#endif + }, + { "Current show blocked!", + "Aktuelle Sendung gesperrt!", "", "", "", diff --git a/po/de_DE.po b/po/de_DE.po index 54435cc..b915f02 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,56 +6,79 @@ 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-06-03 12:38+0200\n" -"PO-Revision-Date: 2010-06-03 12:37+0200\n" +"Report-Msgid-Bugs-To: vdrportal_midas at gmx dot de\n" +"POT-Creation-Date: 2010-06-10 21:29+0200\n" +"PO-Revision-Date: 2010-06-10 21:29+0200\n" "Last-Translator: Klaus Schmidinger <kls@cadsoft.de>\n" "Language-Team: <vdr@linuxtv.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-15\n" "Content-Transfer-Encoding: 8bit\n" +#: block.c:23 msgid "Block unwanted shows by EPG title" msgstr "Sendung/EPG-Titel sperren" +#: block.c:24 msgid "Block broadcast" msgstr "Sendung sperren" -msgid "Channel not acceptable!" -msgstr "Aktuelle Sendung unzumutbar!" +#: control.c:79 +msgid "Current show blocked!" +msgstr "Aktuelle Sendung gesperrt!" +#: control.c:109 +msgid "Permission denied!" +msgstr "Aktion nicht erlaubt!" + +#: event.c:27 msgid "New Entry" msgstr "Neuer Eintrag" +#: setup.c:26 msgid "Hide Mainmenu Entry" msgstr "Hauptmenüeintrag verstecken" +#: setup.c:27 msgid "Message Timeout [s]" msgstr "Wartezeit bis Umschalten [s]" +#: setup.c:29 msgid "On Switch" msgstr "Beim Umschalten" +#: setup.c:30 msgid "Channel EPG" msgstr "Kanal EPG" +#: setup.c:32 msgid "Detection Method" msgstr "Methode" +#: setup.c:33 +msgid "Ok deblocks temporarily" +msgstr "Ok entsperrt temporär" + +#: setup.c:47 msgid "--- Keywords -------------------------------------------------------------------" msgstr "--- Schlagworte ----------------------------------------------------------------" +#: setup.c:120 msgid "Delete keyword?" msgstr "Schlagwort löschen?" +#: setup.c:170 msgid "Pattern" msgstr "Suchmuster" +#: setup.c:171 msgid "Regular Expression" msgstr "Regulärer Ausdruck" +#: setup.c:172 msgid "Ignore Case" msgstr "Groß/Kleinschreibung ignorieren" +#: setup.c:183 msgid "Malformed regular expression!" msgstr "Ungültiger regulärer Ausdruck!" @@ -29,23 +29,16 @@ void cMenuSetupBlock::Set(void) { DetectionMethods[0] = tr("On Switch"); DetectionMethods[1] = tr("Channel EPG"); - if(mSetupData.ExtraOptionsVisible==1) - { - Add(new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods)); - Add(new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.OkAllowed)); - } - else + cMenuEditStraItem *methoditem = new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods); + cMenuEditBoolItem *okitem = new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.OkAllowed); + + if(cSetupBlock::ParentalGuidance==1) { - cMenuEditStraItem *methoditem = new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods); - cMenuEditBoolItem *okitem = new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.OkAllowed); methoditem->SetSelectable(false); okitem->SetSelectable(false); - Add(methoditem); - Add(okitem); -// Add((new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods))::SetSelectable(false)); -// Add(new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.ExtraOptionsVisible)); - } - + } + Add(methoditem); + Add(okitem); item = new cOsdItem(""); item->SetSelectable(false); @@ -143,10 +136,12 @@ eOSState cMenuSetupBlock::ProcessKey(eKeys Key) { switch (state) { case osUnknown: // normal key handling switch (Key) { - case kRed: if (mSetupData.ExtraOptionsVisible==1) return Edit(); - case kGreen: return New(); - case kYellow: if (mSetupData.ExtraOptionsVisible==1) return Delete(); - + case kRed: if (mSetupData.ParentalGuidance!=1) return Edit(); + break; + case kGreen: if (mSetupData.ParentalGuidance!=1) return New(); + break; + case kYellow: if (mSetupData.ParentalGuidance!=1) return Delete(); + break; default: break; } @@ -21,16 +21,28 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) { if (cSetupBlock::LastChannel==0) { +#ifdef LOGGING + dsyslog("plugin-block: ChannelSwitch returned because LastChannel=0"); +#endif cSetupBlock::LastChannel=cDevice::CurrentChannel(); return; } if (ChannelNumber==0) { +#ifdef LOGGING + dsyslog("plugin-block: ChannelSwitch returned because ChannelNumber=0 (switch in progess)"); +#endif cSetupBlock::LastChannel=cDevice::CurrentChannel(); return; //Switch in progress; } - if (cSetupBlock::DetectionMethod!=0) return; + if (cSetupBlock::DetectionMethod!=0) + { +#ifdef LOGGING + dsyslog("plugin-block: ChannelSwitch returned because other detection method active"); +#endif + return; + } #ifdef LOGGING dsyslog("plugin-block: cStatusBlock was informed about channel switch at device %d, channel no %d",Device->DeviceNumber(),ChannelNumber); @@ -73,18 +85,34 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) { cSchedulesLock schedLock; const cSchedules *scheds = cSchedules::Schedules(schedLock); - if (scheds == NULL) return; + if (scheds == NULL) + { +#ifdef LOGGING + dsyslog("plugin-block: ChannelSwitch: scheds=null caused return"); +#endif + return; + } const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); - if (sched == NULL) return; - + if (sched == NULL) + { +#ifdef LOGGING + dsyslog("plugin-block: ChannelSwitch: sched=null caused return"); +#endif + return; + } const cEvent *present = sched->GetPresentEvent(); const cEvent *follow = sched->GetFollowingEvent(); - if (present == NULL) return; - + if (present == NULL) + { +#ifdef LOGGING + dsyslog("plugin-block: present=null return"); +#endif + return; + } if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) { - isyslog("plugin-block: channel %d is not acceptable at present", ChannelNumber); + dsyslog("plugin-block: channel %d blocked", ChannelNumber); cControl::Launch(new cControlBlock(channel, present, follow)); } } |