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

Added 'CheckRunningStatus' when getting present/following event

This commit is contained in:
Klaus Schmidinger 2004-02-22 14:14:55 +01:00
parent 5f0a84d1bf
commit 98f3934a58
3 changed files with 16 additions and 13 deletions

15
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.11 2004/02/22 13:18:01 kls Exp $ * $Id: epg.c 1.12 2004/02/22 13:55:12 kls Exp $
*/ */
#include "epg.h" #include "epg.h"
@ -460,22 +460,25 @@ cEvent *cSchedule::AddEvent(cEvent *Event)
return Event; return Event;
} }
const cEvent *cSchedule::GetPresentEvent(void) const const cEvent *cSchedule::GetPresentEvent(bool CheckRunningStatus) 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->StartTime() + p->Duration()) if (p->StartTime() <= now && now < p->StartTime() + p->Duration()) {
pe = p; pe = p;
if (p->RunningStatus() >= SI::RunningStatusPausing) if (!CheckRunningStatus)
break;
}
if (CheckRunningStatus && p->RunningStatus() >= SI::RunningStatusPausing)
return p; return p;
} }
return pe; return pe;
} }
const cEvent *cSchedule::GetFollowingEvent(void) const const cEvent *cSchedule::GetFollowingEvent(bool CheckRunningStatus) const
{ {
const cEvent *p = GetPresentEvent(); const cEvent *p = GetPresentEvent(CheckRunningStatus);
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.8 2004/02/22 13:18:14 kls Exp $ * $Id: epg.h 1.9 2004/02/22 13:52:46 kls Exp $
*/ */
#ifndef __EPG_H #ifndef __EPG_H
@ -83,8 +83,8 @@ public:
void Cleanup(time_t Time); void Cleanup(time_t Time);
void Cleanup(void); void Cleanup(void);
cEvent *AddEvent(cEvent *Event); cEvent *AddEvent(cEvent *Event);
const cEvent *GetPresentEvent(void) const; const cEvent *GetPresentEvent(bool CheckRunningStatus = false) const;
const cEvent *GetFollowingEvent(void) const; const cEvent *GetFollowingEvent(bool CheckRunningStatus = false) 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;
const cEvent *GetEventNumber(int n) const { return events.Get(n); } const cEvent *GetEventNumber(int n) const { return events.Get(n); }

8
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.291 2004/02/22 13:43:55 kls Exp $ * $Id: menu.c 1.292 2004/02/22 14:14:55 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1375,7 +1375,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
if (schedules) { if (schedules) {
const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID()); const cSchedule *Schedule = schedules->GetSchedule(Channel->GetChannelID());
if (Schedule) { if (Schedule) {
const cEvent *PresentEvent = Schedule->GetPresentEvent(); const cEvent *PresentEvent = Schedule->GetPresentEvent(Channel->Number() == cDevice::CurrentChannel());
int num = Schedule->NumEvents(); int num = Schedule->NumEvents();
time_t now = time(NULL) - Setup.EPGLinger * 60; time_t now = time(NULL) - Setup.EPGLinger * 60;
for (int a = 0; a < num; a++) { for (int a = 0; a < num; a++) {
@ -2764,7 +2764,7 @@ void cDisplayChannel::DisplayInfo(void)
if (Schedule) { if (Schedule) {
const char *PresentTitle = NULL, *PresentSubtitle = NULL, *FollowingTitle = NULL, *FollowingSubtitle = NULL; const char *PresentTitle = NULL, *PresentSubtitle = NULL, *FollowingTitle = NULL, *FollowingSubtitle = NULL;
int Lines = 0; int Lines = 0;
if ((Present = Schedule->GetPresentEvent()) != NULL) { if ((Present = Schedule->GetPresentEvent(true)) != NULL) {
PresentTitle = Present->Title(); PresentTitle = Present->Title();
if (!isempty(PresentTitle)) if (!isempty(PresentTitle))
Lines++; Lines++;
@ -2772,7 +2772,7 @@ void cDisplayChannel::DisplayInfo(void)
if (!isempty(PresentSubtitle)) if (!isempty(PresentSubtitle))
Lines++; Lines++;
} }
if ((Following = Schedule->GetFollowingEvent()) != NULL) { if ((Following = Schedule->GetFollowingEvent(true)) != NULL) {
FollowingTitle = Following->Title(); FollowingTitle = Following->Title();
if (!isempty(FollowingTitle)) if (!isempty(FollowingTitle))
Lines++; Lines++;