vdr  1.7.31
config.c
Go to the documentation of this file.
1 /*
2  * config.c: Configuration file handling
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: config.c 2.28 2012/09/15 11:52:03 kls Exp $
8  */
9 
10 #include "config.h"
11 #include <ctype.h>
12 #include <stdlib.h>
13 #include "device.h"
14 #include "i18n.h"
15 #include "interface.h"
16 #include "plugin.h"
17 #include "recording.h"
18 
19 // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
20 // format characters in order to allow any number of blanks after a numeric
21 // value!
22 
23 #define ChkDoublePlausibility(Variable, Default) { if (Variable < 0.00001) Variable = Default; }
24 
25 // --- cSVDRPhost ------------------------------------------------------------
26 
28 {
29  addr.s_addr = 0;
30  mask = 0;
31 }
32 
33 bool cSVDRPhost::Parse(const char *s)
34 {
35  mask = 0xFFFFFFFF;
36  const char *p = strchr(s, '/');
37  if (p) {
38  char *error = NULL;
39  int m = strtoul(p + 1, &error, 10);
40  if (error && *error && !isspace(*error) || m > 32)
41  return false;
42  *(char *)p = 0; // yes, we know it's 'const' - will be restored!
43  if (m == 0)
44  mask = 0;
45  else {
46  mask <<= (32 - m);
47  mask = htonl(mask);
48  }
49  }
50  int result = inet_aton(s, &addr);
51  if (p)
52  *(char *)p = '/'; // there it is again
53  return result != 0 && (mask != 0 || addr.s_addr == 0);
54 }
55 
57 {
58  return addr.s_addr == htonl(INADDR_LOOPBACK);
59 }
60 
62 {
63  return (Address & mask) == (addr.s_addr & mask);
64 }
65 
66 // --- cSatCableNumbers ------------------------------------------------------
67 
68 cSatCableNumbers::cSatCableNumbers(int Size, const char *s)
69 {
70  size = Size;
71  array = MALLOC(int, size);
72  FromString(s);
73 }
74 
76 {
77  free(array);
78 }
79 
80 bool cSatCableNumbers::FromString(const char *s)
81 {
82  char *t;
83  int i = 0;
84  const char *p = s;
85  while (p && *p) {
86  int n = strtol(p, &t, 10);
87  if (t != p) {
88  if (i < size)
89  array[i++] = n;
90  else {
91  esyslog("ERROR: too many sat cable numbers in '%s'", s);
92  return false;
93  }
94  }
95  else {
96  esyslog("ERROR: invalid sat cable number in '%s'", s);
97  return false;
98  }
99  p = skipspace(t);
100  }
101  for ( ; i < size; i++)
102  array[i] = 0;
103  return true;
104 }
105 
107 {
108  cString s("");
109  for (int i = 0; i < size; i++) {
110  s = cString::sprintf("%s%d ", *s, array[i]);
111  }
112  return s;
113 }
114 
115 int cSatCableNumbers::FirstDeviceIndex(int DeviceIndex) const
116 {
117  if (0 <= DeviceIndex && DeviceIndex < size) {
118  if (int CableNr = array[DeviceIndex]) {
119  for (int i = 0; i < size; i++) {
120  if (i < DeviceIndex && array[i] == CableNr)
121  return i;
122  }
123  }
124  }
125  return -1;
126 }
127 
128 // --- cNestedItem -----------------------------------------------------------
129 
130 cNestedItem::cNestedItem(const char *Text, bool WithSubItems)
131 {
132  text = strdup(Text ? Text : "");
133  subItems = WithSubItems ? new cList<cNestedItem> : NULL;
134 }
135 
137 {
138  delete subItems;
139  free(text);
140 }
141 
142 int cNestedItem::Compare(const cListObject &ListObject) const
143 {
144  return strcasecmp(text, ((cNestedItem *)&ListObject)->text);
145 }
146 
148 {
149  if (!subItems)
151  if (Item)
152  subItems->Add(Item);
153 }
154 
155 void cNestedItem::SetText(const char *Text)
156 {
157  free(text);
158  text = strdup(Text ? Text : "");
159 }
160 
162 {
163  if (On && !subItems)
165  else if (!On && subItems) {
166  delete subItems;
167  subItems = NULL;
168  }
169 }
170 
171 // --- cNestedItemList -------------------------------------------------------
172 
174 {
175  fileName = NULL;
176 }
177 
179 {
180  free(fileName);
181 }
182 
184 {
185  char *s;
186  cReadLine ReadLine;
187  while ((s = ReadLine.Read(f)) != NULL) {
188  Line++;
189  char *p = strchr(s, '#');
190  if (p)
191  *p = 0;
192  s = skipspace(stripspace(s));
193  if (!isempty(s)) {
194  p = s + strlen(s) - 1;
195  if (*p == '{') {
196  *p = 0;
197  stripspace(s);
198  cNestedItem *Item = new cNestedItem(s, true);
199  List->Add(Item);
200  if (!Parse(f, Item->SubItems(), Line))
201  return false;
202  }
203  else if (*s == '}')
204  break;
205  else
206  List->Add(new cNestedItem(s));
207  }
208  }
209  return true;
210 }
211 
212 bool cNestedItemList::Write(FILE *f, cList<cNestedItem> *List, int Indent)
213 {
214  for (cNestedItem *Item = List->First(); Item; Item = List->Next(Item)) {
215  if (Item->SubItems()) {
216  fprintf(f, "%*s%s {\n", Indent, "", Item->Text());
217  Write(f, Item->SubItems(), Indent + 2);
218  fprintf(f, "%*s}\n", Indent + 2, "");
219  }
220  else
221  fprintf(f, "%*s%s\n", Indent, "", Item->Text());
222  }
223  return true;
224 }
225 
227 {
228  free(fileName);
229  fileName = NULL;
231 }
232 
233 bool cNestedItemList::Load(const char *FileName)
234 {
236  if (FileName) {
237  free(fileName);
238  fileName = strdup(FileName);
239  }
240  bool result = false;
241  if (fileName && access(fileName, F_OK) == 0) {
242  isyslog("loading %s", fileName);
243  FILE *f = fopen(fileName, "r");
244  if (f) {
245  int Line = 0;
246  result = Parse(f, this, Line);
247  fclose(f);
248  }
249  else {
251  result = false;
252  }
253  }
254  return result;
255 }
256 
258 {
259  bool result = true;
260  cSafeFile f(fileName);
261  if (f.Open()) {
262  result = Write(f, this);
263  if (!f.Close())
264  result = false;
265  }
266  else
267  result = false;
268  return result;
269 }
270 
271 // --- Folders and Commands --------------------------------------------------
272 
277 
278 // --- cSVDRPhosts -----------------------------------------------------------
279 
281 
283 {
284  cSVDRPhost *h = First();
285  while (h) {
286  if (!h->IsLocalhost())
287  return false;
288  h = (cSVDRPhost *)h->Next();
289  }
290  return true;
291 }
292 
294 {
295  cSVDRPhost *h = First();
296  while (h) {
297  if (h->Accepts(Address))
298  return true;
299  h = (cSVDRPhost *)h->Next();
300  }
301  return false;
302 }
303 
304 // --- cSetupLine ------------------------------------------------------------
305 
307 {
308  plugin = name = value = NULL;
309 }
310 
311 cSetupLine::cSetupLine(const char *Name, const char *Value, const char *Plugin)
312 {
313  name = strreplace(strdup(Name), '\n', 0);
314  value = strreplace(strdup(Value), '\n', 0);
315  plugin = Plugin ? strreplace(strdup(Plugin), '\n', 0) : NULL;
316 }
317 
319 {
320  free(plugin);
321  free(name);
322  free(value);
323 }
324 
325 int cSetupLine::Compare(const cListObject &ListObject) const
326 {
327  const cSetupLine *sl = (cSetupLine *)&ListObject;
328  if (!plugin && !sl->plugin)
329  return strcasecmp(name, sl->name);
330  if (!plugin)
331  return -1;
332  if (!sl->plugin)
333  return 1;
334  int result = strcasecmp(plugin, sl->plugin);
335  if (result == 0)
336  result = strcasecmp(name, sl->name);
337  return result;
338 }
339 
340 bool cSetupLine::Parse(char *s)
341 {
342  char *p = strchr(s, '=');
343  if (p) {
344  *p = 0;
345  char *Name = compactspace(s);
346  char *Value = compactspace(p + 1);
347  if (*Name) { // value may be an empty string
348  p = strchr(Name, '.');
349  if (p) {
350  *p = 0;
351  char *Plugin = compactspace(Name);
352  Name = compactspace(p + 1);
353  if (!(*Plugin && *Name))
354  return false;
355  plugin = strdup(Plugin);
356  }
357  name = strdup(Name);
358  value = strdup(Value);
359  return true;
360  }
361  }
362  return false;
363 }
364 
365 bool cSetupLine::Save(FILE *f)
366 {
367  return fprintf(f, "%s%s%s = %s\n", plugin ? plugin : "", plugin ? "." : "", name, value) > 0;
368 }
369 
370 // --- cSetup ----------------------------------------------------------------
371 
373 
375 {
376  strcpy(OSDLanguage, ""); // default is taken from environment
377  strcpy(OSDSkin, "lcars");
378  strcpy(OSDTheme, "default");
379  PrimaryDVB = 1;
380  ShowInfoOnChSwitch = 1;
381  TimeoutRequChInfo = 1;
382  MenuScrollPage = 1;
383  MenuScrollWrap = 0;
384  MenuKeyCloses = 0;
385  MarkInstantRecord = 1;
386  strcpy(NameInstantRecord, "TITLE EPISODE");
388  LnbSLOF = 11700;
389  LnbFrequLo = 9750;
390  LnbFrequHi = 10600;
391  DiSEqC = 0;
392  SetSystemTime = 0;
393  TimeSource = 0;
394  TimeTransponder = 0;
396  MarginStart = 2;
397  MarginStop = 10;
398  AudioLanguages[0] = -1;
399  DisplaySubtitles = 0;
400  SupportTeletext = 1;
401  SubtitleLanguages[0] = -1;
402  SubtitleOffset = 0;
405  EPGLanguages[0] = -1;
406  EPGScanTimeout = 5;
407  EPGBugfixLevel = 3;
408  EPGLinger = 0;
409  SVDRPTimeout = 300;
410  ZapTimeout = 3;
411  ChannelEntryTimeout = 1000;
412  DefaultPriority = 50;
414  PauseKeyHandling = 2;
415  PausePriority = 10;
416  PauseLifetime = 1;
417  UseSubtitle = 1;
418  UseVps = 0;
419  VpsMargin = 120;
420  RecordingDirs = 1;
421  FoldersInTimerMenu = 1;
422  NumberKeysForChars = 1;
423  ColorKey0 = 0;
424  ColorKey1 = 1;
425  ColorKey2 = 2;
426  ColorKey3 = 3;
427  VideoDisplayFormat = 1;
428  VideoFormat = 0;
429  UpdateChannels = 5;
430  UseDolbyDigital = 1;
431  ChannelInfoPos = 0;
432  ChannelInfoTime = 5;
433  OSDLeftP = 0.03;
434  OSDTopP = 0.03;
435  OSDWidthP = 0.93;
436  OSDHeightP = 0.93;
437  OSDLeft = 54;
438  OSDTop = 45;
439  OSDWidth = 624;
440  OSDHeight = 486;
441  OSDAspect = 1.0;
442  OSDMessageTime = 1;
443  UseSmallFont = 1;
444  AntiAlias = 1;
445  strcpy(FontOsd, DefaultFontOsd);
446  strcpy(FontSml, DefaultFontSml);
447  strcpy(FontFix, DefaultFontFix);
448  FontOsdSizeP = 0.031;
449  FontSmlSizeP = 0.028;
450  FontFixSizeP = 0.030;
451  FontOsdSize = 22;
452  FontSmlSize = 18;
453  FontFixSize = 20;
456  SplitEditedFiles = 0;
457  DelTimeshiftRec = 0;
458  HardLinkCutter = 0;
459  MinEventTimeout = 30;
460  MinUserInactivity = 300;
461  NextWakeupTime = 0;
462  MultiSpeedMode = 0;
463  ShowReplayMode = 0;
464  ShowRemainingTime = 0;
465  ResumeID = 0;
466  JumpPlay = 0;
467  PlayJump = 0;
468  PauseLastMark = 0;
469  CurrentChannel = -1;
471  CurrentDolby = 0;
472  InitialChannel = "";
473  DeviceBondings = "";
474  InitialVolume = -1;
475  ChannelsWrap = 0;
477  EmergencyExit = 1;
478 }
479 
481 {
482  memcpy(&__BeginData__, &s.__BeginData__, (char *)&s.__EndData__ - (char *)&s.__BeginData__);
485  return *this;
486 }
487 
488 cSetupLine *cSetup::Get(const char *Name, const char *Plugin)
489 {
490  for (cSetupLine *l = First(); l; l = Next(l)) {
491  if ((l->Plugin() == NULL) == (Plugin == NULL)) {
492  if ((!Plugin || strcasecmp(l->Plugin(), Plugin) == 0) && strcasecmp(l->Name(), Name) == 0)
493  return l;
494  }
495  }
496  return NULL;
497 }
498 
499 void cSetup::Store(const char *Name, const char *Value, const char *Plugin, bool AllowMultiple)
500 {
501  if (Name && *Name) {
502  cSetupLine *l = Get(Name, Plugin);
503  if (l && !AllowMultiple)
504  Del(l);
505  if (Value)
506  Add(new cSetupLine(Name, Value, Plugin));
507  }
508 }
509 
510 void cSetup::Store(const char *Name, int Value, const char *Plugin)
511 {
512  Store(Name, cString::sprintf("%d", Value), Plugin);
513 }
514 
515 void cSetup::Store(const char *Name, double &Value, const char *Plugin)
516 {
517  Store(Name, cString::sprintf("%f", Value), Plugin);
518 }
519 
520 bool cSetup::Load(const char *FileName)
521 {
522  if (cConfig<cSetupLine>::Load(FileName, true)) {
523  bool result = true;
524  for (cSetupLine *l = First(); l; l = Next(l)) {
525  bool error = false;
526  if (l->Plugin()) {
527  cPlugin *p = cPluginManager::GetPlugin(l->Plugin());
528  if (p && !p->SetupParse(l->Name(), l->Value()))
529  error = true;
530  }
531  else {
532  if (!Parse(l->Name(), l->Value()))
533  error = true;
534  }
535  if (error) {
536  esyslog("ERROR: unknown config parameter: %s%s%s = %s", l->Plugin() ? l->Plugin() : "", l->Plugin() ? "." : "", l->Name(), l->Value());
537  result = false;
538  }
539  }
540  return result;
541  }
542  return false;
543 }
544 
545 void cSetup::StoreLanguages(const char *Name, int *Values)
546 {
547  char buffer[I18nLanguages()->Size() * 4];
548  char *q = buffer;
549  for (int i = 0; i < I18nLanguages()->Size(); i++) {
550  if (Values[i] < 0)
551  break;
552  const char *s = I18nLanguageCode(Values[i]);
553  if (s) {
554  if (q > buffer)
555  *q++ = ' ';
556  strncpy(q, s, 3);
557  q += 3;
558  }
559  }
560  *q = 0;
561  Store(Name, buffer);
562 }
563 
564 bool cSetup::ParseLanguages(const char *Value, int *Values)
565 {
566  int n = 0;
567  while (Value && *Value && n < I18nLanguages()->Size()) {
568  char buffer[4];
569  strn0cpy(buffer, Value, sizeof(buffer));
570  int i = I18nLanguageIndex(buffer);
571  if (i >= 0)
572  Values[n++] = i;
573  if ((Value = strchr(Value, ' ')) != NULL)
574  Value++;
575  }
576  Values[n] = -1;
577  return true;
578 }
579 
580 bool cSetup::Parse(const char *Name, const char *Value)
581 {
582  if (!strcasecmp(Name, "OSDLanguage")) { strn0cpy(OSDLanguage, Value, sizeof(OSDLanguage)); I18nSetLocale(OSDLanguage); }
583  else if (!strcasecmp(Name, "OSDSkin")) Utf8Strn0Cpy(OSDSkin, Value, MaxSkinName);
584  else if (!strcasecmp(Name, "OSDTheme")) Utf8Strn0Cpy(OSDTheme, Value, MaxThemeName);
585  else if (!strcasecmp(Name, "PrimaryDVB")) PrimaryDVB = atoi(Value);
586  else if (!strcasecmp(Name, "ShowInfoOnChSwitch")) ShowInfoOnChSwitch = atoi(Value);
587  else if (!strcasecmp(Name, "TimeoutRequChInfo")) TimeoutRequChInfo = atoi(Value);
588  else if (!strcasecmp(Name, "MenuScrollPage")) MenuScrollPage = atoi(Value);
589  else if (!strcasecmp(Name, "MenuScrollWrap")) MenuScrollWrap = atoi(Value);
590  else if (!strcasecmp(Name, "MenuKeyCloses")) MenuKeyCloses = atoi(Value);
591  else if (!strcasecmp(Name, "MarkInstantRecord")) MarkInstantRecord = atoi(Value);
592  else if (!strcasecmp(Name, "NameInstantRecord")) Utf8Strn0Cpy(NameInstantRecord, Value, MaxFileName);
593  else if (!strcasecmp(Name, "InstantRecordTime")) InstantRecordTime = atoi(Value);
594  else if (!strcasecmp(Name, "LnbSLOF")) LnbSLOF = atoi(Value);
595  else if (!strcasecmp(Name, "LnbFrequLo")) LnbFrequLo = atoi(Value);
596  else if (!strcasecmp(Name, "LnbFrequHi")) LnbFrequHi = atoi(Value);
597  else if (!strcasecmp(Name, "DiSEqC")) DiSEqC = atoi(Value);
598  else if (!strcasecmp(Name, "SetSystemTime")) SetSystemTime = atoi(Value);
599  else if (!strcasecmp(Name, "TimeSource")) TimeSource = cSource::FromString(Value);
600  else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder = atoi(Value);
601  else if (!strcasecmp(Name, "StandardCompliance")) StandardCompliance = atoi(Value);
602  else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
603  else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
604  else if (!strcasecmp(Name, "AudioLanguages")) return ParseLanguages(Value, AudioLanguages);
605  else if (!strcasecmp(Name, "DisplaySubtitles")) DisplaySubtitles = atoi(Value);
606  else if (!strcasecmp(Name, "SupportTeletext")) SupportTeletext = atoi(Value);
607  else if (!strcasecmp(Name, "SubtitleLanguages")) return ParseLanguages(Value, SubtitleLanguages);
608  else if (!strcasecmp(Name, "SubtitleOffset")) SubtitleOffset = atoi(Value);
609  else if (!strcasecmp(Name, "SubtitleFgTransparency")) SubtitleFgTransparency = atoi(Value);
610  else if (!strcasecmp(Name, "SubtitleBgTransparency")) SubtitleBgTransparency = atoi(Value);
611  else if (!strcasecmp(Name, "EPGLanguages")) return ParseLanguages(Value, EPGLanguages);
612  else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
613  else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
614  else if (!strcasecmp(Name, "EPGLinger")) EPGLinger = atoi(Value);
615  else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value);
616  else if (!strcasecmp(Name, "ZapTimeout")) ZapTimeout = atoi(Value);
617  else if (!strcasecmp(Name, "ChannelEntryTimeout")) ChannelEntryTimeout= atoi(Value);
618  else if (!strcasecmp(Name, "DefaultPriority")) DefaultPriority = atoi(Value);
619  else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value);
620  else if (!strcasecmp(Name, "PauseKeyHandling")) PauseKeyHandling = atoi(Value);
621  else if (!strcasecmp(Name, "PausePriority")) PausePriority = atoi(Value);
622  else if (!strcasecmp(Name, "PauseLifetime")) PauseLifetime = atoi(Value);
623  else if (!strcasecmp(Name, "UseSubtitle")) UseSubtitle = atoi(Value);
624  else if (!strcasecmp(Name, "UseVps")) UseVps = atoi(Value);
625  else if (!strcasecmp(Name, "VpsMargin")) VpsMargin = atoi(Value);
626  else if (!strcasecmp(Name, "RecordingDirs")) RecordingDirs = atoi(Value);
627  else if (!strcasecmp(Name, "FoldersInTimerMenu")) FoldersInTimerMenu = atoi(Value);
628  else if (!strcasecmp(Name, "NumberKeysForChars")) NumberKeysForChars = atoi(Value);
629  else if (!strcasecmp(Name, "ColorKey0")) ColorKey0 = atoi(Value);
630  else if (!strcasecmp(Name, "ColorKey1")) ColorKey1 = atoi(Value);
631  else if (!strcasecmp(Name, "ColorKey2")) ColorKey2 = atoi(Value);
632  else if (!strcasecmp(Name, "ColorKey3")) ColorKey3 = atoi(Value);
633  else if (!strcasecmp(Name, "VideoDisplayFormat")) VideoDisplayFormat = atoi(Value);
634  else if (!strcasecmp(Name, "VideoFormat")) VideoFormat = atoi(Value);
635  else if (!strcasecmp(Name, "UpdateChannels")) UpdateChannels = atoi(Value);
636  else if (!strcasecmp(Name, "UseDolbyDigital")) UseDolbyDigital = atoi(Value);
637  else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value);
638  else if (!strcasecmp(Name, "ChannelInfoTime")) ChannelInfoTime = atoi(Value);
639  else if (!strcasecmp(Name, "OSDLeftP")) OSDLeftP = atof(Value);
640  else if (!strcasecmp(Name, "OSDTopP")) OSDTopP = atof(Value);
641  else if (!strcasecmp(Name, "OSDWidthP")) { OSDWidthP = atof(Value); ChkDoublePlausibility(OSDWidthP, 0.87); }
642  else if (!strcasecmp(Name, "OSDHeightP")) { OSDHeightP = atof(Value); ChkDoublePlausibility(OSDHeightP, 0.84); }
643  else if (!strcasecmp(Name, "OSDLeft")) OSDLeft = atoi(Value);
644  else if (!strcasecmp(Name, "OSDTop")) OSDTop = atoi(Value);
645  else if (!strcasecmp(Name, "OSDWidth")) { OSDWidth = atoi(Value); OSDWidth &= ~0x07; } // OSD width must be a multiple of 8
646  else if (!strcasecmp(Name, "OSDHeight")) OSDHeight = atoi(Value);
647  else if (!strcasecmp(Name, "OSDAspect")) OSDAspect = atof(Value);
648  else if (!strcasecmp(Name, "OSDMessageTime")) OSDMessageTime = atoi(Value);
649  else if (!strcasecmp(Name, "UseSmallFont")) UseSmallFont = atoi(Value);
650  else if (!strcasecmp(Name, "AntiAlias")) AntiAlias = atoi(Value);
651  else if (!strcasecmp(Name, "FontOsd")) Utf8Strn0Cpy(FontOsd, Value, MAXFONTNAME);
652  else if (!strcasecmp(Name, "FontSml")) Utf8Strn0Cpy(FontSml, Value, MAXFONTNAME);
653  else if (!strcasecmp(Name, "FontFix")) Utf8Strn0Cpy(FontFix, Value, MAXFONTNAME);
654  else if (!strcasecmp(Name, "FontOsdSizeP")) { FontOsdSizeP = atof(Value); ChkDoublePlausibility(FontOsdSizeP, 0.038); }
655  else if (!strcasecmp(Name, "FontSmlSizeP")) { FontSmlSizeP = atof(Value); ChkDoublePlausibility(FontSmlSizeP, 0.035); }
656  else if (!strcasecmp(Name, "FontFixSizeP")) { FontFixSizeP = atof(Value); ChkDoublePlausibility(FontFixSizeP, 0.031); }
657  else if (!strcasecmp(Name, "FontOsdSize")) FontOsdSize = atoi(Value);
658  else if (!strcasecmp(Name, "FontSmlSize")) FontSmlSize = atoi(Value);
659  else if (!strcasecmp(Name, "FontFixSize")) FontFixSize = atoi(Value);
660  else if (!strcasecmp(Name, "MaxVideoFileSize")) MaxVideoFileSize = atoi(Value);
661  else if (!strcasecmp(Name, "MaxRecordingSize")) MaxRecordingSize = atoi(Value);
662  else if (!strcasecmp(Name, "SplitEditedFiles")) SplitEditedFiles = atoi(Value);
663  else if (!strcasecmp(Name, "DelTimeshiftRec")) DelTimeshiftRec = atoi(Value);
664  else if (!strcasecmp(Name, "HardLinkCutter")) HardLinkCutter = atoi(Value);
665  else if (!strcasecmp(Name, "MinEventTimeout")) MinEventTimeout = atoi(Value);
666  else if (!strcasecmp(Name, "MinUserInactivity")) MinUserInactivity = atoi(Value);
667  else if (!strcasecmp(Name, "NextWakeupTime")) NextWakeupTime = atoi(Value);
668  else if (!strcasecmp(Name, "MultiSpeedMode")) MultiSpeedMode = atoi(Value);
669  else if (!strcasecmp(Name, "ShowReplayMode")) ShowReplayMode = atoi(Value);
670  else if (!strcasecmp(Name, "ShowRemainingTime")) ShowRemainingTime = atoi(Value);
671  else if (!strcasecmp(Name, "ResumeID")) ResumeID = atoi(Value);
672  else if (!strcasecmp(Name, "JumpPlay")) JumpPlay = atoi(Value);
673  else if (!strcasecmp(Name, "PlayJump")) PlayJump = atoi(Value);
674  else if (!strcasecmp(Name, "PauseLastMark")) PauseLastMark = atoi(Value);
675  else if (!strcasecmp(Name, "CurrentChannel")) CurrentChannel = atoi(Value);
676  else if (!strcasecmp(Name, "CurrentVolume")) CurrentVolume = atoi(Value);
677  else if (!strcasecmp(Name, "CurrentDolby")) CurrentDolby = atoi(Value);
678  else if (!strcasecmp(Name, "InitialChannel")) InitialChannel = Value;
679  else if (!strcasecmp(Name, "InitialVolume")) InitialVolume = atoi(Value);
680  else if (!strcasecmp(Name, "DeviceBondings")) DeviceBondings = Value;
681  else if (!strcasecmp(Name, "ChannelsWrap")) ChannelsWrap = atoi(Value);
682  else if (!strcasecmp(Name, "ShowChannelNamesWithSource")) ShowChannelNamesWithSource = atoi(Value);
683  else if (!strcasecmp(Name, "EmergencyExit")) EmergencyExit = atoi(Value);
684  else
685  return false;
686  return true;
687 }
688 
689 bool cSetup::Save(void)
690 {
691  Store("OSDLanguage", OSDLanguage);
692  Store("OSDSkin", OSDSkin);
693  Store("OSDTheme", OSDTheme);
694  Store("PrimaryDVB", PrimaryDVB);
695  Store("ShowInfoOnChSwitch", ShowInfoOnChSwitch);
696  Store("TimeoutRequChInfo", TimeoutRequChInfo);
697  Store("MenuScrollPage", MenuScrollPage);
698  Store("MenuScrollWrap", MenuScrollWrap);
699  Store("MenuKeyCloses", MenuKeyCloses);
700  Store("MarkInstantRecord", MarkInstantRecord);
701  Store("NameInstantRecord", NameInstantRecord);
702  Store("InstantRecordTime", InstantRecordTime);
703  Store("LnbSLOF", LnbSLOF);
704  Store("LnbFrequLo", LnbFrequLo);
705  Store("LnbFrequHi", LnbFrequHi);
706  Store("DiSEqC", DiSEqC);
707  Store("SetSystemTime", SetSystemTime);
708  Store("TimeSource", cSource::ToString(TimeSource));
709  Store("TimeTransponder", TimeTransponder);
710  Store("StandardCompliance", StandardCompliance);
711  Store("MarginStart", MarginStart);
712  Store("MarginStop", MarginStop);
713  StoreLanguages("AudioLanguages", AudioLanguages);
714  Store("DisplaySubtitles", DisplaySubtitles);
715  Store("SupportTeletext", SupportTeletext);
716  StoreLanguages("SubtitleLanguages", SubtitleLanguages);
717  Store("SubtitleOffset", SubtitleOffset);
718  Store("SubtitleFgTransparency", SubtitleFgTransparency);
719  Store("SubtitleBgTransparency", SubtitleBgTransparency);
720  StoreLanguages("EPGLanguages", EPGLanguages);
721  Store("EPGScanTimeout", EPGScanTimeout);
722  Store("EPGBugfixLevel", EPGBugfixLevel);
723  Store("EPGLinger", EPGLinger);
724  Store("SVDRPTimeout", SVDRPTimeout);
725  Store("ZapTimeout", ZapTimeout);
726  Store("ChannelEntryTimeout",ChannelEntryTimeout);
727  Store("DefaultPriority", DefaultPriority);
728  Store("DefaultLifetime", DefaultLifetime);
729  Store("PauseKeyHandling", PauseKeyHandling);
730  Store("PausePriority", PausePriority);
731  Store("PauseLifetime", PauseLifetime);
732  Store("UseSubtitle", UseSubtitle);
733  Store("UseVps", UseVps);
734  Store("VpsMargin", VpsMargin);
735  Store("RecordingDirs", RecordingDirs);
736  Store("FoldersInTimerMenu", FoldersInTimerMenu);
737  Store("NumberKeysForChars", NumberKeysForChars);
738  Store("ColorKey0", ColorKey0);
739  Store("ColorKey1", ColorKey1);
740  Store("ColorKey2", ColorKey2);
741  Store("ColorKey3", ColorKey3);
742  Store("VideoDisplayFormat", VideoDisplayFormat);
743  Store("VideoFormat", VideoFormat);
744  Store("UpdateChannels", UpdateChannels);
745  Store("UseDolbyDigital", UseDolbyDigital);
746  Store("ChannelInfoPos", ChannelInfoPos);
747  Store("ChannelInfoTime", ChannelInfoTime);
748  Store("OSDLeftP", OSDLeftP);
749  Store("OSDTopP", OSDTopP);
750  Store("OSDWidthP", OSDWidthP);
751  Store("OSDHeightP", OSDHeightP);
752  Store("OSDLeft", OSDLeft);
753  Store("OSDTop", OSDTop);
754  Store("OSDWidth", OSDWidth);
755  Store("OSDHeight", OSDHeight);
756  Store("OSDAspect", OSDAspect);
757  Store("OSDMessageTime", OSDMessageTime);
758  Store("UseSmallFont", UseSmallFont);
759  Store("AntiAlias", AntiAlias);
760  Store("FontOsd", FontOsd);
761  Store("FontSml", FontSml);
762  Store("FontFix", FontFix);
763  Store("FontOsdSizeP", FontOsdSizeP);
764  Store("FontSmlSizeP", FontSmlSizeP);
765  Store("FontFixSizeP", FontFixSizeP);
766  Store("FontOsdSize", FontOsdSize);
767  Store("FontSmlSize", FontSmlSize);
768  Store("FontFixSize", FontFixSize);
769  Store("MaxVideoFileSize", MaxVideoFileSize);
770  Store("MaxRecordingSize", MaxRecordingSize);
771  Store("SplitEditedFiles", SplitEditedFiles);
772  Store("DelTimeshiftRec", DelTimeshiftRec);
773  Store("HardLinkCutter", HardLinkCutter);
774  Store("MinEventTimeout", MinEventTimeout);
775  Store("MinUserInactivity", MinUserInactivity);
776  Store("NextWakeupTime", NextWakeupTime);
777  Store("MultiSpeedMode", MultiSpeedMode);
778  Store("ShowReplayMode", ShowReplayMode);
779  Store("ShowRemainingTime", ShowRemainingTime);
780  Store("ResumeID", ResumeID);
781  Store("JumpPlay", JumpPlay);
782  Store("PlayJump", PlayJump);
783  Store("PauseLastMark", PauseLastMark);
784  Store("CurrentChannel", CurrentChannel);
785  Store("CurrentVolume", CurrentVolume);
786  Store("CurrentDolby", CurrentDolby);
787  Store("InitialChannel", InitialChannel);
788  Store("InitialVolume", InitialVolume);
789  Store("DeviceBondings", DeviceBondings);
790  Store("ChannelsWrap", ChannelsWrap);
791  Store("ShowChannelNamesWithSource", ShowChannelNamesWithSource);
792  Store("EmergencyExit", EmergencyExit);
793 
794  Sort();
795 
797  isyslog("saved setup to %s", FileName());
798  return true;
799  }
800  return false;
801 }