diff options
Diffstat (limited to 'epghandler.c')
-rw-r--r-- | epghandler.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/epghandler.c b/epghandler.c index 2e50c33..ecf5de9 100644 --- a/epghandler.c +++ b/epghandler.c @@ -8,14 +8,17 @@ #include "epghandler.h" #if APIVERSNUM > 10725 #include "log.h" +#include "equivhandler.h" #include <vdr/sources.h> cEEpgHandler::cEEpgHandler() { LogD(4, prep("cEEpgHandler()")); - + equivHandler = new cEquivHandler(); } cEEpgHandler::~cEEpgHandler() { + delete equivHandler; + equivHandler = NULL; } bool cEEpgHandler::HandleEitEvent(cSchedule* Schedule, @@ -26,6 +29,19 @@ bool cEEpgHandler::HandleEitEvent(cSchedule* Schedule, int nid = Schedule->ChannelID().Nid(); if ((nid >= 0x1001 && nid <= 0x100B) || nid == 0x101 || nid == 0x100) return true; + + //TODO!!! not for commit upsteram + if (EitEvent->getDurationHour() > 10) { + LogD(3, prep("Event longer than 10h Duration:%d DurationHour:%d StartTimeHour:%d"), EitEvent->getDuration(), EitEvent->getDurationHour(), EitEvent->getStartTimeHour()); + const cEvent* exEvent = Schedule->GetEventAround(EitEvent->getStartTime()+EitEvent->getDuration()/2); + if (exEvent) { + LogD(3, prep("10h Existing event %s startTime %d"), exEvent->Title(), exEvent->StartTime()); + return true; + } + } + //if (EitEvent->getDurationHour() > 3) +// return true; + return false; // return true; } @@ -107,6 +123,19 @@ bool cEEpgHandler::HandleEvent(cEvent* Event) { if (!Event->Description() && !origDescription.empty()) { Event->SetDescription(origDescription.c_str()); } + + if (equivHandler->getEquiChanMap().count(*Event->ChannelID().ToString()) <= 0) + return true; + + equivHandler->updateEquivalent(Event->ChannelID(), Event); + +// cSchedulesLock SchedulesLock (true); +// cSchedules *s = (cSchedules *) cSchedules::Schedules (SchedulesLock); +// if (s) { +// equivHandler->updateEquivalent(s, Event->ChannelID(), Event); +// } else +// LogE (0, prep("Error: could not lock schedules.")); + //TODO just to see the difference //else if (!origDescription.empty() && !origDescription.compare(Event->Description())) { // origDescription.append(" | EIT: "); @@ -118,7 +147,17 @@ bool cEEpgHandler::HandleEvent(cEvent* Event) { } bool cEEpgHandler::SortSchedule(cSchedule* Schedule) { + Schedule->Sort(); + + //NOK +// cSchedulesLock SchedulesLock (true); +// cSchedules *s = (cSchedules *) cSchedules::Schedules (SchedulesLock); +// if (s) { +// equivHandler->sortEquivalents(Schedule->ChannelID(), s); +// } else +// LogE (0, prep("Error: could not lock schedules.")); + return true; } |