diff options
-rw-r--r-- | block.c | 66 | ||||
-rw-r--r-- | config.c | 4 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | control.c | 4 | ||||
-rw-r--r-- | i18n.c | 75 | ||||
-rw-r--r-- | po/de_DE.po | 11 | ||||
-rw-r--r-- | setup.c | 8 | ||||
-rw-r--r-- | setup.h | 1 | ||||
-rw-r--r-- | status.c | 47 |
9 files changed, 190 insertions, 29 deletions
@@ -16,14 +16,20 @@ #include "setup.h" #include "config.h" #include "i18n.h" +#include "control.h" -static const char *VERSION = "0.0.1b+bf1"; +static const char *VERSION = "0.0.2rc1"; static const char *DESCRIPTION = trNOOP("Block unwanted shows by EPG title"); static const char *MAINMENUENTRY = trNOOP("Block broadcast"); +static int channelnumber=0; +static char *temptitle=NULL; + + class cPluginBlock : public cPlugin { private: cStatusBlock *mStatus; + int mLastChannel; public: cPluginBlock(void); @@ -36,12 +42,15 @@ public: virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); + virtual void MainThreadHook(void); }; cPluginBlock::cPluginBlock(void): cPlugin(), - mStatus(NULL) + mStatus(NULL), + mLastChannel(0) { + temptitle=""; } cPluginBlock::~cPluginBlock() @@ -93,4 +102,57 @@ bool cPluginBlock::SetupParse(const char *Name, const char *Value) return SetupBlock.Parse(Name, Value); } +void cPluginBlock::MainThreadHook() +{ + if (SetupBlock.DetectionMethod!=1) return;//other detection method active in setup + channelnumber=cDevice::PrimaryDevice()->CurrentChannel(); + if (mLastChannel==0) + { + mLastChannel=channelnumber; + } + + const cChannel *channel=Channels.GetByNumber(channelnumber); + + if (channel != NULL && !channel->GroupSep()) + { + cSchedulesLock schedLock; + const cSchedules *scheds = cSchedules::Schedules(schedLock); + + if (scheds == NULL) + { + return; + } + + const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); + if (sched == NULL) + { + return; + } + + const cEvent *present = sched->GetPresentEvent(); + const cEvent *follow = sched->GetFollowingEvent(); + + if (present == NULL) + { + return; + } + + //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); + cControl::Launch(new cControlBlock(mLastChannel, channel, present, follow)); + mLastChannel=0; + } + } +} + + + + VDRPLUGINCREATOR(cPluginBlock); // Don't touch this! @@ -14,7 +14,8 @@ cSetupBlock SetupBlock; cSetupBlock::cSetupBlock(void): HideMenuEntry(0), - MessageTimeout(2) + MessageTimeout(2), + DetectionMethod(0) { } @@ -22,6 +23,7 @@ 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); else return false; return true; } @@ -12,7 +12,8 @@ class cSetupBlock { public: int HideMenuEntry; int MessageTimeout; - + int DetectionMethod; + cSetupBlock(void); bool Parse(const char *Name, const char *Value); }; @@ -30,7 +30,8 @@ cControlBlock::cControlBlock(int LastChannel, const cChannel *Channel, const cEv #else needsFastResponse = true; #endif - cRemote::Put(kOk, true); // Hide OSD + + cRemote::Put(kBack,true); //Hide OSD new version } cControlBlock::~cControlBlock() @@ -63,6 +64,7 @@ cControlBlock::~cControlBlock() direction = 1; if (!cDevice::SwitchChannel(direction) && (mLastChannel != 0)) Channels.SwitchTo(mLastChannel); + } } @@ -157,6 +157,81 @@ const tI18nPhrase Phrases[] = { "", #endif }, + { "Detection Method", + "Methode", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +#if VDRVERSNUM >= 10313 + "", +#endif +#if VDRVERSNUM >= 10316 + "", +#endif + }, + { "On Switch", + "Beim Umschalten", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +#if VDRVERSNUM >= 10313 + "", +#endif +#if VDRVERSNUM >= 10316 + "", +#endif + }, + { "Channel EPG", + "Kanal EPG", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +#if VDRVERSNUM >= 10313 + "", +#endif +#if VDRVERSNUM >= 10316 + "", +#endif + }, { "Edit", "Editieren", "", diff --git a/po/de_DE.po b/po/de_DE.po index de5f09a..89c897e 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ 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-04-27 14:26+0200\n" +"POT-Creation-Date: 2010-06-02 19:00+0200\n" "PO-Revision-Date: 2010-04-27 14:19+0200\n" "Last-Translator: Klaus Schmidinger <kls@cadsoft.de>\n" "Language-Team: <vdr@linuxtv.org>\n" @@ -33,6 +33,15 @@ msgstr "Hauptmenüeintrag verstecken" msgid "Message Timeout [s]" msgstr "Wartezeit bis Umschalten [s]" +msgid "On Switch" +msgstr "" + +msgid "Channel EPG" +msgstr "" + +msgid "Detection Method" +msgstr "" + msgid "--- Keywords -------------------------------------------------------------------" msgstr "--- Schlagworte ----------------------------------------------------------------" @@ -26,6 +26,11 @@ void cMenuSetupBlock::Set(void) { Add(new cMenuEditBoolItem(tr("Hide Mainmenu Entry"), &mSetupData.HideMenuEntry)); Add(new cMenuEditIntItem(tr("Message Timeout [s]"), &mSetupData.MessageTimeout, 0, 10)); + DetectionMethods[0] = tr("On Switch"); + DetectionMethods[1] = tr("Channel EPG"); + + Add(new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods)); + item = new cOsdItem(""); item->SetSelectable(false); Add(item); @@ -34,7 +39,7 @@ void cMenuSetupBlock::Set(void) { item->SetSelectable(false); Add(item); -#define NONKEYWORDITEMS 4 +#define NONKEYWORDITEMS 5 int index = 0; cEventBlock *event = mEventsData.First(); @@ -71,6 +76,7 @@ void cMenuSetupBlock::Store(void) SetupBlock = mSetupData; SetupStore("HideMenuEntry", SetupBlock.HideMenuEntry); SetupStore("MessageTimeout", SetupBlock.MessageTimeout); + SetupStore("DetectionMethod", SetupBlock.DetectionMethod); } eOSState cMenuSetupBlock::Edit(void) @@ -17,6 +17,7 @@ class cMenuSetupBlock : public cMenuSetupPage { private: cEventsBlock mEventsData; cSetupBlock mSetupData; + const char *DetectionMethods[2]; protected: virtual void Store(void); @@ -10,6 +10,7 @@ #include "status.h" #include "control.h" #include "event.h" +#include "config.h" cStatusBlock::cStatusBlock(void): cStatus(), @@ -19,7 +20,12 @@ cStatusBlock::cStatusBlock(void): void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) { - printf("cStatusBlock::ChannelSwitch(%p, %d)\n", Device, ChannelNumber); + if (SetupBlock.DetectionMethod!=0) + { +// dsyslog("plugin-block-DEV: StatusBlock::ChannelSwitch did nothing: Detection Method didn't match"); + return; + } + //printf("cStatusBlock::ChannelSwitch(%p, %d)\n", Device, ChannelNumber); #ifdef LOGGING dsyslog("plugin-block: cStatusBlock was informed about channel switch at device %d, channel no %d",Device->DeviceNumber(),ChannelNumber); @@ -75,29 +81,26 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) return; } - const cChannel *channel = Channels.GetByNumber(ChannelNumber); - if (channel != NULL && !channel->GroupSep()) { - cSchedulesLock schedLock; - const cSchedules *scheds = cSchedules::Schedules(schedLock); - if (scheds == NULL) - return; + const cChannel *channel = Channels.GetByNumber(ChannelNumber); + if (channel != NULL && !channel->GroupSep()) + { + cSchedulesLock schedLock; + const cSchedules *scheds = cSchedules::Schedules(schedLock); + if (scheds == NULL) return; - const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); - if (sched == NULL) - return; + const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); + if (sched == NULL) return; - const cEvent *present = sched->GetPresentEvent(); - const cEvent *follow = sched->GetFollowingEvent(); - if (present == NULL) - return; + const cEvent *present = sched->GetPresentEvent(); + const cEvent *follow = sched->GetFollowingEvent(); + if (present == NULL) return; - if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) { - isyslog("plugin-block: channel %d is not acceptable at present", ChannelNumber); - cControl::Launch(new cControlBlock(mLastChannel, channel, present, follow)); - mLastChannel=0; - } - } - - + if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) + { + isyslog("plugin-block: channel %d is not acceptable at present", ChannelNumber); + cControl::Launch(new cControlBlock(mLastChannel, channel, present, follow)); + mLastChannel=0; + } + } } |