1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

When looking for the present or following EPG event, the running status is now always taken into account

This commit is contained in:
Klaus Schmidinger 2006-01-29 14:04:37 +01:00
parent 778a6b47ca
commit ea9a7eebd1
4 changed files with 19 additions and 18 deletions

View File

@ -4262,3 +4262,5 @@ Video Disk Recorder Revision History
- Implemented a timeout for remote controls that don't deliver "repeat" keypresses - Implemented a timeout for remote controls that don't deliver "repeat" keypresses
very fast (based on a suggestion by Luca Olivetti; problem with the new handling very fast (based on a suggestion by Luca Olivetti; problem with the new handling
of k_Repeat keypresses in channel switching reported by Udo Richter). of k_Repeat keypresses in channel switching reported by Udo Richter).
- When looking for the present or following EPG event, the running status is now
always taken into account.

19
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.c 1.55 2006/01/29 13:00:26 kls Exp $ * $Id: epg.c 1.56 2006/01/29 14:04:04 kls Exp $
*/ */
#include "epg.h" #include "epg.h"
@ -16,6 +16,8 @@
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>
#define RUNNINGSTATUSTIMEOUT 30 // seconds before the running status is considered unknown
// --- tComponent ------------------------------------------------------------ // --- tComponent ------------------------------------------------------------
cString tComponent::ToString(void) cString tComponent::ToString(void)
@ -204,7 +206,7 @@ bool cEvent::HasTimer(void) const
bool cEvent::IsRunning(bool OrAboutToStart) const bool cEvent::IsRunning(bool OrAboutToStart) const
{ {
return runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing); return SeenWithin(RUNNINGSTATUSTIMEOUT) && runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing);
} }
cString cEvent::GetDateString(void) const cString cEvent::GetDateString(void) const
@ -658,25 +660,22 @@ void cSchedule::UnhashEvent(cEvent *Event)
eventsHashStartTime.Del(Event, Event->StartTime()); eventsHashStartTime.Del(Event, Event->StartTime());
} }
const cEvent *cSchedule::GetPresentEvent(bool CheckRunningStatus) const const cEvent *cSchedule::GetPresentEvent(void) const
{ {
const cEvent *pe = NULL; const cEvent *pe = NULL;
time_t now = time(NULL); time_t now = time(NULL);
for (cEvent *p = events.First(); p; p = events.Next(p)) { for (cEvent *p = events.First(); p; p = events.Next(p)) {
if (p->StartTime() <= now && now < p->EndTime()) { if (p->StartTime() <= now && now < p->EndTime())
pe = p; pe = p;
if (!CheckRunningStatus) if (p->SeenWithin(RUNNINGSTATUSTIMEOUT) && p->RunningStatus() >= SI::RunningStatusPausing)
break;
}
if (CheckRunningStatus && p->SeenWithin(30) && p->RunningStatus() >= SI::RunningStatusPausing)
return p; return p;
} }
return pe; return pe;
} }
const cEvent *cSchedule::GetFollowingEvent(bool CheckRunningStatus) const const cEvent *cSchedule::GetFollowingEvent(void) const
{ {
const cEvent *p = GetPresentEvent(CheckRunningStatus); const cEvent *p = GetPresentEvent();
if (p) if (p)
p = events.Next(p); p = events.Next(p);
return p; return p;

6
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by * Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>. * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* *
* $Id: epg.h 1.29 2006/01/14 15:45:24 kls Exp $ * $Id: epg.h 1.30 2006/01/29 14:03:13 kls Exp $
*/ */
#ifndef __EPG_H #ifndef __EPG_H
@ -137,8 +137,8 @@ public:
void HashEvent(cEvent *Event); void HashEvent(cEvent *Event);
void UnhashEvent(cEvent *Event); void UnhashEvent(cEvent *Event);
const cList<cEvent> *Events(void) const { return &events; } const cList<cEvent> *Events(void) const { return &events; }
const cEvent *GetPresentEvent(bool CheckRunningStatus = false) const; const cEvent *GetPresentEvent(void) const;
const cEvent *GetFollowingEvent(bool CheckRunningStatus = false) const; const cEvent *GetFollowingEvent(void) const;
const cEvent *GetEvent(u_int16_t EventID, time_t StartTime = 0) const; const cEvent *GetEvent(u_int16_t EventID, time_t StartTime = 0) const;
const cEvent *GetEventAround(time_t Time) const; const cEvent *GetEventAround(time_t Time) const;
void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const; void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const;

10
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.406 2006/01/29 11:13:51 kls Exp $ * $Id: menu.c 1.407 2006/01/29 14:04:37 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1245,7 +1245,7 @@ void cMenuSchedule::PrepareScheduleAllThis(const cEvent *Event, const cChannel *
if (schedules && Channel) { if (schedules && Channel) {
const cSchedule *Schedule = schedules->GetSchedule(Channel); const cSchedule *Schedule = schedules->GetSchedule(Channel);
if (Schedule) { if (Schedule) {
const cEvent *PresentEvent = Event ? Event : Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel()); const cEvent *PresentEvent = Event ? Event : Schedule->GetPresentEvent();
time_t now = time(NULL) - Setup.EPGLinger * 60; time_t now = time(NULL) - Setup.EPGLinger * 60;
for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) { for (const cEvent *ev = Schedule->Events()->First(); ev; ev = Schedule->Events()->Next(ev)) {
if (ev->EndTime() > now || ev == PresentEvent) if (ev->EndTime() > now || ev == PresentEvent)
@ -2968,7 +2968,7 @@ static void SetTrackDescriptions(int LiveChannel)
if (Schedules) { if (Schedules) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel); const cSchedule *Schedule = Schedules->GetSchedule(Channel);
if (Schedule) { if (Schedule) {
const cEvent *Present = Schedule->GetPresentEvent(true); const cEvent *Present = Schedule->GetPresentEvent();
if (Present) if (Present)
Components = Present->Components(); Components = Present->Components();
} }
@ -3058,8 +3058,8 @@ void cDisplayChannel::DisplayInfo(void)
if (Schedules) { if (Schedules) {
const cSchedule *Schedule = Schedules->GetSchedule(channel); const cSchedule *Schedule = Schedules->GetSchedule(channel);
if (Schedule) { if (Schedule) {
const cEvent *Present = Schedule->GetPresentEvent(true); const cEvent *Present = Schedule->GetPresentEvent();
const cEvent *Following = Schedule->GetFollowingEvent(true); const cEvent *Following = Schedule->GetFollowingEvent();
if (Present != lastPresent || Following != lastFollowing) { if (Present != lastPresent || Following != lastFollowing) {
SetTrackDescriptions(channel->Number()); SetTrackDescriptions(channel->Number());
displayChannel->SetEvents(Present, Following); displayChannel->SetEvents(Present, Following);