mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Implemented the 'First day' parameter for repeating timers
This commit is contained in:
parent
3ecbdd489e
commit
a87e7625dd
11
FORMATS
11
FORMATS
@ -50,7 +50,7 @@ Video Disk Recorder File Formats
|
|||||||
and recognize if the user has modified them. When a user modifes an active
|
and recognize if the user has modified them. When a user modifes an active
|
||||||
timer the 'active' field will be explicitly set to '1'.
|
timer the 'active' field will be explicitly set to '1'.
|
||||||
- Program number of the channel to record
|
- Program number of the channel to record
|
||||||
- Day of recording, either one or more of
|
- Day of recording (in case of a repeating timer), either one or more of
|
||||||
M------ = Monday
|
M------ = Monday
|
||||||
-T----- = Tuesday
|
-T----- = Tuesday
|
||||||
--W---- = Wednesday
|
--W---- = Wednesday
|
||||||
@ -61,7 +61,14 @@ Video Disk Recorder File Formats
|
|||||||
(any combination is possible, for example MTWTF--, and the days may be
|
(any combination is possible, for example MTWTF--, and the days may be
|
||||||
indicated by any characters except '-', so for example ABC---- would set
|
indicated by any characters except '-', so for example ABC---- would set
|
||||||
a timer that records on monday, tuesday and wednesday) or the "day of month"
|
a timer that records on monday, tuesday and wednesday) or the "day of month"
|
||||||
(1..31)
|
(1..31) in case of a single shot timer.
|
||||||
|
The day definition of a repeating timer may be followed by the date when that
|
||||||
|
timer shall hit for the first time. The format for this is @YYYY-MM-DD,
|
||||||
|
so a complete definition could look like this: MTWTF--@2002-02-18. This
|
||||||
|
"first day" feature can be used to disable a repeating timer for a couple
|
||||||
|
of days, or for instance to define a new Mon...Fri timer on wednesday, which
|
||||||
|
actually starts "monday next week". The "first day" date given need not be
|
||||||
|
that of a day when the timer would actually hit.
|
||||||
- Start time (first two digits for the hour, second two digits for the minutes)
|
- Start time (first two digits for the hour, second two digits for the minutes)
|
||||||
- End time (first two digits for the hour, second two digits for the minutes)
|
- End time (first two digits for the hour, second two digits for the minutes)
|
||||||
- Priority (from 0 to 99, 0 = lowest prioity, 99 = highest priority)
|
- Priority (from 0 to 99, 0 = lowest prioity, 99 = highest priority)
|
||||||
|
8
HISTORY
8
HISTORY
@ -979,7 +979,7 @@ Video Disk Recorder Revision History
|
|||||||
- Only reporting the 'EPG bugfix statistics' if there really were any fixes.
|
- Only reporting the 'EPG bugfix statistics' if there really were any fixes.
|
||||||
- Added Finnish language texts (thanks to Hannu Savolainen).
|
- Added Finnish language texts (thanks to Hannu Savolainen).
|
||||||
- Reverted to the previous way of searching for the EPG record of the current
|
- Reverted to the previous way of searching for the EPG record of the current
|
||||||
recording in case of a periodic timer (i.e. taking the one that is in the
|
recording in case of a repeating timer (i.e. taking the one that is in the
|
||||||
middle between start and end time).
|
middle between start and end time).
|
||||||
- Added a typedef for 'in_addr_t' to make it work with glibc < 2.2 (thanks to
|
- Added a typedef for 'in_addr_t' to make it work with glibc < 2.2 (thanks to
|
||||||
Jürgen Schmidt).
|
Jürgen Schmidt).
|
||||||
@ -997,7 +997,7 @@ Video Disk Recorder Revision History
|
|||||||
- If a recording has no episode title, the trailing '~' is no longer shown in
|
- If a recording has no episode title, the trailing '~' is no longer shown in
|
||||||
the progress display.
|
the progress display.
|
||||||
|
|
||||||
2002-02-16: Version 1.0.0pre1
|
2002-02-17: Version 1.0.0pre1
|
||||||
|
|
||||||
- Added scanning for EPG data for another 4 days on channels that support this
|
- Added scanning for EPG data for another 4 days on channels that support this
|
||||||
(thanks to Oleg Assovski).
|
(thanks to Oleg Assovski).
|
||||||
@ -1005,3 +1005,7 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed the "Low disk space!" message (thanks to Sergei Haller).
|
- Fixed the "Low disk space!" message (thanks to Sergei Haller).
|
||||||
- Added the TPID to Hessen-3 in 'channels.conf' (thanks to Sergei Haller).
|
- Added the TPID to Hessen-3 in 'channels.conf' (thanks to Sergei Haller).
|
||||||
- Fixed a crash when replaying with DEBUG_OSD=1 (thanks to Stefan Huelswitt).
|
- Fixed a crash when replaying with DEBUG_OSD=1 (thanks to Stefan Huelswitt).
|
||||||
|
- Implemented the "First day" parameter for repeating timers. See FORMATS for
|
||||||
|
information about the enhanced 'timers.conf' file format, and MANUAL for
|
||||||
|
a description of the new item in the "Edit Timer" menu and the enhanced
|
||||||
|
functionality of the "Blue" button in the "Timers" menu.
|
||||||
|
17
MANUAL
17
MANUAL
@ -41,8 +41,15 @@ Video Disk Recorder User's Manual
|
|||||||
any changes that might have been made in the current menu.
|
any changes that might have been made in the current menu.
|
||||||
|
|
||||||
In the "Timers" menu, the current timer can be enabled or disabled with
|
In the "Timers" menu, the current timer can be enabled or disabled with
|
||||||
the "Right" or "Left" key, respectively (enabled timers are marked with '>',
|
the "Blue" key (this is only possible if the "Timers" list is sorted,
|
||||||
timers that are currently recording are marked with '#').
|
otherwise the "Blue" key is used to mark a timer in order to move it to
|
||||||
|
another position in the list). Enabled timers are marked with '>', timers
|
||||||
|
that are currently recording are marked with '#'. If a timer has the
|
||||||
|
"First day" set so that it will start recording only on the given date,
|
||||||
|
it is marked with '!'. The "Blue" key toggles through the "enabled" and
|
||||||
|
"disabled" states, and for repeating timers that are currently recording
|
||||||
|
also a state that ends this recording prematurely and sets the "First day"
|
||||||
|
date so that it will record again the next time the timer hits.
|
||||||
"Ok" here opens the "Edit timer" menu.
|
"Ok" here opens the "Edit timer" menu.
|
||||||
|
|
||||||
Textual options, like channel names or recording file names, can be edited
|
Textual options, like channel names or recording file names, can be edited
|
||||||
@ -160,7 +167,7 @@ Video Disk Recorder User's Manual
|
|||||||
list with the "Up" and "Down" button and press "Ok" (or the "Red" button)
|
list with the "Up" and "Down" button and press "Ok" (or the "Red" button)
|
||||||
to start playback. New recordings are marked with an '*'.
|
to start playback. New recordings are marked with an '*'.
|
||||||
If the Setup parameter RecordingDirs has been set and there are recordings
|
If the Setup parameter RecordingDirs has been set and there are recordings
|
||||||
from periodic timers organized in a subdirectory structure, only the
|
from repeating timers organized in a subdirectory structure, only the
|
||||||
directory is displayed and it can be opened by pressing "Ok" (or the "Red"
|
directory is displayed and it can be opened by pressing "Ok" (or the "Red"
|
||||||
button). A directory entry displays the total number of recordings within
|
button). A directory entry displays the total number of recordings within
|
||||||
that directory (and any possible subdirectory thereof) as well as the total
|
that directory (and any possible subdirectory thereof) as well as the total
|
||||||
@ -170,7 +177,7 @@ Video Disk Recorder User's Manual
|
|||||||
If the setup parameter UseSubtitle was turned on when a recording took place,
|
If the setup parameter UseSubtitle was turned on when a recording took place,
|
||||||
VDR adds the "subtitle" (which is usually the name of the episode in case of
|
VDR adds the "subtitle" (which is usually the name of the episode in case of
|
||||||
a series) to the recording's name. The "Recordings" menu then displays all
|
a series) to the recording's name. The "Recordings" menu then displays all
|
||||||
recordings of a periodic timer in chronological order, since these are
|
recordings of a repeating timer in chronological order, since these are
|
||||||
usually the individual episodes of a series, which you may want to view in
|
usually the individual episodes of a series, which you may want to view in
|
||||||
the order in which they were broadcast.
|
the order in which they were broadcast.
|
||||||
|
|
||||||
@ -321,6 +328,8 @@ Video Disk Recorder User's Manual
|
|||||||
of this timer being collected in a common subdirectory.
|
of this timer being collected in a common subdirectory.
|
||||||
If this field is left blank, the channel name will be used to form
|
If this field is left blank, the channel name will be used to form
|
||||||
the name of the recording.
|
the name of the recording.
|
||||||
|
First day: The date of the first day when this timer shall start recording
|
||||||
|
(only available for repeating timers).
|
||||||
|
|
||||||
A timer can also be programmed by pressing the "Red" button on the "Schedule",
|
A timer can also be programmed by pressing the "Red" button on the "Schedule",
|
||||||
"Now", "Next" or "Event" menus.
|
"Now", "Next" or "Event" menus.
|
||||||
|
63
config.c
63
config.c
@ -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: config.c 1.83 2002/02/10 11:39:00 kls Exp $
|
* $Id: config.c 1.84 2002/02/17 11:37:05 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -338,6 +338,7 @@ cTimer::cTimer(bool Instant)
|
|||||||
priority = Setup.DefaultPriority;
|
priority = Setup.DefaultPriority;
|
||||||
lifetime = Setup.DefaultLifetime;
|
lifetime = Setup.DefaultLifetime;
|
||||||
*file = 0;
|
*file = 0;
|
||||||
|
firstday = 0;
|
||||||
summary = NULL;
|
summary = NULL;
|
||||||
if (Instant && ch)
|
if (Instant && ch)
|
||||||
snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : ch->name);
|
snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : ch->name);
|
||||||
@ -367,6 +368,7 @@ cTimer::cTimer(const cEventInfo *EventInfo)
|
|||||||
const char *Title = EventInfo->GetTitle();
|
const char *Title = EventInfo->GetTitle();
|
||||||
if (!isempty(Title))
|
if (!isempty(Title))
|
||||||
strn0cpy(file, EventInfo->GetTitle(), sizeof(file));
|
strn0cpy(file, EventInfo->GetTitle(), sizeof(file));
|
||||||
|
firstday = 0;
|
||||||
summary = NULL;
|
summary = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +397,7 @@ const char *cTimer::ToText(cTimer *Timer)
|
|||||||
delete buffer;
|
delete buffer;
|
||||||
strreplace(Timer->file, ':', '|');
|
strreplace(Timer->file, ':', '|');
|
||||||
strreplace(Timer->summary, '\n', '|');
|
strreplace(Timer->summary, '\n', '|');
|
||||||
asprintf(&buffer, "%d:%d:%s:%04d:%04d:%d:%d:%s:%s\n", Timer->active, Timer->channel, PrintDay(Timer->day), Timer->start, Timer->stop, Timer->priority, Timer->lifetime, Timer->file, Timer->summary ? Timer->summary : "");
|
asprintf(&buffer, "%d:%d:%s:%04d:%04d:%d:%d:%s:%s\n", Timer->active, Timer->channel, PrintDay(Timer->day, Timer->firstday), Timer->start, Timer->stop, Timer->priority, Timer->lifetime, Timer->file, Timer->summary ? Timer->summary : "");
|
||||||
strreplace(Timer->summary, '|', '\n');
|
strreplace(Timer->summary, '|', '\n');
|
||||||
strreplace(Timer->file, '|', ':');
|
strreplace(Timer->file, '|', ':');
|
||||||
return buffer;
|
return buffer;
|
||||||
@ -411,20 +413,38 @@ int cTimer::TimeToInt(int t)
|
|||||||
return (t / 100 * 60 + t % 100) * 60;
|
return (t / 100 * 60 + t % 100) * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cTimer::ParseDay(const char *s)
|
int cTimer::ParseDay(const char *s, time_t *FirstDay)
|
||||||
{
|
{
|
||||||
char *tail;
|
char *tail;
|
||||||
int d = strtol(s, &tail, 10);
|
int d = strtol(s, &tail, 10);
|
||||||
|
if (FirstDay)
|
||||||
|
*FirstDay = 0;
|
||||||
if (tail && *tail) {
|
if (tail && *tail) {
|
||||||
d = 0;
|
d = 0;
|
||||||
if (tail == s) {
|
if (tail == s) {
|
||||||
if (strlen(s) == 7) {
|
const char *first = strchr(s, '@');
|
||||||
|
int l = first ? first - s : strlen(s);
|
||||||
|
if (l == 7) {
|
||||||
for (const char *p = s + 6; p >= s; p--) {
|
for (const char *p = s + 6; p >= s; p--) {
|
||||||
d <<= 1;
|
d <<= 1;
|
||||||
d |= (*p != '-');
|
d |= (*p != '-');
|
||||||
}
|
}
|
||||||
d |= 0x80000000;
|
d |= 0x80000000;
|
||||||
}
|
}
|
||||||
|
if (FirstDay && first) {
|
||||||
|
++first;
|
||||||
|
if (strlen(first) == 10) {
|
||||||
|
struct tm tm_r;
|
||||||
|
if (3 == sscanf(first, "%d-%d-%d", &tm_r.tm_year, &tm_r.tm_mon, &tm_r.tm_mday)) {
|
||||||
|
tm_r.tm_year -= 1900;
|
||||||
|
tm_r.tm_mon--;
|
||||||
|
tm_r.tm_hour = tm_r.tm_min = tm_r.tm_sec = 0;
|
||||||
|
*FirstDay = mktime(&tm_r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
d = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (d < 1 || d > 31)
|
else if (d < 1 || d > 31)
|
||||||
@ -432,24 +452,40 @@ int cTimer::ParseDay(const char *s)
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *cTimer::PrintDay(int d)
|
const char *cTimer::PrintDay(int d, time_t FirstDay)
|
||||||
{
|
{
|
||||||
static char buffer[8];
|
#define DAYBUFFERSIZE 32
|
||||||
|
static char buffer[DAYBUFFERSIZE];
|
||||||
if ((d & 0x80000000) != 0) {
|
if ((d & 0x80000000) != 0) {
|
||||||
char *b = buffer;
|
char *b = buffer;
|
||||||
const char *w = tr("MTWTFSS");
|
const char *w = tr("MTWTFSS");
|
||||||
*b = 0;
|
|
||||||
while (*w) {
|
while (*w) {
|
||||||
*b++ = (d & 1) ? *w : '-';
|
*b++ = (d & 1) ? *w : '-';
|
||||||
d >>= 1;
|
d >>= 1;
|
||||||
w++;
|
w++;
|
||||||
}
|
}
|
||||||
|
if (FirstDay) {
|
||||||
|
struct tm tm_r;
|
||||||
|
localtime_r(&FirstDay, &tm_r);
|
||||||
|
b += strftime(b, DAYBUFFERSIZE - (b - buffer), "@%Y-%m-%d", &tm_r);
|
||||||
|
}
|
||||||
|
*b = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sprintf(buffer, "%d", d);
|
sprintf(buffer, "%d", d);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *cTimer::PrintFirstDay(void)
|
||||||
|
{
|
||||||
|
if (firstday) {
|
||||||
|
const char *s = PrintDay(day, firstday);
|
||||||
|
if (strlen(s) == 18)
|
||||||
|
return s + 8;
|
||||||
|
}
|
||||||
|
return ""; // not NULL, so the caller can always use the result
|
||||||
|
}
|
||||||
|
|
||||||
bool cTimer::Parse(const char *s)
|
bool cTimer::Parse(const char *s)
|
||||||
{
|
{
|
||||||
char *buffer1 = NULL;
|
char *buffer1 = NULL;
|
||||||
@ -477,7 +513,7 @@ bool cTimer::Parse(const char *s)
|
|||||||
summary = NULL;
|
summary = NULL;
|
||||||
}
|
}
|
||||||
//TODO add more plausibility checks
|
//TODO add more plausibility checks
|
||||||
day = ParseDay(buffer1);
|
day = ParseDay(buffer1, &firstday);
|
||||||
strn0cpy(file, buffer2, MaxFileName);
|
strn0cpy(file, buffer2, MaxFileName);
|
||||||
strreplace(file, '|', ':');
|
strreplace(file, '|', ':');
|
||||||
strreplace(summary, '|', '\n');
|
strreplace(summary, '|', '\n');
|
||||||
@ -563,13 +599,17 @@ bool cTimer::Matches(time_t t)
|
|||||||
if (DayMatches(t0)) {
|
if (DayMatches(t0)) {
|
||||||
time_t a = SetTime(t0, begin);
|
time_t a = SetTime(t0, begin);
|
||||||
time_t b = a + length;
|
time_t b = a + length;
|
||||||
if (t <= b) {
|
if ((!firstday || a >= firstday) && t <= b) {
|
||||||
startTime = a;
|
startTime = a;
|
||||||
stopTime = b;
|
stopTime = b;
|
||||||
|
if (t >= firstday)
|
||||||
|
firstday = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!startTime)
|
||||||
|
startTime = firstday; // just to have something that's more than a week in the future
|
||||||
return active && startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers
|
return active && startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,6 +638,11 @@ void cTimer::SetPending(bool Pending)
|
|||||||
pending = Pending;
|
pending = Pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cTimer::SkipToday(void)
|
||||||
|
{
|
||||||
|
firstday = IncDay(SetTime(recording ? StartTime() : time(NULL), 0), 1);
|
||||||
|
}
|
||||||
|
|
||||||
// --- cCommand -------------------------------------------------------------
|
// --- cCommand -------------------------------------------------------------
|
||||||
|
|
||||||
char *cCommand::result = NULL;
|
char *cCommand::result = NULL;
|
||||||
|
13
config.h
13
config.h
@ -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: config.h 1.95 2002/02/10 15:44:40 kls Exp $
|
* $Id: config.h 1.96 2002/02/17 12:17:29 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@ -135,6 +135,7 @@ public:
|
|||||||
int priority;
|
int priority;
|
||||||
int lifetime;
|
int lifetime;
|
||||||
char file[MaxFileName];
|
char file[MaxFileName];
|
||||||
|
time_t firstday;
|
||||||
char *summary;
|
char *summary;
|
||||||
cTimer(bool Instant = false);
|
cTimer(bool Instant = false);
|
||||||
cTimer(const cEventInfo *EventInfo);
|
cTimer(const cEventInfo *EventInfo);
|
||||||
@ -148,17 +149,19 @@ public:
|
|||||||
int GetMDay(time_t t);
|
int GetMDay(time_t t);
|
||||||
int GetWDay(time_t t);
|
int GetWDay(time_t t);
|
||||||
bool DayMatches(time_t t);
|
bool DayMatches(time_t t);
|
||||||
time_t IncDay(time_t t, int Days);
|
static time_t IncDay(time_t t, int Days);
|
||||||
time_t SetTime(time_t t, int SecondsFromMidnight);
|
static time_t SetTime(time_t t, int SecondsFromMidnight);
|
||||||
char *SetFile(const char *File);
|
char *SetFile(const char *File);
|
||||||
bool Matches(time_t t = 0);
|
bool Matches(time_t t = 0);
|
||||||
time_t StartTime(void);
|
time_t StartTime(void);
|
||||||
time_t StopTime(void);
|
time_t StopTime(void);
|
||||||
void SetRecording(bool Recording);
|
void SetRecording(bool Recording);
|
||||||
void SetPending(bool Pending);
|
void SetPending(bool Pending);
|
||||||
|
void SkipToday(void);
|
||||||
|
const char *PrintFirstDay(void);
|
||||||
static int TimeToInt(int t);
|
static int TimeToInt(int t);
|
||||||
static int ParseDay(const char *s);
|
static int ParseDay(const char *s, time_t *FirstDay = NULL);
|
||||||
static const char *PrintDay(int d);
|
static const char *PrintDay(int d, time_t FirstDay = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cCommand : public cListObject {
|
class cCommand : public cListObject {
|
||||||
|
22
i18n.c
22
i18n.c
@ -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: i18n.c 1.53 2002/02/10 15:07:46 kls Exp $
|
* $Id: i18n.c 1.54 2002/02/17 12:36:19 kls Exp $
|
||||||
*
|
*
|
||||||
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
|
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
|
||||||
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
|
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
|
||||||
@ -261,6 +261,16 @@ const tPhrase Phrases[] = {
|
|||||||
"Marker",
|
"Marker",
|
||||||
"Merkitse",
|
"Merkitse",
|
||||||
},
|
},
|
||||||
|
{ "On/Off",
|
||||||
|
"Ein/Aus",
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
},
|
||||||
{ "Record",
|
{ "Record",
|
||||||
"Aufnehmen",
|
"Aufnehmen",
|
||||||
"Posnemi",
|
"Posnemi",
|
||||||
@ -684,6 +694,16 @@ const tPhrase Phrases[] = {
|
|||||||
"Filnavn",
|
"Filnavn",
|
||||||
"Tiedosto",
|
"Tiedosto",
|
||||||
},
|
},
|
||||||
|
{ "First day",
|
||||||
|
"Erster Tag",
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
},
|
||||||
// Error messages:
|
// Error messages:
|
||||||
{ "Channel is being used by a timer!",
|
{ "Channel is being used by a timer!",
|
||||||
"Kanal wird von einem Timer benutzt!",
|
"Kanal wird von einem Timer benutzt!",
|
||||||
|
119
menu.c
119
menu.c
@ -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.152 2002/02/10 11:52:34 kls Exp $
|
* $Id: menu.c 1.153 2002/02/17 13:00:13 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -254,6 +254,62 @@ eOSState cMenuEditDayItem::ProcessKey(eKeys Key)
|
|||||||
return osContinue;
|
return osContinue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- cMenuEditDateItem -----------------------------------------------------
|
||||||
|
|
||||||
|
class cMenuEditDateItem : public cMenuEditItem {
|
||||||
|
protected:
|
||||||
|
time_t *value;
|
||||||
|
virtual void Set(void);
|
||||||
|
public:
|
||||||
|
cMenuEditDateItem(const char *Name, time_t *Value);
|
||||||
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
|
};
|
||||||
|
|
||||||
|
cMenuEditDateItem::cMenuEditDateItem(const char *Name, time_t *Value)
|
||||||
|
:cMenuEditItem(Name)
|
||||||
|
{
|
||||||
|
value = Value;
|
||||||
|
Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cMenuEditDateItem::Set(void)
|
||||||
|
{
|
||||||
|
#define DATEBUFFERSIZE 32
|
||||||
|
char buf[DATEBUFFERSIZE];
|
||||||
|
if (*value) {
|
||||||
|
struct tm tm_r;
|
||||||
|
localtime_r(value, &tm_r);
|
||||||
|
strftime(buf, DATEBUFFERSIZE, "%Y-%m-%d ", &tm_r);
|
||||||
|
strcat(buf, WeekDayName(tm_r.tm_wday));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*buf = 0;
|
||||||
|
SetValue(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
eOSState cMenuEditDateItem::ProcessKey(eKeys Key)
|
||||||
|
{
|
||||||
|
eOSState state = cMenuEditItem::ProcessKey(Key);
|
||||||
|
|
||||||
|
if (state == osUnknown) {
|
||||||
|
if (NORMALKEY(Key) == kLeft) { // TODO might want to increase the delta if repeated quickly?
|
||||||
|
*value -= SECSINDAY;
|
||||||
|
if (*value < time(NULL))
|
||||||
|
*value = 0;
|
||||||
|
}
|
||||||
|
else if (NORMALKEY(Key) == kRight) {
|
||||||
|
if (!*value)
|
||||||
|
*value = cTimer::SetTime(time(NULL), 0);
|
||||||
|
*value += SECSINDAY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return state;
|
||||||
|
Set();
|
||||||
|
state = osContinue;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
// --- cMenuEditTimeItem -----------------------------------------------------
|
// --- cMenuEditTimeItem -----------------------------------------------------
|
||||||
|
|
||||||
class cMenuEditTimeItem : public cMenuEditItem {
|
class cMenuEditTimeItem : public cMenuEditItem {
|
||||||
@ -905,6 +961,8 @@ class cMenuEditTimer : public cOsdMenu {
|
|||||||
private:
|
private:
|
||||||
cTimer *timer;
|
cTimer *timer;
|
||||||
cTimer data;
|
cTimer data;
|
||||||
|
cMenuEditDateItem *firstday;
|
||||||
|
void SetFirstDayItem(void);
|
||||||
public:
|
public:
|
||||||
cMenuEditTimer(int Index, bool New = false);
|
cMenuEditTimer(int Index, bool New = false);
|
||||||
virtual eOSState ProcessKey(eKeys Key);
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
@ -913,6 +971,7 @@ public:
|
|||||||
cMenuEditTimer::cMenuEditTimer(int Index, bool New)
|
cMenuEditTimer::cMenuEditTimer(int Index, bool New)
|
||||||
:cOsdMenu(tr("Edit Timer"), 12)
|
:cOsdMenu(tr("Edit Timer"), 12)
|
||||||
{
|
{
|
||||||
|
firstday = NULL;
|
||||||
timer = Timers.Get(Index);
|
timer = Timers.Get(Index);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
data = *timer;
|
data = *timer;
|
||||||
@ -927,6 +986,21 @@ cMenuEditTimer::cMenuEditTimer(int Index, bool New)
|
|||||||
Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, MAXPRIORITY));
|
Add(new cMenuEditIntItem( tr("Priority"), &data.priority, 0, MAXPRIORITY));
|
||||||
Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, MAXLIFETIME));
|
Add(new cMenuEditIntItem( tr("Lifetime"), &data.lifetime, 0, MAXLIFETIME));
|
||||||
Add(new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file), FileNameChars));
|
Add(new cMenuEditStrItem( tr("File"), data.file, sizeof(data.file), FileNameChars));
|
||||||
|
SetFirstDayItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cMenuEditTimer::SetFirstDayItem(void)
|
||||||
|
{
|
||||||
|
if (!firstday && !data.IsSingleEvent()) {
|
||||||
|
Add(firstday = new cMenuEditDateItem(tr("First day"), &data.firstday));
|
||||||
|
Display();
|
||||||
|
}
|
||||||
|
else if (firstday && data.IsSingleEvent()) {
|
||||||
|
Del(firstday->Index());
|
||||||
|
firstday = NULL;
|
||||||
|
data.firstday = 0;
|
||||||
|
Display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,6 +1027,8 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key)
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Key != kNone)
|
||||||
|
SetFirstDayItem();
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -983,7 +1059,7 @@ void cMenuTimerItem::Set(void)
|
|||||||
{
|
{
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%c\t%d\t%s\t%02d:%02d\t%02d:%02d\t%s",
|
asprintf(&buffer, "%c\t%d\t%s\t%02d:%02d\t%02d:%02d\t%s",
|
||||||
timer->active ? timer->recording ? '#' : '>' : ' ',
|
!timer->active ? ' ' : timer->firstday ? '!' : timer->recording ? '#' : '>',
|
||||||
timer->channel,
|
timer->channel,
|
||||||
timer->PrintDay(timer->day),
|
timer->PrintDay(timer->day),
|
||||||
timer->start / 100,
|
timer->start / 100,
|
||||||
@ -998,10 +1074,10 @@ void cMenuTimerItem::Set(void)
|
|||||||
|
|
||||||
class cMenuTimers : public cOsdMenu {
|
class cMenuTimers : public cOsdMenu {
|
||||||
private:
|
private:
|
||||||
eOSState Activate(bool On);
|
|
||||||
eOSState Edit(void);
|
eOSState Edit(void);
|
||||||
eOSState New(void);
|
eOSState New(void);
|
||||||
eOSState Del(void);
|
eOSState Del(void);
|
||||||
|
eOSState OnOff(void);
|
||||||
virtual void Move(int From, int To);
|
virtual void Move(int From, int To);
|
||||||
eOSState Summary(void);
|
eOSState Summary(void);
|
||||||
cTimer *CurrentTimer(void);
|
cTimer *CurrentTimer(void);
|
||||||
@ -1022,7 +1098,7 @@ cMenuTimers::cMenuTimers(void)
|
|||||||
}
|
}
|
||||||
if (Setup.SortTimers)
|
if (Setup.SortTimers)
|
||||||
Sort();
|
Sort();
|
||||||
SetHelp(tr("Edit"), tr("New"), tr("Delete"), Setup.SortTimers ? NULL : tr("Mark"));
|
SetHelp(tr("Edit"), tr("New"), tr("Delete"), Setup.SortTimers ? tr("On/Off") : tr("Mark"));
|
||||||
}
|
}
|
||||||
|
|
||||||
cTimer *cMenuTimers::CurrentTimer(void)
|
cTimer *cMenuTimers::CurrentTimer(void)
|
||||||
@ -1031,13 +1107,26 @@ cTimer *cMenuTimers::CurrentTimer(void)
|
|||||||
return item ? item->Timer() : NULL;
|
return item ? item->Timer() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
eOSState cMenuTimers::Activate(bool On)
|
eOSState cMenuTimers::OnOff(void)
|
||||||
{
|
{
|
||||||
cTimer *timer = CurrentTimer();
|
cTimer *timer = CurrentTimer();
|
||||||
if (timer && timer->active != On) {
|
if (timer) {
|
||||||
timer->active = On;
|
if (timer->IsSingleEvent())
|
||||||
|
timer->active = !timer->active;
|
||||||
|
else if (timer->firstday) {
|
||||||
|
timer->firstday = 0;
|
||||||
|
timer->active = false;
|
||||||
|
}
|
||||||
|
else if (timer->active)
|
||||||
|
timer->SkipToday();
|
||||||
|
else
|
||||||
|
timer->active = true;
|
||||||
|
timer->Matches(); // refresh start and end time
|
||||||
RefreshCurrent();
|
RefreshCurrent();
|
||||||
DisplayCurrent(true);
|
DisplayCurrent(true);
|
||||||
|
if (timer->firstday)
|
||||||
|
isyslog(LOG_INFO, "timer %d first day set to %s", timer->Index() + 1, timer->PrintFirstDay());
|
||||||
|
else
|
||||||
isyslog(LOG_INFO, "timer %d %sactivated", timer->Index() + 1, timer->active ? "" : "de");
|
isyslog(LOG_INFO, "timer %d %sactivated", timer->Index() + 1, timer->active ? "" : "de");
|
||||||
Timers.Save();
|
Timers.Save();
|
||||||
}
|
}
|
||||||
@ -1106,27 +1195,17 @@ eOSState cMenuTimers::Summary(void)
|
|||||||
|
|
||||||
eOSState cMenuTimers::ProcessKey(eKeys Key)
|
eOSState cMenuTimers::ProcessKey(eKeys Key)
|
||||||
{
|
{
|
||||||
// Must do these before calling cOsdMenu::ProcessKey() because cOsdMenu
|
|
||||||
// uses them to page up/down:
|
|
||||||
if (!HasSubMenu()) {
|
|
||||||
switch (Key) {
|
|
||||||
case kLeft:
|
|
||||||
case kRight: return Activate(Key == kRight);
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
eOSState state = cOsdMenu::ProcessKey(Key);
|
eOSState state = cOsdMenu::ProcessKey(Key);
|
||||||
|
|
||||||
if (state == osUnknown) {
|
if (state == osUnknown) {
|
||||||
switch (Key) {
|
switch (Key) {
|
||||||
case kLeft:
|
|
||||||
case kRight: return Activate(Key == kRight);
|
|
||||||
case kOk: return Summary();
|
case kOk: return Summary();
|
||||||
case kRed: return Edit();
|
case kRed: return Edit();
|
||||||
case kGreen: return New();
|
case kGreen: return New();
|
||||||
case kYellow: return Del();
|
case kYellow: return Del();
|
||||||
case kBlue: if (!Setup.SortTimers)
|
case kBlue: if (Setup.SortTimers)
|
||||||
|
OnOff();
|
||||||
|
else
|
||||||
Mark();
|
Mark();
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
|
22
tools.c
22
tools.c
@ -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: tools.c 1.58 2002/02/16 12:41:44 kls Exp $
|
* $Id: tools.c 1.59 2002/02/17 12:57:23 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -462,6 +462,20 @@ bool SpinUpDisk(const char *FileName)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *WeekDayName(int WeekDay)
|
||||||
|
{
|
||||||
|
static char buffer[4];
|
||||||
|
WeekDay = WeekDay == 0 ? 6 : WeekDay - 1; // we start with monday==0!
|
||||||
|
if (0 <= WeekDay && WeekDay <= 6) {
|
||||||
|
const char *day = tr("MonTueWedThuFriSatSun");
|
||||||
|
day += WeekDay * 3;
|
||||||
|
strncpy(buffer, day, 3);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
|
||||||
const char *DayDateTime(time_t t)
|
const char *DayDateTime(time_t t)
|
||||||
{
|
{
|
||||||
static char buffer[32];
|
static char buffer[32];
|
||||||
@ -469,11 +483,7 @@ const char *DayDateTime(time_t t)
|
|||||||
time(&t);
|
time(&t);
|
||||||
struct tm tm_r;
|
struct tm tm_r;
|
||||||
tm *tm = localtime_r(&t, &tm_r);
|
tm *tm = localtime_r(&t, &tm_r);
|
||||||
int weekday = tm->tm_wday == 0 ? 6 : tm->tm_wday - 1; // we start with monday==0!
|
snprintf(buffer, sizeof(buffer), "%s %2d.%02d %02d:%02d", WeekDayName(tm->tm_wday), tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
|
||||||
const char *day = tr("MonTueWedThuFriSatSun");
|
|
||||||
day += weekday * 3;
|
|
||||||
strncpy(buffer, day, 3);
|
|
||||||
snprintf(buffer + 3, sizeof(buffer) - 3, " %2d.%02d %02d:%02d", tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
tools.h
3
tools.h
@ -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: tools.h 1.41 2002/02/03 12:36:25 kls Exp $
|
* $Id: tools.h 1.42 2002/02/17 12:57:44 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TOOLS_H
|
#ifndef __TOOLS_H
|
||||||
@ -66,6 +66,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false);
|
|||||||
bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false);
|
bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false);
|
||||||
char *ReadLink(const char *FileName);
|
char *ReadLink(const char *FileName);
|
||||||
bool SpinUpDisk(const char *FileName);
|
bool SpinUpDisk(const char *FileName);
|
||||||
|
const char *WeekDayName(int WeekDay); // returns a statically allocated string!
|
||||||
const char *DayDateTime(time_t t = 0); // returns a statically allocated string!
|
const char *DayDateTime(time_t t = 0); // returns a statically allocated string!
|
||||||
|
|
||||||
class cFile {
|
class cFile {
|
||||||
|
Loading…
Reference in New Issue
Block a user