mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed fetching the current/next information
This commit is contained in:
parent
10a7cf33d6
commit
e46c1b1aff
5
HISTORY
5
HISTORY
@ -1580,7 +1580,10 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed a bug when pressing the "Blue" button in the main menu without having
|
- Fixed a bug when pressing the "Blue" button in the main menu without having
|
||||||
displayed it (thanks to Oliver Endriss for reporting this one).
|
displayed it (thanks to Oliver Endriss for reporting this one).
|
||||||
|
|
||||||
2002-10-06: Version 1.1.13
|
2002-10-07: Version 1.1.13
|
||||||
|
|
||||||
- Added cDevice::DeviceNumber() to get the number of a device, not counting any
|
- Added cDevice::DeviceNumber() to get the number of a device, not counting any
|
||||||
gaps that might be in the index count.
|
gaps that might be in the index count.
|
||||||
|
- Fixed fetching the current/next information to handle cases where the duration
|
||||||
|
of an event is set wrongly and would last beyond the start time of the next
|
||||||
|
event.
|
||||||
|
80
eit.c
80
eit.c
@ -16,7 +16,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* $Id: eit.c 1.54 2002/10/06 10:31:38 kls Exp $
|
* $Id: eit.c 1.55 2002/10/07 16:24:04 kls Exp $
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
@ -629,50 +629,26 @@ cEventInfo *cSchedule::AddEvent(cEventInfo *EventInfo)
|
|||||||
return EventInfo;
|
return EventInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
const cEventInfo *cSchedule::GetPresentEvent(void) const
|
||||||
const cEventInfo * cSchedule::GetPresentEvent() const
|
|
||||||
{
|
{
|
||||||
// checking temporal sanity of present event (kls 2000-11-01)
|
return GetEventAround(time(NULL));
|
||||||
time_t now = time(NULL);
|
|
||||||
//XXX if (pPresent && !(pPresent->GetTime() <= now && now <= pPresent->GetTime() + pPresent->GetDuration()))
|
|
||||||
{
|
|
||||||
cEventInfo *pe = Events.First();
|
|
||||||
while (pe != NULL)
|
|
||||||
{
|
|
||||||
if (pe->GetTime() <= now && now <= pe->GetTime() + pe->GetDuration())
|
|
||||||
return pe;
|
|
||||||
pe = Events.Next(pe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;//XXX
|
|
||||||
return pPresent;
|
|
||||||
}
|
}
|
||||||
/** */
|
|
||||||
const cEventInfo * cSchedule::GetFollowingEvent() const
|
const cEventInfo *cSchedule::GetFollowingEvent(void) const
|
||||||
{
|
{
|
||||||
// checking temporal sanity of following event (kls 2000-11-01)
|
const cEventInfo *pe = NULL;
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
const cEventInfo *pr = GetPresentEvent(); // must have it verified!
|
time_t delta = INT_MAX;
|
||||||
if (pr)//XXX if (pFollowing && !(pr && pr->GetTime() + pr->GetDuration() <= pFollowing->GetTime()))
|
for (cEventInfo *p = Events.First(); p; p = Events.Next(p)) {
|
||||||
{
|
time_t dt = p->GetTime() - now;
|
||||||
int minDt = INT_MAX;
|
if (dt > 0 && dt < delta) {
|
||||||
cEventInfo *pe = Events.First(), *pf = NULL;
|
delta = dt;
|
||||||
while (pe != NULL)
|
pe = p;
|
||||||
{
|
|
||||||
int dt = pe->GetTime() - now;
|
|
||||||
if (dt > 0 && dt < minDt)
|
|
||||||
{
|
|
||||||
minDt = dt;
|
|
||||||
pf = pe;
|
|
||||||
}
|
}
|
||||||
pe = Events.Next(pe);
|
|
||||||
}
|
}
|
||||||
return pf;
|
return pe;
|
||||||
}
|
|
||||||
return NULL;//XXX
|
|
||||||
return pFollowing;
|
|
||||||
}
|
}
|
||||||
/** */
|
|
||||||
void cSchedule::SetServiceID(unsigned short servid)
|
void cSchedule::SetServiceID(unsigned short servid)
|
||||||
{
|
{
|
||||||
uServiceID = servid;
|
uServiceID = servid;
|
||||||
@ -701,21 +677,21 @@ const cEventInfo * cSchedule::GetEvent(unsigned short uEventID, time_t tTime) co
|
|||||||
|
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
/** */
|
|
||||||
const cEventInfo * cSchedule::GetEventAround(time_t tTime) const
|
const cEventInfo *cSchedule::GetEventAround(time_t Time) const
|
||||||
{
|
{
|
||||||
cEventInfo *pe = Events.First();
|
const cEventInfo *pe = NULL;
|
||||||
while (pe != NULL)
|
time_t delta = INT_MAX;
|
||||||
{
|
for (cEventInfo *p = Events.First(); p; p = Events.Next(p)) {
|
||||||
if (pe->GetTime() <= tTime && tTime <= pe->GetTime() + pe->GetDuration())
|
time_t dt = Time - p->GetTime();
|
||||||
return pe;
|
if (dt >= 0 && dt < delta && p->GetTime() + p->GetDuration() >= Time) {
|
||||||
|
delta = dt;
|
||||||
pe = Events.Next(pe);
|
pe = p;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return pe;
|
||||||
}
|
}
|
||||||
/** */
|
|
||||||
bool cSchedule::SetPresentEvent(cEventInfo *pEvent)
|
bool cSchedule::SetPresentEvent(cEventInfo *pEvent)
|
||||||
{
|
{
|
||||||
if (pPresent != NULL)
|
if (pPresent != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user