summaryrefslogtreecommitdiff
path: root/timers.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-03-26 19:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-03-26 19:00:00 +0200
commit49b561fcad16d3315fce8cb854de9f4ee6156640 (patch)
tree5612d6646e299dec266787f6068834f28c7ca81b /timers.c
parent9d12ac30f006ed63b4c9ab4c1a076b7d4f025022 (diff)
downloadvdr-patch-lnbsharing-49b561fcad16d3315fce8cb854de9f4ee6156640.tar.gz
vdr-patch-lnbsharing-49b561fcad16d3315fce8cb854de9f4ee6156640.tar.bz2
Version 1.3.45vdr-1.3.45
- Fixed updating the "Info" button in the "Timers" menu. - Reduced the number of events to actually check when setting events to timers. - cMenuEditIntItem now checks the given value and forces it to be between the given min and max limits. - The status changes of EPG events are now logged for all channels that have timers. - Removed the log message "deleting plugin: ..." when shutting down VDR (thanks to Christoph Haubrich for reporting that this is irritating when calling "vdr --help"). - Fixed cReadLine::Read() for lines that end with the infamous "\r\n" (thanks to Rolf Ahrenberg). - Fixed cDvbDevice::SetAudioBypass() in case setTransferModeForDolbyDigital is false (thanks to Werner Fink). - Updated 'sources.conf' (thanks to Oleg Roitburd). - Fixed the shutdown timeout (thanks to Alexander Wenzel). - Only calling RemoveEmptyVideoDirectories() once in case a recording has been deleted (reported by Hardy Flor). - Fixed deleting recordings that have been removed externally when running out of disk space (reported by Jan Lenz). - Fixed handling repeating VPS timers (they stopped recording too early). - Timer log messages now show "VPS" if this is a VPS timer. - Fixed getting the present EPG event in case none is currently 'running' (it then returns the one that just ended). - Fixed calling a plugin's main menu function while a message is being displayed (reported by Helmut Auer). - Updated the Russian OSD texts (thanks to Oleg Roitburd). - Made cMenuRecordings::GetRecording() 'protected' (suggested by Marius Heidenstecker). - Speeded up cRemux::ScanVideoPacket() (thanks to Reinhard Nissl). - Enhanced logging EPG event data. - Fixed format string handling (thanks to Darren Salt). - The new function cDevice::ForceTransferMode() can be used to force the primary device into transfer mode (thanks to Reinhard Nissl). - The 'version' of EPG events is now ignored when reading EPG data from 'epg.data' or via SVDRP/PUTE to avoid problems with double EPG events. - The 'running status' of EPG events is now only set to SI::RunningStatusNotRunning for events before the present event. - Fixed some #include sequences. - Single shot VPS timers are now only considered 'expired' if their associated EPG event has been explicitly set to SI::RunningStatusNotRunning. - The check for timers to be deleted is now done only every 30 seconds.
Diffstat (limited to 'timers.c')
-rw-r--r--timers.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/timers.c b/timers.c
index 63eb342..0e764d3 100644
--- a/timers.c
+++ b/timers.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: timers.c 1.50 2006/02/26 10:50:47 kls Exp $
+ * $Id: timers.c 1.55 2006/03/26 14:08:57 kls Exp $
*/
#include "timers.h"
@@ -12,6 +12,7 @@
#include "channels.h"
#include "device.h"
#include "i18n.h"
+#include "libsi/si.h"
#include "remote.h"
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
@@ -120,7 +121,7 @@ cString cTimer::ToText(bool UseChannelID)
cString cTimer::ToDescr(void) const
{
char *buffer;
- asprintf(&buffer, "%d (%d %04d-%04d '%s')", Index() + 1, Channel()->Number(), start, stop, file);
+ asprintf(&buffer, "%d (%d %04d-%04d %s'%s')", Index() + 1, Channel()->Number(), start, stop, HasFlags(tfVps) ? "VPS " : "", file);
return cString(buffer, true);
}
@@ -409,7 +410,13 @@ int cTimer::Matches(const cEvent *Event, int *Overlap) const
bool cTimer::Expired(void) const
{
- return IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL);
+ if (IsSingleEvent() && !Recording() && StopTime() + EXPIRELATENCY <= time(NULL)) {
+ if (HasFlags(tfVps) && event && event->Vps())
+ return event->RunningStatus() == SI::RunningStatusNotRunning;
+ else
+ return true;
+ }
+ return false;
}
time_t cTimer::StartTime(void) const
@@ -426,7 +433,10 @@ time_t cTimer::StopTime(void) const
return stopTime;
}
-#define EPGLIMITPAST (2 * 3600) // time in seconds in the past within which EPG events will be taken into consideration
+#define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and
+#define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration.
+#define VPSLIMITBEFORE (2 * 3600) // Same for VPS timers, which need to
+#define VPSLIMITAFTER (24 * 3600) // look further into the future to catch shifted broadcasts.
void cTimer::SetEventFromSchedule(const cSchedules *Schedules)
{
@@ -438,14 +448,25 @@ void cTimer::SetEventFromSchedule(const cSchedules *Schedules)
}
const cSchedule *Schedule = Schedules->GetSchedule(Channel());
if (Schedule) {
+ time_t now = time(NULL);
if (!lastSetEvent || Schedule->Modified() >= lastSetEvent) {
const cEvent *Event = NULL;
int Overlap = 0;
int Distance = INT_MIN;
- time_t now = time(NULL);
+ bool UseVps = HasFlags(tfVps);
+ const cEvent *PresentEvent = UseVps ? Schedule->GetPresentEvent() : NULL;
+ const cEvent *FollowingEvent = UseVps ? Schedule->GetFollowingEvent() : NULL;
+ // Set up the time frame within which to check events:
+ Matches(0, true);
+ time_t TimeFrameBegin = StartTime() - (UseVps ? VPSLIMITBEFORE : EPGLIMITBEFORE);
+ time_t TimeFrameEnd = StopTime() + (UseVps ? VPSLIMITAFTER : EPGLIMITAFTER);
for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
- if (e->EndTime() < now - EPGLIMITPAST)
- continue; // skip old events
+ if (!UseVps || e != event && e != PresentEvent && e != FollowingEvent) { // always check these if this is a VPS timer
+ if (e->EndTime() < TimeFrameBegin)
+ continue; // skip events way before the timer starts
+ if (e->StartTime() > TimeFrameEnd)
+ break; // the rest is way after the timer ends
+ }
int overlap = 0;
Matches(e, &overlap);
if (overlap && overlap >= Overlap) {
@@ -470,20 +491,16 @@ void cTimer::SetEventFromSchedule(const cSchedules *Schedules)
if (Event && Event->EndTime() < now - EXPIRELATENCY && Overlap > FULLMATCH && !Event->IsRunning())
Event = NULL;
SetEvent(Event);
+ lastSetEvent = now;
}
}
- lastSetEvent = time(NULL);
}
void cTimer::SetEvent(const cEvent *Event)
{
if (event != Event) { //XXX TODO check event data, too???
- if (Event) {
- char vpsbuf[64] = "";
- if (Event->Vps())
- sprintf(vpsbuf, "(VPS: %s) ", *Event->GetVpsString());
- isyslog("timer %s set to event %s %s-%s %s'%s'", *ToDescr(), *Event->GetDateString(), *Event->GetTimeString(), *Event->GetEndTimeString(), vpsbuf, Event->Title());
- }
+ if (Event)
+ isyslog("timer %s set to event %s", *ToDescr(), *Event->ToDescr());
else
isyslog("timer %s set to no event", *ToDescr());
event = Event;
@@ -568,6 +585,7 @@ cTimers::cTimers(void)
state = 0;
beingEdited = 0;;
lastSetEvents = 0;
+ lastDeleteExpired = 0;
}
cTimer *cTimers::GetTimer(cTimer *Timer)
@@ -663,6 +681,8 @@ void cTimers::SetEvents(void)
void cTimers::DeleteExpired(void)
{
+ if (time(NULL) - lastDeleteExpired < 30)
+ return;
cTimer *ti = First();
while (ti) {
cTimer *next = Next(ti);
@@ -673,4 +693,5 @@ void cTimers::DeleteExpired(void)
}
ti = next;
}
+ lastDeleteExpired = time(NULL);
}