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/status.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 block/status.c (limited to 'block/status.c') diff --git a/block/status.c b/block/status.c new file mode 100644 index 0000000..64b9d85 --- /dev/null +++ b/block/status.c @@ -0,0 +1,103 @@ +/** + * based on status.c,v 1.2 2007/05/08 10:16:23 thomas + * + * version by Midas + * + */ + +#include + +#include "status.h" +#include "control.h" +#include "event.h" + +cStatusBlock::cStatusBlock(void): + cStatus(), + mLastChannel(0) // int +{ +} + +void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) +{ + 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); + dsyslog("plugin-block: cDevice::CurrentChannel %d",cDevice::CurrentChannel()); + dsyslog("plugin-block: Device %d, ActualDevice %d, primary Device %d",Device->DeviceNumber(),cDevice::ActualDevice()->DeviceNumber(),cDevice::PrimaryDevice()->DeviceNumber()); + for (int ii=0;iiReplaying(),tmpdev->Transferring()); + } +#endif + + + if (Device->DeviceNumber()!=cDevice::PrimaryDevice()->DeviceNumber()) + { +#ifdef LOGGING + dsyslog("plugin-block: Did nothing cause ChannelSwitch not on active livedevice."); +#endif + return; + } + + if (mLastChannel==0) + { +#ifdef LOGGING + dsyslog("plugin-block: Did nothing cause mLastChannel=0 (set to %d)",cDevice::CurrentChannel()); +#endif + mLastChannel=cDevice::CurrentChannel(); + return; + } + + if (ChannelNumber==0) + { + mLastChannel=cDevice::CurrentChannel(); +#ifdef LOGGING + dsyslog("plugin-block: Did nothing because ChannelNumber=0 (some switch is in progress)"); +#endif + return; //seems that switching is in progress + } + + if (ChannelNumber!=cDevice::CurrentChannel()) + { +#ifdef LOGGING + dsyslog("plugin-block: Did nothing because ChannelNumber!=CurrentChannel (switch still in progress)"); +#endif + return; + } + + if (Device->Replaying()) + { +#ifdef LOGGING + dsyslog("plugin-block: Did nothing because Device is Replaying"); +#endif + 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 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; + } + } + + +} + -- cgit v1.2.3