From 465ddf3ffcf55728608d0442f23516262a5e26f4 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 7 May 2006 09:13:36 +0200 Subject: If VPS timers are active, their events are now being kept up to date --- HISTORY | 4 +++- epg.c | 6 ++++-- vdr.c | 29 ++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index d531b910..9ec0d56b 100644 --- a/HISTORY +++ b/HISTORY @@ -4688,7 +4688,7 @@ Video Disk Recorder Revision History - Updated the Italian OSD texts (thanks to Nino Gerbino and Antonio Ospite). - Updated the Estonian OSD texts (thanks to Arthur Konovalov). -2006-05-06: Version 1.4.0-1 +2006-05-07: Version 1.4.0-1 - Updated 'S110W' in 'sources.conf'. - Adjusted the 'runvdr' script so that the user can fill in the functions to @@ -4705,3 +4705,5 @@ Video Disk Recorder Revision History - When checking whether a VPS timer has entered the "VPS margin", the event's start time is now used instead of the timer's start time, because otherwise events that start way off of their VPS time wouldn't be recorded correctly. +- If VPS timers are active, their events are now being kept up to date if there + are any free devices available. diff --git a/epg.c b/epg.c index bc448cf8..cb38a983 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.c 1.72 2006/04/22 12:02:47 kls Exp $ + * $Id: epg.c 1.73 2006/05/07 09:13:36 kls Exp $ */ #include "epg.h" @@ -327,8 +327,10 @@ bool cEvent::Read(FILE *f, cSchedule *Schedule) cEvent *newEvent = NULL; if (Event) DELETENULL(Event->components); - if (!Event) + if (!Event) { Event = newEvent = new cEvent(EventID); + Event->seen = 0; + } if (Event) { Event->SetTableID(TableID); Event->SetStartTime(StartTime); diff --git a/vdr.c b/vdr.c index fc0e360c..ea762d38 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.268 2006/05/05 13:43:32 kls Exp $ + * $Id: vdr.c 1.269 2006/05/07 09:13:36 kls Exp $ */ #include @@ -74,6 +74,8 @@ #define SHUTDOWNRETRY 300 // seconds before trying again to shut down #define VPSCHECKDELTA 10 // seconds between checks for timers that have entered the VPS margin #define VPSDEVICETIMEOUT 8 // seconds before a device used for VPS may be reused +#define VPSLOOKAHEADTIME 24 // hours within which VPS timers will make sure their events are up to date +#define VPSUPTODATETIME 3600 // seconds before the event or schedule of a VPS timer needs to be refreshed #define EXIT(v) { ExitCode = (v); goto Exit; } @@ -762,8 +764,24 @@ int main(int argc, char *argv[]) TimerInVpsMargin = false; static time_t DeviceUsed[MAXDEVICES] = { 0 }; for (cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer)) { - if (Timer->HasFlags(tfActive | tfVps) && !Timer->Recording() && Timer->Matches(Now, true, Setup.VpsMargin)) { - Timer->SetInVpsMargin(true); + bool InVpsMargin = false; + bool NeedsTransponder = false; + if (Timer->HasFlags(tfActive | tfVps) && !Timer->Recording()) { + if (Timer->Matches(Now, true, Setup.VpsMargin)) + TimerInVpsMargin = InVpsMargin = true; + else if (Timer->Event()) + NeedsTransponder = Timer->Event()->StartTime() - Now < VPSLOOKAHEADTIME * 3600 && !Timer->Event()->SeenWithin(VPSUPTODATETIME); + else { + cSchedulesLock SchedulesLock; + const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); + if (Schedules) { + const cSchedule *Schedule = Schedules->GetSchedule(Timer->Channel()); + NeedsTransponder = Schedule && !Schedule->PresentSeenWithin(VPSUPTODATETIME); + } + } + } + Timer->SetInVpsMargin(InVpsMargin); + if (NeedsTransponder || InVpsMargin) { // Find a device that provides the required transponder: cDevice *Device = NULL; for (int i = 0; i < cDevice::NumDevices(); i++) { @@ -785,7 +803,7 @@ int main(int argc, char *argv[]) } } } - if (!Device) { + if (!Device && InVpsMargin) { cDevice *d = cDevice::ActualDevice(); if (!d->Receiving() && d->ProvidesTransponder(Timer->Channel()) && Now - DeviceUsed[d->DeviceNumber()] > VPSDEVICETIMEOUT) Device = d; // use the actual device as a last resort @@ -805,10 +823,7 @@ int main(int argc, char *argv[]) Skins.Message(mtInfo, tr("Upcoming VPS recording!")); } } - TimerInVpsMargin = true; } - else - Timer->SetInVpsMargin(false); } LastVpsCheck = time(NULL); } -- cgit v1.2.3