summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitar Petrovski <dimeptr@gmail.com>2012-10-20 10:46:13 (GMT)
committerDimitar Petrovski <dimeptr@gmail.com>2012-10-20 10:46:13 (GMT)
commit296fe61d7cf2f10dabd762ba29fe1cbf5a3368c5 (patch)
tree0d4e1f26af870932f2f02aae2a5abbf2e8b00825
parentee3d6a70f2a8ed41acd1d2f7f68843d90679737a (diff)
downloadvdr-plugin-eepg-296fe61d7cf2f10dabd762ba29fe1cbf5a3368c5.tar.gz
vdr-plugin-eepg-296fe61d7cf2f10dabd762ba29fe1cbf5a3368c5.tar.bz2
removed some valgrind warinigs
try: optimize the sort schedule in add event thread optimize updating of equivalent channels fix deletion of theme and category on eit update
-rw-r--r--eepg.c2
-rw-r--r--epghandler.c17
-rw-r--r--epghandler.h1
-rw-r--r--util.c10
4 files changed, 25 insertions, 5 deletions
diff --git a/eepg.c b/eepg.c
index 6091915..2ba6008 100644
--- a/eepg.c
+++ b/eepg.c
@@ -238,6 +238,8 @@ public:
cFilterEEPG::cFilterEEPG (void)
{
+ nSummaries = 0;
+ nTitles = 0;
Trigger ();
//Set (0x00, 0x00);
}
diff --git a/epghandler.c b/epghandler.c
index 3aaec2e..eea1f09 100644
--- a/epghandler.c
+++ b/epghandler.c
@@ -16,6 +16,7 @@
cEEpgHandler::cEEpgHandler() {
LogD(4, prep("cEEpgHandler()"));
equivHandler = new cEquivHandler();
+ modified = false;
}
cEEpgHandler::~cEEpgHandler() {
@@ -48,6 +49,7 @@ bool cEEpgHandler::HandleEitEvent(cSchedule* Schedule,
}
}
+ modified = false;
//VDR creates new event if the EitEvent StartTime is different than EEPG time so
//the EEPG event has to be deleted but the data should be kept
const cEvent* ev = Schedule->GetEvent(EitEvent->getEventId(),EitEvent->getStartTime());
@@ -63,6 +65,7 @@ bool cEEpgHandler::HandleEitEvent(cSchedule* Schedule,
origShortText = ev->ShortText();
Schedule->DropOutdated(ev->StartTime()-1,ev->EndTime()+1,ev->TableID()-1,ev->Version());
LogD(0, prep("!!!End Deleting Event"));
+ //TODO equivalent channels !!!
}
}
@@ -80,8 +83,11 @@ bool cEEpgHandler::SetEventID(cEvent* Event, tEventID EventID) {
bool cEEpgHandler::SetTitle(cEvent* Event, const char* Title) {
LogD(3, prep("Event id:%d title:%s new title:%s"), Event->EventID(), Event->Title(), Title);
- if (!Event->Title() || (Title && (!strcmp(Event->Title(),"") || (strcmp(Title,"") && strcmp(Event->Title(),Title)))))
+ if (!Event->Title() || (Title && (!strcmp(Event->Title(),"") || (strcmp(Title,"") && strcmp(Event->Title(),Title))))) {
+ //LogD(0, prep("Event id:%d title:%s new title:%s"), Event->EventID(), Event->Title(), Title);
+ modified = true;
Event->SetTitle(Title);
+ }
return true;
}
@@ -107,6 +113,10 @@ bool cEEpgHandler::SetDescription(cEvent* Event, const char* Description) {
origDescription = Event->Description();
else
origDescription.clear();
+
+ //Based on asumption that SetDescription is always called after SetTitle
+ if (!modified && Description && (!Event->Description() || strcmp(Event->Description(),Description) ))
+ modified = true;
//if (!Event->Description() || Description && (!strcmp(Event->Description(),"") || (strcmp(Description,"") && strcmp(Event->Description(),Description))))
Event->SetDescription(Description);
@@ -146,14 +156,15 @@ bool cEEpgHandler::HandleEvent(cEvent* Event) {
if (!Event->ShortText() || !strcmp(Event->ShortText(),""))
Event->SetShortText(origShortText.c_str());
- if (!Event->Description() && !origDescription.empty()) {
+ if ((!Event->Description() && !origDescription.empty()) || (Event->Description() && !origDescription.empty() && origDescription.find(Event->Description()) != string::npos) ) {
Event->SetDescription(origDescription.c_str());
}
if (equivHandler->getEquiChanMap().count(*Event->ChannelID().ToString()) <= 0)
return true;
- equivHandler->updateEquivalent(Event->ChannelID(), Event);
+ if (modified)
+ equivHandler->updateEquivalent(Event->ChannelID(), Event);
// cSchedulesLock SchedulesLock (true);
// cSchedules *s = (cSchedules *) cSchedules::Schedules (SchedulesLock);
diff --git a/epghandler.h b/epghandler.h
index 4e60e57..003fd32 100644
--- a/epghandler.h
+++ b/epghandler.h
@@ -41,6 +41,7 @@ private:
std::string origDescription;
cEquivHandler* equivHandler;
static const int _LONG_EVENT_HOURS = 10;
+ bool modified;
};
#endif /*APIVERSNUM > 10725*/
diff --git a/util.c b/util.c
index 2683131..92164a6 100644
--- a/util.c
+++ b/util.c
@@ -183,11 +183,17 @@ void cAddEventThread::Action(void)
cSchedules *schedules = (cSchedules *)cSchedules::Schedules(SchedulesLock);
Lock();
while (schedules && (e = list->First()) != NULL) {
+ tChannelID chID = e->GetChannelID();
cSchedule *schedule = (cSchedule *)schedules->GetSchedule(Channels.GetByChannelID(e->GetChannelID()), true);
+ while (schedules && (e = list->First()) != NULL) {
+
+ if (chID == e->GetChannelID()) {
schedule->AddEvent(e->GetEvent());
- EpgHandlers.SortSchedule(schedule);
- EpgHandlers.DropOutdated(schedule, e->GetEvent()->StartTime(), e->GetEvent()->EndTime(), e->GetEvent()->TableID(), e->GetEvent()->Version());
list->Del(e);
+ }
+ }
+ EpgHandlers.SortSchedule(schedule);
+// EpgHandlers.DropOutdated(schedule, e->GetEvent()->StartTime(), e->GetEvent()->EndTime(), e->GetEvent()->TableID(), e->GetEvent()->Version());
}
Unlock();
cCondWait::SleepMs(10);