From 4921cf32c8bda089a21dc4a14ce191ed477f80ff Mon Sep 17 00:00:00 2001 From: Midas Date: Thu, 22 Apr 2010 01:06:40 +0200 Subject: Initial release. Version 0.0.1b. Fork of the taste plugin 0.0.2d by LordJaxom. Patches for the taste plugin by tomg and mapovi were added permanently to the source of the block plugin. For more information, feature list und bugfixes read HISTORY and README please. --- block/block.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 block/block.c (limited to 'block/block.c') diff --git a/block/block.c b/block/block.c new file mode 100644 index 0000000..0e3cf37 --- /dev/null +++ b/block/block.c @@ -0,0 +1,96 @@ +/** + * block.c: A plugin for the Video Disk Recorder + * + * based on taste.c v 1.1.1.1 2006/02/26 14:11:02 by lordjaxom + * + * See the README file for copyright and contact information. + * + * version by Midas + * + */ + +#include + +#include "status.h" +#include "event.h" +#include "setup.h" +#include "config.h" +#include "i18n.h" + +static const char *VERSION = "0.0.1b"; +static const char *DESCRIPTION = trNOOP("Lock unwanted shows by keywords"); +static const char *MAINMENUENTRY = trNOOP("Schedule not acceptable"); + +class cPluginBlock : public cPlugin { +private: + cStatusBlock *mStatus; + +public: + cPluginBlock(void); + virtual ~cPluginBlock(); + virtual const char *Version(void) { return VERSION; } + virtual const char *Description(void) { return tr(DESCRIPTION); } + virtual bool Initialize(void); + virtual bool Start(void); + virtual const char *MainMenuEntry(void) { return SetupBlock.HideMenuEntry ? NULL : tr(MAINMENUENTRY); } + virtual cOsdObject *MainMenuAction(void); + virtual cMenuSetupPage *SetupMenu(void); + virtual bool SetupParse(const char *Name, const char *Value); + }; + +cPluginBlock::cPluginBlock(void): + cPlugin(), + mStatus(NULL) +{ +} + +cPluginBlock::~cPluginBlock() +{ + delete mStatus; +} + +bool cPluginBlock::Initialize(void) +{ + return EventsBlock.Load(AddDirectory(cPlugin::ConfigDirectory(), "block.conf"), true, false); +} + +bool cPluginBlock::Start(void) +{ +#if VDRVERSNUM < 10507 + RegisterI18n(Phrases); +#endif + mStatus = new cStatusBlock(); + return true; +} + +cOsdObject *cPluginBlock::MainMenuAction(void) +{ + const cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); + if (channel != NULL && !channel->GroupSep()) { + cSchedulesLock schedLock; + const cSchedules *scheds = cSchedules::Schedules(schedLock); + if (scheds == NULL) + return NULL; + + const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); + if (sched == NULL) + return NULL; + + const cEvent *present = sched->GetPresentEvent(); + EventsBlock.Add(new cEventBlock(present->Title())); + EventsBlock.Save(); + } + return NULL; +} + +cMenuSetupPage *cPluginBlock::SetupMenu(void) +{ + return new cMenuSetupBlock(); +} + +bool cPluginBlock::SetupParse(const char *Name, const char *Value) +{ + return SetupBlock.Parse(Name, Value); +} + +VDRPLUGINCREATOR(cPluginBlock); // Don't touch this! -- cgit v1.2.3