2000-02-19 13:36:48 +01:00
|
|
|
/*
|
|
|
|
* config.c: Configuration file handling
|
|
|
|
*
|
2000-04-24 09:46:05 +02:00
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
2000-02-19 13:36:48 +01:00
|
|
|
* how to reach the author.
|
|
|
|
*
|
2002-10-13 12:14:49 +02:00
|
|
|
* $Id: config.c 1.109 2002/10/13 10:03:49 kls Exp $
|
2000-02-19 13:36:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
2002-10-06 10:25:42 +02:00
|
|
|
#include "channels.h" //XXX timers!
|
2000-11-11 10:39:27 +01:00
|
|
|
#include "i18n.h"
|
2000-02-19 13:36:48 +01:00
|
|
|
#include "interface.h"
|
2002-05-09 16:26:56 +02:00
|
|
|
#include "plugin.h"
|
2002-06-16 12:57:31 +02:00
|
|
|
#include "recording.h"
|
2000-02-19 13:36:48 +01:00
|
|
|
|
2001-10-20 13:09:38 +02:00
|
|
|
// IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
|
|
|
|
// format characters in order to allow any number of blanks after a numeric
|
|
|
|
// value!
|
|
|
|
|
2000-02-19 13:36:48 +01:00
|
|
|
// -- cTimer -----------------------------------------------------------------
|
|
|
|
|
2000-07-23 15:01:31 +02:00
|
|
|
char *cTimer::buffer = NULL;
|
|
|
|
|
2000-04-15 17:38:11 +02:00
|
|
|
cTimer::cTimer(bool Instant)
|
2000-02-19 13:36:48 +01:00
|
|
|
{
|
2000-03-11 11:22:37 +01:00
|
|
|
startTime = stopTime = 0;
|
2001-08-11 15:48:54 +02:00
|
|
|
recording = pending = false;
|
2002-02-17 16:03:49 +01:00
|
|
|
active = Instant ? taActInst : taInactive;
|
2002-06-16 12:57:31 +02:00
|
|
|
cChannel *ch = Channels.GetByNumber(cDevice::CurrentChannel());
|
2002-10-06 10:25:42 +02:00
|
|
|
channel = ch ? ch->Number() : 0;
|
2000-04-15 17:38:11 +02:00
|
|
|
time_t t = time(NULL);
|
2001-10-19 13:22:24 +02:00
|
|
|
struct tm tm_r;
|
|
|
|
struct tm *now = localtime_r(&t, &tm_r);
|
2000-04-15 17:38:11 +02:00
|
|
|
day = now->tm_mday;
|
|
|
|
start = now->tm_hour * 100 + now->tm_min;
|
2002-04-26 13:43:46 +02:00
|
|
|
stop = now->tm_hour * 60 + now->tm_min + Setup.InstantRecordTime;
|
|
|
|
stop = (stop / 60) * 100 + (stop % 60);
|
2000-04-15 17:38:11 +02:00
|
|
|
if (stop >= 2400)
|
|
|
|
stop -= 2400;
|
2000-03-11 11:22:37 +01:00
|
|
|
//TODO VPS???
|
2001-06-02 10:47:40 +02:00
|
|
|
priority = Setup.DefaultPriority;
|
|
|
|
lifetime = Setup.DefaultLifetime;
|
2000-05-01 16:29:46 +02:00
|
|
|
*file = 0;
|
2002-02-17 13:05:05 +01:00
|
|
|
firstday = 0;
|
2000-07-24 16:43:04 +02:00
|
|
|
summary = NULL;
|
2000-09-09 14:57:43 +02:00
|
|
|
if (Instant && ch)
|
2002-10-06 10:25:42 +02:00
|
|
|
snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : ch->Name());
|
2000-02-19 13:36:48 +01:00
|
|
|
}
|
|
|
|
|
2000-10-29 13:17:22 +01:00
|
|
|
cTimer::cTimer(const cEventInfo *EventInfo)
|
|
|
|
{
|
|
|
|
startTime = stopTime = 0;
|
2001-08-11 15:48:54 +02:00
|
|
|
recording = pending = false;
|
2000-10-29 13:17:22 +01:00
|
|
|
active = true;
|
|
|
|
cChannel *ch = Channels.GetByServiceID(EventInfo->GetServiceID());
|
2002-10-06 10:25:42 +02:00
|
|
|
channel = ch ? ch->Number() : 0;
|
2000-10-29 13:17:22 +01:00
|
|
|
time_t tstart = EventInfo->GetTime();
|
|
|
|
time_t tstop = tstart + EventInfo->GetDuration() + Setup.MarginStop * 60;
|
|
|
|
tstart -= Setup.MarginStart * 60;
|
2001-10-19 13:22:24 +02:00
|
|
|
struct tm tm_r;
|
|
|
|
struct tm *time = localtime_r(&tstart, &tm_r);
|
2000-10-29 13:17:22 +01:00
|
|
|
day = time->tm_mday;
|
|
|
|
start = time->tm_hour * 100 + time->tm_min;
|
2001-10-19 13:22:24 +02:00
|
|
|
time = localtime_r(&tstop, &tm_r);
|
2000-10-29 13:17:22 +01:00
|
|
|
stop = time->tm_hour * 100 + time->tm_min;
|
|
|
|
if (stop >= 2400)
|
|
|
|
stop -= 2400;
|
2001-06-02 10:47:40 +02:00
|
|
|
priority = Setup.DefaultPriority;
|
|
|
|
lifetime = Setup.DefaultLifetime;
|
2000-10-29 13:17:22 +01:00
|
|
|
*file = 0;
|
|
|
|
const char *Title = EventInfo->GetTitle();
|
|
|
|
if (!isempty(Title))
|
|
|
|
strn0cpy(file, EventInfo->GetTitle(), sizeof(file));
|
2002-02-17 13:05:05 +01:00
|
|
|
firstday = 0;
|
2000-10-29 13:17:22 +01:00
|
|
|
summary = NULL;
|
|
|
|
}
|
|
|
|
|
2000-07-24 16:43:04 +02:00
|
|
|
cTimer::~cTimer()
|
|
|
|
{
|
2002-08-11 13:32:23 +02:00
|
|
|
free(summary);
|
2000-07-24 16:43:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cTimer& cTimer::operator= (const cTimer &Timer)
|
|
|
|
{
|
|
|
|
memcpy(this, &Timer, sizeof(*this));
|
|
|
|
if (summary)
|
|
|
|
summary = strdup(summary);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
bool cTimer::operator< (const cListObject &ListObject)
|
2001-08-26 14:17:20 +02:00
|
|
|
{
|
2002-05-09 16:26:56 +02:00
|
|
|
cTimer *ti = (cTimer *)&ListObject;
|
2001-08-26 14:17:20 +02:00
|
|
|
time_t t1 = StartTime();
|
2002-05-09 16:26:56 +02:00
|
|
|
time_t t2 = ti->StartTime();
|
|
|
|
return t1 < t2 || (t1 == t2 && priority > ti->priority);
|
2001-08-26 14:17:20 +02:00
|
|
|
}
|
|
|
|
|
2000-07-23 15:01:31 +02:00
|
|
|
const char *cTimer::ToText(cTimer *Timer)
|
|
|
|
{
|
2002-08-11 13:32:23 +02:00
|
|
|
free(buffer);
|
2001-02-11 11:29:22 +01:00
|
|
|
strreplace(Timer->file, ':', '|');
|
|
|
|
strreplace(Timer->summary, '\n', '|');
|
2002-02-17 13:05:05 +01:00
|
|
|
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 : "");
|
2001-02-11 11:29:22 +01:00
|
|
|
strreplace(Timer->summary, '|', '\n');
|
|
|
|
strreplace(Timer->file, '|', ':');
|
2000-07-23 15:01:31 +02:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *cTimer::ToText(void)
|
|
|
|
{
|
|
|
|
return ToText(this);
|
|
|
|
}
|
|
|
|
|
2000-02-19 13:36:48 +01:00
|
|
|
int cTimer::TimeToInt(int t)
|
|
|
|
{
|
|
|
|
return (t / 100 * 60 + t % 100) * 60;
|
|
|
|
}
|
|
|
|
|
2002-02-17 13:05:05 +01:00
|
|
|
int cTimer::ParseDay(const char *s, time_t *FirstDay)
|
2000-02-19 13:36:48 +01:00
|
|
|
{
|
|
|
|
char *tail;
|
|
|
|
int d = strtol(s, &tail, 10);
|
2002-02-17 13:05:05 +01:00
|
|
|
if (FirstDay)
|
|
|
|
*FirstDay = 0;
|
2000-02-19 13:36:48 +01:00
|
|
|
if (tail && *tail) {
|
|
|
|
d = 0;
|
|
|
|
if (tail == s) {
|
2002-02-17 13:05:05 +01:00
|
|
|
const char *first = strchr(s, '@');
|
|
|
|
int l = first ? first - s : strlen(s);
|
|
|
|
if (l == 7) {
|
2000-07-23 15:01:31 +02:00
|
|
|
for (const char *p = s + 6; p >= s; p--) {
|
2002-02-17 13:05:05 +01:00
|
|
|
d <<= 1;
|
|
|
|
d |= (*p != '-');
|
|
|
|
}
|
2000-02-19 13:36:48 +01:00
|
|
|
d |= 0x80000000;
|
|
|
|
}
|
2002-02-17 13:05:05 +01:00
|
|
|
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;
|
2002-04-01 11:04:47 +02:00
|
|
|
tm_r.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
|
2002-02-17 13:05:05 +01:00
|
|
|
*FirstDay = mktime(&tm_r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
d = 0;
|
|
|
|
}
|
2000-02-19 13:36:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (d < 1 || d > 31)
|
|
|
|
d = 0;
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2002-02-17 13:05:05 +01:00
|
|
|
const char *cTimer::PrintDay(int d, time_t FirstDay)
|
2000-02-19 13:36:48 +01:00
|
|
|
{
|
2002-02-17 13:05:05 +01:00
|
|
|
#define DAYBUFFERSIZE 32
|
|
|
|
static char buffer[DAYBUFFERSIZE];
|
2000-02-19 13:36:48 +01:00
|
|
|
if ((d & 0x80000000) != 0) {
|
|
|
|
char *b = buffer;
|
2000-11-11 10:39:27 +01:00
|
|
|
const char *w = tr("MTWTFSS");
|
2000-02-19 13:36:48 +01:00
|
|
|
while (*w) {
|
|
|
|
*b++ = (d & 1) ? *w : '-';
|
|
|
|
d >>= 1;
|
|
|
|
w++;
|
|
|
|
}
|
2002-02-17 13:05:05 +01:00
|
|
|
if (FirstDay) {
|
|
|
|
struct tm tm_r;
|
|
|
|
localtime_r(&FirstDay, &tm_r);
|
|
|
|
b += strftime(b, DAYBUFFERSIZE - (b - buffer), "@%Y-%m-%d", &tm_r);
|
|
|
|
}
|
|
|
|
*b = 0;
|
2000-02-19 13:36:48 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
sprintf(buffer, "%d", d);
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2002-02-17 13:05:05 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2000-07-23 15:01:31 +02:00
|
|
|
bool cTimer::Parse(const char *s)
|
2000-02-19 13:36:48 +01:00
|
|
|
{
|
|
|
|
char *buffer1 = NULL;
|
|
|
|
char *buffer2 = NULL;
|
2002-08-11 13:32:23 +02:00
|
|
|
free(summary);
|
2000-07-24 16:43:04 +02:00
|
|
|
summary = NULL;
|
2000-10-29 13:17:22 +01:00
|
|
|
//XXX Apparently sscanf() doesn't work correctly if the last %a argument
|
2000-11-11 16:38:41 +01:00
|
|
|
//XXX results in an empty string (this first occured when the EIT gathering
|
2000-10-29 13:17:22 +01:00
|
|
|
//XXX was put into a separate thread - don't know why this happens...
|
|
|
|
//XXX As a cure we copy the original string and add a blank.
|
|
|
|
//XXX If anybody can shed some light on why sscanf() failes here, I'd love
|
|
|
|
//XXX to hear about that!
|
|
|
|
char *s2 = NULL;
|
|
|
|
int l2 = strlen(s);
|
2001-01-13 11:31:56 +01:00
|
|
|
while (l2 > 0 && isspace(s[l2 - 1]))
|
|
|
|
l2--;
|
|
|
|
if (s[l2 - 1] == ':') {
|
2002-08-11 13:32:23 +02:00
|
|
|
s2 = MALLOC(char, l2 + 3);
|
2001-01-13 11:31:56 +01:00
|
|
|
strcat(strn0cpy(s2, s, l2 + 1), " \n");
|
2000-10-29 13:17:22 +01:00
|
|
|
s = s2;
|
|
|
|
}
|
2001-10-20 13:09:38 +02:00
|
|
|
if (8 <= sscanf(s, "%d :%d :%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &active, &channel, &buffer1, &start, &stop, &priority, &lifetime, &buffer2, &summary)) {
|
2000-10-29 13:17:22 +01:00
|
|
|
if (summary && !*skipspace(summary)) {
|
2002-08-11 13:32:23 +02:00
|
|
|
free(summary);
|
2000-10-29 13:17:22 +01:00
|
|
|
summary = NULL;
|
|
|
|
}
|
2000-07-23 15:01:31 +02:00
|
|
|
//TODO add more plausibility checks
|
2002-02-17 13:05:05 +01:00
|
|
|
day = ParseDay(buffer1, &firstday);
|
2000-09-09 14:57:43 +02:00
|
|
|
strn0cpy(file, buffer2, MaxFileName);
|
2001-02-11 11:29:22 +01:00
|
|
|
strreplace(file, '|', ':');
|
|
|
|
strreplace(summary, '|', '\n');
|
2002-08-11 13:32:23 +02:00
|
|
|
free(buffer1);
|
|
|
|
free(buffer2);
|
|
|
|
free(s2);
|
2000-02-19 13:36:48 +01:00
|
|
|
return day != 0;
|
|
|
|
}
|
2002-08-11 13:32:23 +02:00
|
|
|
free(s2);
|
2000-02-19 13:36:48 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cTimer::Save(FILE *f)
|
|
|
|
{
|
2000-07-23 15:01:31 +02:00
|
|
|
return fprintf(f, ToText()) > 0;
|
2000-02-19 13:36:48 +01:00
|
|
|
}
|
|
|
|
|
2000-03-11 11:22:37 +01:00
|
|
|
bool cTimer::IsSingleEvent(void)
|
|
|
|
{
|
|
|
|
return (day & 0x80000000) == 0;
|
|
|
|
}
|
|
|
|
|
2001-08-26 11:58:23 +02:00
|
|
|
int cTimer::GetMDay(time_t t)
|
|
|
|
{
|
2001-10-19 13:22:24 +02:00
|
|
|
struct tm tm_r;
|
|
|
|
return localtime_r(&t, &tm_r)->tm_mday;
|
2001-08-26 11:58:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int cTimer::GetWDay(time_t t)
|
|
|
|
{
|
2001-10-19 13:22:24 +02:00
|
|
|
struct tm tm_r;
|
|
|
|
int weekday = localtime_r(&t, &tm_r)->tm_wday;
|
2001-08-26 11:58:23 +02:00
|
|
|
return weekday == 0 ? 6 : weekday - 1; // we start with monday==0!
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cTimer::DayMatches(time_t t)
|
|
|
|
{
|
|
|
|
return IsSingleEvent() ? GetMDay(t) == day : (day & (1 << GetWDay(t))) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t cTimer::IncDay(time_t t, int Days)
|
|
|
|
{
|
2001-10-19 13:22:24 +02:00
|
|
|
struct tm tm_r;
|
|
|
|
tm tm = *localtime_r(&t, &tm_r);
|
2001-08-26 11:58:23 +02:00
|
|
|
tm.tm_mday += Days; // now tm_mday may be out of its valid range
|
|
|
|
int h = tm.tm_hour; // save original hour to compensate for DST change
|
2002-04-01 11:04:47 +02:00
|
|
|
tm.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
|
2001-08-26 11:58:23 +02:00
|
|
|
t = mktime(&tm); // normalize all values
|
|
|
|
tm.tm_hour = h; // compensate for DST change
|
|
|
|
return mktime(&tm); // calculate final result
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t cTimer::SetTime(time_t t, int SecondsFromMidnight)
|
|
|
|
{
|
2001-10-19 13:22:24 +02:00
|
|
|
struct tm tm_r;
|
|
|
|
tm tm = *localtime_r(&t, &tm_r);
|
2001-08-26 11:58:23 +02:00
|
|
|
tm.tm_hour = SecondsFromMidnight / 3600;
|
|
|
|
tm.tm_min = (SecondsFromMidnight % 3600) / 60;
|
|
|
|
tm.tm_sec = SecondsFromMidnight % 60;
|
2002-04-01 11:04:47 +02:00
|
|
|
tm.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
|
2001-08-26 11:58:23 +02:00
|
|
|
return mktime(&tm);
|
|
|
|
}
|
|
|
|
|
2002-02-03 15:55:04 +01:00
|
|
|
char *cTimer::SetFile(const char *File)
|
|
|
|
{
|
|
|
|
if (!isempty(File))
|
|
|
|
strn0cpy(file, File, sizeof(file));
|
|
|
|
return file;
|
|
|
|
}
|
|
|
|
|
2000-07-16 13:37:30 +02:00
|
|
|
bool cTimer::Matches(time_t t)
|
2000-02-19 13:36:48 +01:00
|
|
|
{
|
2001-08-26 11:58:23 +02:00
|
|
|
startTime = stopTime = 0;
|
|
|
|
if (t == 0)
|
|
|
|
t = time(NULL);
|
|
|
|
|
|
|
|
int begin = TimeToInt(start); // seconds from midnight
|
|
|
|
int length = TimeToInt(stop) - begin;
|
|
|
|
if (length < 0)
|
|
|
|
length += SECSINDAY;
|
|
|
|
|
2002-02-01 15:37:35 +01:00
|
|
|
int DaysToCheck = IsSingleEvent() ? 61 : 7; // 61 to handle months with 31/30/31
|
2001-08-26 11:58:23 +02:00
|
|
|
for (int i = -1; i <= DaysToCheck; i++) {
|
|
|
|
time_t t0 = IncDay(t, i);
|
|
|
|
if (DayMatches(t0)) {
|
|
|
|
time_t a = SetTime(t0, begin);
|
|
|
|
time_t b = a + length;
|
2002-02-17 13:05:05 +01:00
|
|
|
if ((!firstday || a >= firstday) && t <= b) {
|
2001-08-26 11:58:23 +02:00
|
|
|
startTime = a;
|
|
|
|
stopTime = b;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-02-17 13:05:05 +01:00
|
|
|
if (!startTime)
|
|
|
|
startTime = firstday; // just to have something that's more than a week in the future
|
2002-04-06 09:58:36 +02:00
|
|
|
else if (t > startTime || t > firstday + SECSINDAY + 3600) // +3600 in case of DST change
|
|
|
|
firstday = 0;
|
2001-09-01 15:04:14 +02:00
|
|
|
return active && startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers
|
2000-02-19 13:36:48 +01:00
|
|
|
}
|
|
|
|
|
2000-03-11 11:22:37 +01:00
|
|
|
time_t cTimer::StartTime(void)
|
2001-06-02 10:47:40 +02:00
|
|
|
{
|
2000-03-11 11:22:37 +01:00
|
|
|
if (!startTime)
|
|
|
|
Matches();
|
|
|
|
return startTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
time_t cTimer::StopTime(void)
|
2001-06-02 10:47:40 +02:00
|
|
|
{
|
2000-03-11 11:22:37 +01:00
|
|
|
if (!stopTime)
|
|
|
|
Matches();
|
|
|
|
return stopTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cTimer::SetRecording(bool Recording)
|
|
|
|
{
|
|
|
|
recording = Recording;
|
2002-05-13 16:35:49 +02:00
|
|
|
isyslog("timer %d %s", Index() + 1, recording ? "start" : "stop");
|
2000-03-11 11:22:37 +01:00
|
|
|
}
|
|
|
|
|
2001-08-11 15:48:54 +02:00
|
|
|
void cTimer::SetPending(bool Pending)
|
|
|
|
{
|
|
|
|
pending = Pending;
|
|
|
|
}
|
|
|
|
|
2002-03-31 21:24:10 +02:00
|
|
|
void cTimer::Skip(void)
|
2002-02-17 13:05:05 +01:00
|
|
|
{
|
2002-03-31 21:24:10 +02:00
|
|
|
firstday = IncDay(SetTime(StartTime(), 0), 1);
|
2002-02-17 13:05:05 +01:00
|
|
|
}
|
|
|
|
|
2000-11-11 16:38:41 +01:00
|
|
|
// --- cCommand -------------------------------------------------------------
|
|
|
|
|
|
|
|
char *cCommand::result = NULL;
|
|
|
|
|
|
|
|
cCommand::cCommand(void)
|
|
|
|
{
|
|
|
|
title = command = NULL;
|
2002-10-13 09:03:53 +02:00
|
|
|
confirm = false;
|
2000-11-11 16:38:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
cCommand::~cCommand()
|
|
|
|
{
|
2002-08-11 13:32:23 +02:00
|
|
|
free(title);
|
|
|
|
free(command);
|
2000-11-11 16:38:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cCommand::Parse(const char *s)
|
|
|
|
{
|
|
|
|
const char *p = strchr(s, ':');
|
|
|
|
if (p) {
|
|
|
|
int l = p - s;
|
|
|
|
if (l > 0) {
|
2002-10-13 09:03:53 +02:00
|
|
|
title = MALLOC(char, l + 1);
|
|
|
|
stripspace(strn0cpy(title, s, l + 1));
|
2000-11-11 16:38:41 +01:00
|
|
|
if (!isempty(title)) {
|
2002-10-13 09:03:53 +02:00
|
|
|
int l = strlen(title);
|
|
|
|
if (l > 1 && title[l - 1] == '?') {
|
|
|
|
confirm = true;
|
|
|
|
title[l - 1] = 0;
|
|
|
|
}
|
2000-11-11 16:38:41 +01:00
|
|
|
command = stripspace(strdup(skipspace(p + 1)));
|
|
|
|
return !isempty(command);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-10-13 12:14:49 +02:00
|
|
|
const char *cCommand::Execute(const char *Parameters)
|
2000-11-11 16:38:41 +01:00
|
|
|
{
|
2002-08-11 13:32:23 +02:00
|
|
|
free(result);
|
2000-11-11 16:38:41 +01:00
|
|
|
result = NULL;
|
2002-10-13 12:14:49 +02:00
|
|
|
char *cmdbuf = NULL;
|
|
|
|
if (Parameters)
|
|
|
|
asprintf(&cmdbuf, "%s %s", command, Parameters);
|
|
|
|
const char *cmd = cmdbuf ? cmdbuf : command;
|
|
|
|
dsyslog("executing command '%s'", cmd);
|
|
|
|
FILE *p = popen(cmd, "r");
|
2000-11-11 16:38:41 +01:00
|
|
|
if (p) {
|
|
|
|
int l = 0;
|
|
|
|
int c;
|
|
|
|
while ((c = fgetc(p)) != EOF) {
|
|
|
|
if (l % 20 == 0)
|
|
|
|
result = (char *)realloc(result, l + 21);
|
|
|
|
result[l++] = c;
|
|
|
|
}
|
|
|
|
if (result)
|
|
|
|
result[l] = 0;
|
|
|
|
pclose(p);
|
|
|
|
}
|
|
|
|
else
|
2002-10-13 12:14:49 +02:00
|
|
|
esyslog("ERROR: can't open pipe for command '%s'", cmd);
|
|
|
|
free(cmdbuf);
|
2000-11-11 16:38:41 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2002-02-02 17:20:54 +01:00
|
|
|
// -- cSVDRPhost -------------------------------------------------------------
|
|
|
|
|
|
|
|
cSVDRPhost::cSVDRPhost(void)
|
|
|
|
{
|
|
|
|
addr.s_addr = 0;
|
|
|
|
mask = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cSVDRPhost::Parse(const char *s)
|
|
|
|
{
|
|
|
|
mask = 0xFFFFFFFF;
|
|
|
|
const char *p = strchr(s, '/');
|
|
|
|
if (p) {
|
|
|
|
char *error = NULL;
|
|
|
|
int m = strtoul(p + 1, &error, 10);
|
2002-09-29 13:40:45 +02:00
|
|
|
if (error && *error && !isspace(*error) || m > 32)
|
2002-02-02 17:20:54 +01:00
|
|
|
return false;
|
|
|
|
*(char *)p = 0; // yes, we know it's 'const' - will be restored!
|
|
|
|
if (m == 0)
|
|
|
|
mask = 0;
|
|
|
|
else
|
|
|
|
mask >>= (32 - m);
|
|
|
|
}
|
|
|
|
int result = inet_aton(s, &addr);
|
|
|
|
if (p)
|
|
|
|
*(char *)p = '/'; // there it is again
|
|
|
|
return result != 0 && (mask != 0 || addr.s_addr == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cSVDRPhost::Accepts(in_addr_t Address)
|
|
|
|
{
|
|
|
|
return (Address & mask) == addr.s_addr;
|
|
|
|
}
|
|
|
|
|
2002-03-03 16:12:29 +01:00
|
|
|
// -- cCaDefinition ----------------------------------------------------------
|
|
|
|
|
|
|
|
cCaDefinition::cCaDefinition(void)
|
|
|
|
{
|
|
|
|
number = 0;
|
|
|
|
description = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cCaDefinition::~cCaDefinition()
|
|
|
|
{
|
2002-08-11 13:32:23 +02:00
|
|
|
free(description);
|
2002-03-03 16:12:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cCaDefinition::Parse(const char *s)
|
|
|
|
{
|
|
|
|
return 2 == sscanf(s, "%d %a[^\n]", &number, &description) && description && *description;
|
|
|
|
}
|
|
|
|
|
2000-11-11 16:38:41 +01:00
|
|
|
// -- cCommands --------------------------------------------------------------
|
|
|
|
|
|
|
|
cCommands Commands;
|
2002-10-13 12:14:49 +02:00
|
|
|
cCommands RecordingCommands;
|
2000-11-11 16:38:41 +01:00
|
|
|
|
2000-02-19 13:36:48 +01:00
|
|
|
// -- cTimers ----------------------------------------------------------------
|
|
|
|
|
|
|
|
cTimers Timers;
|
|
|
|
|
2000-08-06 12:56:49 +02:00
|
|
|
cTimer *cTimers::GetTimer(cTimer *Timer)
|
|
|
|
{
|
|
|
|
cTimer *ti = (cTimer *)First();
|
|
|
|
while (ti) {
|
|
|
|
if (ti->channel == Timer->channel && ti->day == Timer->day && ti->start == Timer->start && ti->stop == Timer->stop)
|
|
|
|
return ti;
|
|
|
|
ti = (cTimer *)ti->Next();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-09-01 15:04:14 +02:00
|
|
|
cTimer *cTimers::GetMatch(time_t t)
|
2001-08-26 15:02:00 +02:00
|
|
|
{
|
|
|
|
cTimer *t0 = NULL;
|
|
|
|
cTimer *ti = First();
|
|
|
|
while (ti) {
|
|
|
|
if (!ti->recording && ti->Matches(t)) {
|
|
|
|
if (!t0 || ti->priority > t0->priority)
|
|
|
|
t0 = ti;
|
|
|
|
}
|
|
|
|
ti = (cTimer *)ti->Next();
|
|
|
|
}
|
|
|
|
return t0;
|
|
|
|
}
|
|
|
|
|
|
|
|
cTimer *cTimers::GetNextActiveTimer(void)
|
|
|
|
{
|
|
|
|
cTimer *t0 = NULL;
|
|
|
|
cTimer *ti = First();
|
|
|
|
while (ti) {
|
|
|
|
if (ti->active && (!t0 || *ti < *t0))
|
|
|
|
t0 = ti;
|
|
|
|
ti = (cTimer *)ti->Next();
|
|
|
|
}
|
|
|
|
return t0;
|
|
|
|
}
|
|
|
|
|
2002-02-02 17:20:54 +01:00
|
|
|
// -- cSVDRPhosts ------------------------------------------------------------
|
|
|
|
|
|
|
|
cSVDRPhosts SVDRPhosts;
|
|
|
|
|
|
|
|
bool cSVDRPhosts::Acceptable(in_addr_t Address)
|
|
|
|
{
|
|
|
|
cSVDRPhost *h = First();
|
|
|
|
while (h) {
|
|
|
|
if (h->Accepts(Address))
|
|
|
|
return true;
|
|
|
|
h = (cSVDRPhost *)h->Next();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-03-03 16:12:29 +01:00
|
|
|
// -- cCaDefinitions ---------------------------------------------------------
|
|
|
|
|
|
|
|
cCaDefinitions CaDefinitions;
|
|
|
|
|
|
|
|
const cCaDefinition *cCaDefinitions::Get(int Number)
|
|
|
|
{
|
|
|
|
cCaDefinition *p = First();
|
|
|
|
while (p) {
|
|
|
|
if (p->Number() == Number)
|
|
|
|
return p;
|
|
|
|
p = (cCaDefinition *)p->Next();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
// -- cSetupLine -------------------------------------------------------------
|
|
|
|
|
|
|
|
cSetupLine::cSetupLine(void)
|
|
|
|
{
|
|
|
|
plugin = name = value = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cSetupLine::cSetupLine(const char *Name, const char *Value, const char *Plugin)
|
|
|
|
{
|
|
|
|
name = strdup(Name);
|
|
|
|
value = strdup(Value);
|
|
|
|
plugin = Plugin ? strdup(Plugin) : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cSetupLine::~cSetupLine()
|
|
|
|
{
|
2002-08-11 13:32:23 +02:00
|
|
|
free(plugin);
|
|
|
|
free(name);
|
|
|
|
free(value);
|
2002-05-09 16:26:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cSetupLine::operator< (const cListObject &ListObject)
|
|
|
|
{
|
|
|
|
const cSetupLine *sl = (cSetupLine *)&ListObject;
|
|
|
|
if (!plugin && !sl->plugin)
|
2002-09-04 17:26:02 +02:00
|
|
|
return strcasecmp(name, sl->name) < 0;
|
2002-05-09 16:26:56 +02:00
|
|
|
if (!plugin)
|
|
|
|
return true;
|
|
|
|
if (!sl->plugin)
|
|
|
|
return false;
|
|
|
|
int result = strcasecmp(plugin, sl->plugin);
|
|
|
|
if (result == 0)
|
|
|
|
result = strcasecmp(name, sl->name);
|
|
|
|
return result < 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cSetupLine::Parse(char *s)
|
|
|
|
{
|
2002-06-16 12:57:31 +02:00
|
|
|
//dsyslog("cSetupLine::Parse '%s'", s);//XXX-
|
2002-05-09 16:26:56 +02:00
|
|
|
char *p = strchr(s, '=');
|
|
|
|
if (p) {
|
|
|
|
*p = 0;
|
|
|
|
char *Name = compactspace(s);
|
|
|
|
char *Value = compactspace(p + 1);
|
|
|
|
if (*Name && *Value) {
|
|
|
|
p = strchr(Name, '.');
|
|
|
|
if (p) {
|
|
|
|
*p = 0;
|
|
|
|
char *Plugin = compactspace(Name);
|
|
|
|
Name = compactspace(p + 1);
|
|
|
|
if (!(*Plugin && *Name))
|
|
|
|
return false;
|
|
|
|
plugin = strdup(Plugin);
|
|
|
|
}
|
|
|
|
name = strdup(Name);
|
|
|
|
value = strdup(Value);
|
2002-06-16 12:57:31 +02:00
|
|
|
//dsyslog("cSetupLine::Parse '%s' = '%s'", name, value);//XXX-
|
2002-05-09 16:26:56 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cSetupLine::Save(FILE *f)
|
|
|
|
{
|
2002-06-16 12:57:31 +02:00
|
|
|
//dsyslog("cSetupLine::Save '%s' = '%s'", name, value);//XXX-
|
2002-05-09 16:26:56 +02:00
|
|
|
return fprintf(f, "%s%s%s = %s\n", plugin ? plugin : "", plugin ? "." : "", name, value) > 0;
|
|
|
|
}
|
|
|
|
|
2000-09-10 10:51:58 +02:00
|
|
|
// -- cSetup -----------------------------------------------------------------
|
|
|
|
|
|
|
|
cSetup Setup;
|
|
|
|
|
|
|
|
cSetup::cSetup(void)
|
|
|
|
{
|
2000-11-11 10:39:27 +01:00
|
|
|
OSDLanguage = 0;
|
2000-09-10 10:51:58 +02:00
|
|
|
PrimaryDVB = 1;
|
|
|
|
ShowInfoOnChSwitch = 1;
|
|
|
|
MenuScrollPage = 1;
|
2000-10-08 13:08:13 +02:00
|
|
|
MarkInstantRecord = 1;
|
2002-02-10 11:40:29 +01:00
|
|
|
strcpy(NameInstantRecord, "TITLE EPISODE");
|
2002-04-26 13:43:46 +02:00
|
|
|
InstantRecordTime = 180;
|
2001-06-02 10:47:40 +02:00
|
|
|
LnbSLOF = 11700;
|
2000-10-08 16:18:23 +02:00
|
|
|
LnbFrequLo = 9750;
|
|
|
|
LnbFrequHi = 10600;
|
2001-08-11 08:44:48 +02:00
|
|
|
DiSEqC = 0;
|
2000-10-29 13:17:22 +01:00
|
|
|
SetSystemTime = 0;
|
2002-03-17 14:24:11 +01:00
|
|
|
TimeTransponder = 0;
|
2000-10-29 13:17:22 +01:00
|
|
|
MarginStart = 2;
|
|
|
|
MarginStop = 10;
|
2000-11-18 13:57:32 +01:00
|
|
|
EPGScanTimeout = 5;
|
2001-08-17 13:19:10 +02:00
|
|
|
EPGBugfixLevel = 2;
|
2001-02-18 14:18:13 +01:00
|
|
|
SVDRPTimeout = 300;
|
2001-08-26 14:17:20 +02:00
|
|
|
SortTimers = 1;
|
2001-02-24 14:03:39 +01:00
|
|
|
PrimaryLimit = 0;
|
2001-06-02 10:47:40 +02:00
|
|
|
DefaultPriority = 50;
|
|
|
|
DefaultLifetime = 50;
|
2001-09-02 15:21:54 +02:00
|
|
|
UseSubtitle = 1;
|
2002-01-20 14:05:28 +01:00
|
|
|
RecordingDirs = 1;
|
2002-08-04 14:57:29 +02:00
|
|
|
VideoFormat = 0;
|
2002-02-24 11:55:24 +01:00
|
|
|
RecordDolbyDigital = 1;
|
2001-07-27 10:59:50 +02:00
|
|
|
ChannelInfoPos = 0;
|
2001-07-27 11:51:42 +02:00
|
|
|
OSDwidth = 52;
|
|
|
|
OSDheight = 18;
|
2001-09-01 15:23:27 +02:00
|
|
|
OSDMessageTime = 1;
|
2001-08-25 13:52:38 +02:00
|
|
|
MaxVideoFileSize = MAXVIDEOFILESIZE;
|
2001-09-30 11:31:43 +02:00
|
|
|
SplitEditedFiles = 0;
|
2001-09-07 15:37:26 +02:00
|
|
|
MinEventTimeout = 30;
|
2001-09-01 09:04:37 +02:00
|
|
|
MinUserInactivity = 120;
|
2001-09-09 12:52:41 +02:00
|
|
|
MultiSpeedMode = 0;
|
2001-09-14 14:06:43 +02:00
|
|
|
ShowReplayMode = 0;
|
2002-03-03 16:12:29 +01:00
|
|
|
memset(CaCaps, sizeof(CaCaps), 0);
|
2001-01-14 15:29:51 +01:00
|
|
|
CurrentChannel = -1;
|
2001-09-22 13:41:49 +02:00
|
|
|
CurrentVolume = MAXVOLUME;
|
2000-09-10 10:51:58 +02:00
|
|
|
}
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
cSetup& cSetup::operator= (const cSetup &s)
|
|
|
|
{
|
|
|
|
memcpy(&__BeginData__, &s.__BeginData__, (char *)&s.__EndData__ - (char *)&s.__BeginData__);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
cSetupLine *cSetup::Get(const char *Name, const char *Plugin)
|
|
|
|
{
|
|
|
|
for (cSetupLine *l = First(); l; l = Next(l)) {
|
|
|
|
if ((l->Plugin() == NULL) == (Plugin == NULL)) {
|
|
|
|
if ((!Plugin || strcasecmp(l->Plugin(), Plugin) == 0) && strcasecmp(l->Name(), Name) == 0)
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSetup::Store(const char *Name, const char *Value, const char *Plugin)
|
|
|
|
{
|
|
|
|
if (Name && *Name) {
|
|
|
|
cSetupLine *l = Get(Name, Plugin);
|
|
|
|
if (l)
|
|
|
|
Del(l);
|
|
|
|
if (Value)
|
|
|
|
Add(new cSetupLine(Name, Value, Plugin));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSetup::Store(const char *Name, int Value, const char *Plugin)
|
|
|
|
{
|
|
|
|
char *buffer = NULL;
|
|
|
|
asprintf(&buffer, "%d", Value);
|
|
|
|
Store(Name, buffer, Plugin);
|
2002-08-11 13:32:23 +02:00
|
|
|
free(buffer);
|
2002-05-09 16:26:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cSetup::Load(const char *FileName)
|
|
|
|
{
|
|
|
|
if (cConfig<cSetupLine>::Load(FileName, true)) {
|
|
|
|
bool result = true;
|
|
|
|
for (cSetupLine *l = First(); l; l = Next(l)) {
|
2002-05-11 13:44:58 +02:00
|
|
|
bool error = false;
|
2002-05-09 16:26:56 +02:00
|
|
|
if (l->Plugin()) {
|
|
|
|
cPlugin *p = cPluginManager::GetPlugin(l->Plugin());
|
|
|
|
if (p && !p->SetupParse(l->Name(), l->Value()))
|
2002-05-11 13:44:58 +02:00
|
|
|
error = true;
|
2002-05-09 16:26:56 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!Parse(l->Name(), l->Value()))
|
2002-05-11 13:44:58 +02:00
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
if (error) {
|
2002-05-13 16:35:49 +02:00
|
|
|
esyslog("ERROR: unknown config parameter: %s%s%s = %s", l->Plugin() ? l->Plugin() : "", l->Plugin() ? "." : "", l->Name(), l->Value());
|
2002-05-11 13:44:58 +02:00
|
|
|
result = false;
|
2002-05-09 16:26:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cSetup::StoreCaCaps(const char *Name)
|
2002-03-03 16:12:29 +01:00
|
|
|
{
|
2002-06-16 12:57:31 +02:00
|
|
|
for (int d = 0; d < MAXDEVICES; d++) {
|
2002-05-09 16:26:56 +02:00
|
|
|
char buffer[MAXPARSEBUFFER];
|
|
|
|
char *q = buffer;
|
|
|
|
*buffer = 0;
|
2002-03-08 15:06:37 +01:00
|
|
|
for (int i = 0; i < MAXCACAPS; i++) {
|
|
|
|
if (CaCaps[d][i]) {
|
2002-05-09 16:26:56 +02:00
|
|
|
if (!*buffer)
|
|
|
|
q += snprintf(buffer, sizeof(buffer), "%d", d + 1);
|
|
|
|
q += snprintf(q, sizeof(buffer) - (q - buffer), " %d", CaCaps[d][i]);
|
2002-03-08 15:06:37 +01:00
|
|
|
}
|
|
|
|
}
|
2002-05-09 16:26:56 +02:00
|
|
|
if (*buffer)
|
|
|
|
Store(Name, buffer);
|
2002-03-03 16:12:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cSetup::ParseCaCaps(const char *Value)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
int d = strtol(Value, &p, 10);
|
2002-06-16 12:57:31 +02:00
|
|
|
if (d > 0 && d <= MAXDEVICES) {
|
2002-03-03 16:12:29 +01:00
|
|
|
d--;
|
|
|
|
int i = 0;
|
|
|
|
while (p != Value && p && *p) {
|
|
|
|
if (i < MAXCACAPS) {
|
|
|
|
int c = strtol(p, &p, 10);
|
|
|
|
if (c > 0)
|
|
|
|
CaCaps[d][i++] = c;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
bool cSetup::Parse(const char *Name, const char *Value)
|
|
|
|
{
|
|
|
|
if (!strcasecmp(Name, "OSDLanguage")) OSDLanguage = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "PrimaryDVB")) PrimaryDVB = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "ShowInfoOnChSwitch")) ShowInfoOnChSwitch = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MenuScrollPage")) MenuScrollPage = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MarkInstantRecord")) MarkInstantRecord = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "NameInstantRecord")) strn0cpy(NameInstantRecord, Value, MaxFileName);
|
|
|
|
else if (!strcasecmp(Name, "InstantRecordTime")) InstantRecordTime = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "LnbSLOF")) LnbSLOF = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "LnbFrequLo")) LnbFrequLo = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "LnbFrequHi")) LnbFrequHi = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "DiSEqC")) DiSEqC = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "SetSystemTime")) SetSystemTime = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "SortTimers")) SortTimers = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "PrimaryLimit")) PrimaryLimit = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "DefaultPriority")) DefaultPriority = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "UseSubtitle")) UseSubtitle = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "RecordingDirs")) RecordingDirs = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "VideoFormat")) VideoFormat = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "RecordDolbyDigital")) RecordDolbyDigital = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "OSDwidth")) OSDwidth = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "OSDheight")) OSDheight = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "OSDMessageTime")) OSDMessageTime = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MaxVideoFileSize")) MaxVideoFileSize = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "SplitEditedFiles")) SplitEditedFiles = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MinEventTimeout")) MinEventTimeout = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MinUserInactivity")) MinUserInactivity = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "MultiSpeedMode")) MultiSpeedMode = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "CaCaps")) return ParseCaCaps(Value);
|
|
|
|
else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value);
|
|
|
|
else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value);
|
2000-09-10 10:51:58 +02:00
|
|
|
else
|
2002-05-09 16:26:56 +02:00
|
|
|
return false;
|
|
|
|
return true;
|
2000-09-10 10:51:58 +02:00
|
|
|
}
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
bool cSetup::Save(void)
|
|
|
|
{
|
|
|
|
Store("OSDLanguage", OSDLanguage);
|
|
|
|
Store("PrimaryDVB", PrimaryDVB);
|
|
|
|
Store("ShowInfoOnChSwitch", ShowInfoOnChSwitch);
|
|
|
|
Store("MenuScrollPage", MenuScrollPage);
|
|
|
|
Store("MarkInstantRecord", MarkInstantRecord);
|
|
|
|
Store("NameInstantRecord", NameInstantRecord);
|
|
|
|
Store("InstantRecordTime", InstantRecordTime);
|
|
|
|
Store("LnbSLOF", LnbSLOF);
|
|
|
|
Store("LnbFrequLo", LnbFrequLo);
|
|
|
|
Store("LnbFrequHi", LnbFrequHi);
|
|
|
|
Store("DiSEqC", DiSEqC);
|
|
|
|
Store("SetSystemTime", SetSystemTime);
|
|
|
|
Store("TimeTransponder", TimeTransponder);
|
|
|
|
Store("MarginStart", MarginStart);
|
|
|
|
Store("MarginStop", MarginStop);
|
|
|
|
Store("EPGScanTimeout", EPGScanTimeout);
|
|
|
|
Store("EPGBugfixLevel", EPGBugfixLevel);
|
|
|
|
Store("SVDRPTimeout", SVDRPTimeout);
|
|
|
|
Store("SortTimers", SortTimers);
|
|
|
|
Store("PrimaryLimit", PrimaryLimit);
|
|
|
|
Store("DefaultPriority", DefaultPriority);
|
|
|
|
Store("DefaultLifetime", DefaultLifetime);
|
|
|
|
Store("UseSubtitle", UseSubtitle);
|
|
|
|
Store("RecordingDirs", RecordingDirs);
|
|
|
|
Store("VideoFormat", VideoFormat);
|
|
|
|
Store("RecordDolbyDigital", RecordDolbyDigital);
|
|
|
|
Store("ChannelInfoPos", ChannelInfoPos);
|
|
|
|
Store("OSDwidth", OSDwidth);
|
|
|
|
Store("OSDheight", OSDheight);
|
|
|
|
Store("OSDMessageTime", OSDMessageTime);
|
|
|
|
Store("MaxVideoFileSize", MaxVideoFileSize);
|
|
|
|
Store("SplitEditedFiles", SplitEditedFiles);
|
|
|
|
Store("MinEventTimeout", MinEventTimeout);
|
|
|
|
Store("MinUserInactivity", MinUserInactivity);
|
|
|
|
Store("MultiSpeedMode", MultiSpeedMode);
|
|
|
|
Store("ShowReplayMode", ShowReplayMode);
|
|
|
|
StoreCaCaps("CaCaps");
|
|
|
|
Store("CurrentChannel", CurrentChannel);
|
|
|
|
Store("CurrentVolume", CurrentVolume);
|
|
|
|
|
|
|
|
Sort();
|
|
|
|
|
|
|
|
if (cConfig<cSetupLine>::Save()) {
|
2002-05-13 16:35:49 +02:00
|
|
|
isyslog("saved setup to %s", FileName());
|
2002-05-09 16:26:56 +02:00
|
|
|
return true;
|
2000-09-10 10:51:58 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|