Using 'Priority' when checking for timer matches

This commit is contained in:
Klaus Schmidinger 2000-07-16 13:37:30 +02:00
parent c39ec50826
commit 3499416f07
4 changed files with 59 additions and 11 deletions

View File

@ -70,3 +70,7 @@ Video Disk Recorder Revision History
- The 'Recordings' menu is now listed alphabetically (thanks to Carsten Koch!).
- The new 'xtvrc2vdr' tool (thanks to Plamen Ganev!) can be used to convert
'xtvrc' channel files into 'vdr' format.
- When more than one timer matches at the same time, the first one in the list
with the highest 'Priority' is selected.
- The MANUAL section on "Programming the Timer" has been filled in.

39
MANUAL
View File

@ -108,4 +108,43 @@ Video Disk Recorder User's Manual
* Programming the Timer
Use the "Timer" menu to maintain your list of timer controlled recordings.
The parameters in the "Edit Timer" menu have the following meanings:
Active: Defines whether the timer will be processed (set it to 'no' to
temporarily desable a timer).
Channel: The channel to be recorded (as defined in the "Channels" list).
Any changes made in the "Channels" list (like renaming or
reordering channels) will be automatically reflected in the
timers settings.
Day: The day on which this timer shall start. This can be either a
"day of month" (1..31), which allows programming a "single shot"
timer that hits once and is deleted after it ends. Single shot
timers can be programmed up to one month into the future.
Another option here are "repeating timers" which are defined
by listing the days of the week on which they shall record.
For example, a timer that shall record every monday and wednesday
would have a Day setting of "M-W----".
Start: The start time of the timer in hh:mm as 24 hour ("military") time.
Stop: The stop time of the timer.
Priority: The Priority (0..99) is used to decide which timer shall be
started in case there are two or more timers with the exact same
start time. The first timer in the list with the highest Priority
will be used. This value is also stored with the recording and is
later used to decide which recording to remove from disk in order
to free space for a new recording. If the disk is full and a new
recording needs more space, an existing recording with the lowest
Priority (and which has exceeded its guaranteed Lifetime) will be
removed.
Lifetime: The number of days (0..99) a recording made through this timer is
guaranteed to remain on disk before it is automatically removed
to free up space for a new recording. Note that setting this
parameter to very high values for all recordings may soon fill up
the entire disk and cause new recordings to fail due to low disk
space.
File: The name under which a recording created through this timer will
be stored on disk (the actual name will also contain the date and
time, so it is possible to have a "repeating timer" store all its
recordings under the same name; they will be distinguishable by
their date and time).
If this field is left blank, the channel name will be used to form
the name of the recording.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.c 1.9 2000/07/15 16:35:18 kls Exp $
* $Id: config.c 1.10 2000/07/16 11:47:30 kls Exp $
*/
#include "config.h"
@ -339,10 +339,11 @@ bool cTimer::IsSingleEvent(void)
return (day & 0x80000000) == 0;
}
bool cTimer::Matches(void)
bool cTimer::Matches(time_t t)
{
if (active) {
time_t t = time(NULL);
if (t == 0)
t = time(NULL);
struct tm now = *localtime(&t);
int weekday = now.tm_wday == 0 ? 6 : now.tm_wday - 1; // we start with monday==0!
int begin = TimeToInt(start);
@ -399,13 +400,17 @@ void cTimer::SetRecording(bool Recording)
cTimer *cTimer::GetMatch(void)
{
cTimer *t = (cTimer *)Timers.First();
while (t) {
if (!t->recording && t->Matches())
return t;
t = (cTimer *)t->Next();
time_t t = time(NULL); // all timers must be checked against the exact same time to correctly handle Priority!
cTimer *t0 = NULL;
cTimer *ti = (cTimer *)Timers.First();
while (ti) {
if (!ti->recording && ti->Matches(t)) {
if (!t0 || ti->priority > t0->priority)
t0 = ti;
}
ti = (cTimer *)ti->Next();
}
return NULL;
return t0;
}
// -- cKeys ------------------------------------------------------------------

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.8 2000/07/15 16:26:57 kls Exp $
* $Id: config.h 1.9 2000/07/16 11:41:51 kls Exp $
*/
#ifndef __CONFIG_H
@ -98,7 +98,7 @@ public:
bool Parse(char *s);
bool Save(FILE *f);
bool IsSingleEvent(void);
bool Matches(void);
bool Matches(time_t t = 0);
time_t StartTime(void);
time_t StopTime(void);
void SetRecording(bool Recording);