If VPS timers are active, their events are now being kept up to date

This commit is contained in:
Klaus Schmidinger 2006-05-07 09:13:36 +02:00
parent 93d0120c3f
commit 465ddf3ffc
3 changed files with 29 additions and 10 deletions

View File

@ -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.

6
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $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);

29
vdr.c
View File

@ -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 <getopt.h>
@ -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);
}