diff options
-rw-r--r-- | conflictcheck.c | 26 | ||||
-rw-r--r-- | conflictcheck.h | 5 | ||||
-rw-r--r-- | epgsearchsvdrp.c | 4 | ||||
-rw-r--r-- | menu_conflictcheck.c | 2 | ||||
-rw-r--r-- | services.c | 4 |
5 files changed, 31 insertions, 10 deletions
diff --git a/conflictcheck.c b/conflictcheck.c index 6c9b460..2040665 100644 --- a/conflictcheck.c +++ b/conflictcheck.c @@ -35,7 +35,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch #define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration. // --- cConflictCheckTimerObj -------------------------------------------------------- -cConflictCheckTimerObj::cConflictCheckTimerObj(cTimer* Timer, time_t Start, time_t Stop, int Device) : cTimerObj(Timer), start(Start), stop(Stop), device(Device), conflCheckTime(NULL), concurrentTimers(NULL), ignore(false) +cConflictCheckTimerObj::cConflictCheckTimerObj(cTimer* Timer, time_t Start, time_t Stop, int Device, int OrigIndex) : cTimerObj(Timer), start(Start), stop(Stop), device(Device), origIndex(OrigIndex), conflCheckTime(NULL), concurrentTimers(NULL), ignore(false) { event = Timer->Event(); recDuration = 0; @@ -43,6 +43,12 @@ cConflictCheckTimerObj::cConflictCheckTimerObj(cTimer* Timer, time_t Start, time lastRecStop = 0; } +cConflictCheckTimerObj::~cConflictCheckTimerObj() +{ + // conflict checks works on a copy of a timer, so delete it again + delete timer; +} + int cConflictCheckTimerObj::Compare(const cListObject &ListObject) const { cConflictCheckTimerObj *p = (cConflictCheckTimerObj *)&ListObject; @@ -50,7 +56,7 @@ int cConflictCheckTimerObj::Compare(const cListObject &ListObject) const if (diff == 0) diff = p->timer->Priority() - timer->Priority(); if (diff == 0) - diff = timer->Index() - p->timer->Index(); + diff = origIndex - p->origIndex; return diff; } @@ -233,7 +239,13 @@ cList<cConflictCheckTimerObj>* cConflictCheck::CreateCurrentTimerList() if (!ti->IsSingleEvent()) continue; // already recording? int deviceNr = gl_recStatusMonitor->TimerRecDevice(ti)-1; - cConflictCheckTimerObj* timerObj = new cConflictCheckTimerObj(ti, ti->StartTime(), ti->StopTime(), deviceNr); + + // create a copy of this timer + cTimer* clone = new cTimer; + *clone = *ti; + clone->SetEvent(ti->Event()); + + cConflictCheckTimerObj* timerObj = new cConflictCheckTimerObj(clone, ti->StartTime(), ti->StopTime(), deviceNr, ti->Index()); if (deviceNr >= 0) { devices[deviceNr].recTimers.insert(timerObj); @@ -280,7 +292,13 @@ cList<cConflictCheckTimerObj>* cConflictCheck::CreateCurrentTimerList() day += SECSINDAY; continue; } - cConflictCheckTimerObj* timerObj = new cConflictCheckTimerObj(ti, Start, Start + ti->StopTime() - ti->StartTime(), deviceNr); + + // create a copy of this timer + cTimer* clone = new cTimer; + *clone = *ti; + clone->SetEvent(ti->Event()); + + cConflictCheckTimerObj* timerObj = new cConflictCheckTimerObj(ti, Start, Start + ti->StopTime() - ti->StartTime(), deviceNr, ti->Index()); LogFile.Log(3,"add timer '%s' (%s, channel %s) for conflict check", ti->File(), DAYDATETIME(Start), CHANNELNAME(ti->Channel())); if (deviceNr >= 0) { diff --git a/conflictcheck.h b/conflictcheck.h index ea86fb0..307883b 100644 --- a/conflictcheck.h +++ b/conflictcheck.h @@ -43,6 +43,7 @@ class cConflictCheckTimerObj : public cTimerObj time_t start; time_t stop; int device; + int origIndex; int recDuration; time_t lastRecStart; time_t lastRecStop; @@ -50,7 +51,9 @@ class cConflictCheckTimerObj : public cTimerObj std::set<cConflictCheckTimerObj*,TimerObjSort>* concurrentTimers; bool ignore; - cConflictCheckTimerObj(cTimer* Timer, time_t Start, time_t Stop, int Device = -1); + + cConflictCheckTimerObj(cTimer* Timer, time_t Start, time_t Stop, int Device = -1, int OrigIndex=-1); + ~cConflictCheckTimerObj(); int Compare(const cListObject &ListObject) const; const cEvent* Event(); const cEvent* SetEventFromSchedule(); diff --git a/epgsearchsvdrp.c b/epgsearchsvdrp.c index bd02917..6426eb9 100644 --- a/epgsearchsvdrp.c +++ b/epgsearchsvdrp.c @@ -1268,13 +1268,13 @@ cString cPluginEpgsearch::SVDRPCommand(const char *Command, const char *Option, if (relOnly && (*it)->ignore) continue; std::ostringstream timerpart; int recPart = (*it)->recDuration * 100 / ((*it)->stop - (*it)->start); - timerpart << (*it)->timer->Index()+1 << "|" << recPart << "|"; + timerpart << (*it)->origIndex+1 << "|" << recPart << "|"; std::set<cConflictCheckTimerObj*,TimerObjSort>::iterator itcc; if ((*it)->concurrentTimers) { std::ostringstream cctimers; for (itcc = (*it)->concurrentTimers->begin(); itcc != (*it)->concurrentTimers->end(); itcc++) - cctimers << (cctimers.str().empty()?"":"#") << (*itcc)->timer->Index()+1; + cctimers << (cctimers.str().empty()?"":"#") << (*itcc)->origIndex+1; timerpart << cctimers.str(); } timerparts << (timerparts.str().empty()?"":":") << timerpart.str(); diff --git a/menu_conflictcheck.c b/menu_conflictcheck.c index de56ce6..8027711 100644 --- a/menu_conflictcheck.c +++ b/menu_conflictcheck.c @@ -400,7 +400,7 @@ eOSState cMenuConflictCheckDetails::ProcessKey(eKeys Key) for(cTimer* checkT = Timers.First(); checkT; checkT = Timers.Next(checkT)) { checkT->Matches(); - if (checkT == (*it)->timer) // ok -> found, check for changes + if (checkT == Timers.GetTimer((*it)->timer)) // ok -> found, check for changes { if (checkT->IsSingleEvent()) { @@ -297,13 +297,13 @@ std::list<std::string> cEpgsearchServiceHandler::TimerConflictList(bool relOnly) if (relOnly && (*it)->ignore) continue; std::ostringstream timerpart; int recPart = (*it)->recDuration * 100 / ((*it)->stop - (*it)->start); - timerpart << (*it)->timer->Index()+1 << "|" << recPart << "|"; + timerpart << (*it)->origIndex+1 << "|" << recPart << "|"; std::set<cConflictCheckTimerObj*,TimerObjSort>::iterator itcc; if ((*it)->concurrentTimers) { std::ostringstream cctimers; for (itcc = (*it)->concurrentTimers->begin(); itcc != (*it)->concurrentTimers->end(); itcc++) - cctimers << (cctimers.str().empty()?"":"#") << (*itcc)->timer->Index()+1; + cctimers << (cctimers.str().empty()?"":"#") << (*itcc)->origIndex+1; timerpart << cctimers.str(); } timerparts << (timerparts.str().empty()?"":":") << timerpart.str(); |