24#define ChkDoublePlausibility(Variable, Default) { if (Variable < 0.00001) Variable = Default; }
37 const char *p = strchr(s,
'/');
40 int m = strtoul(p + 1, &error, 10);
41 if (error && *error && !isspace(*error) || m > 32)
51 int result = inet_aton(s, &
addr);
54 return result != 0 && (
mask != 0 ||
addr.s_addr == 0);
59 return addr.s_addr == htonl(INADDR_LOOPBACK);
87 int n = strtol(p, &t, 10);
92 esyslog(
"ERROR: too many sat cable numbers in '%s'", s);
97 esyslog(
"ERROR: invalid sat cable number in '%s'", s);
102 for ( ; i <
size; i++)
110 for (
int i = 0; i <
size; i++) {
118 if (0 <= DeviceIndex && DeviceIndex <
size) {
119 if (
int CableNr =
array[DeviceIndex]) {
120 for (
int i = 0; i <
size; i++) {
121 if (i < DeviceIndex &&
array[i] == CableNr)
188 while ((s = ReadLine.
Read(f)) != NULL) {
190 char *p = strchr(s,
'#');
195 p = s + strlen(s) - 1;
216 if (Item->SubItems()) {
217 fprintf(f,
"%*s%s {\n", Indent,
"", Item->Text());
218 Write(f, Item->SubItems(), Indent + 2);
219 fprintf(f,
"%*s}\n", Indent + 2,
"");
222 fprintf(f,
"%*s%s\n", Indent,
"", Item->Text());
247 result =
Parse(f,
this, Line);
263 result =
Write(f,
this);
336 result = strcasecmp(
name, sl->
name);
342 char *p = strchr(s,
'=');
348 p = strchr(
Name,
'.');
515 if ((l->Plugin() == NULL) == (Plugin == NULL)) {
516 if ((!Plugin || strcasecmp(l->Plugin(), Plugin) == 0) && strcasecmp(l->Name(), Name) == 0)
523void cSetup::Store(
const char *Name,
const char *Value,
const char *Plugin,
bool AllowMultiple)
527 if (l && !AllowMultiple)
552 if (p && !p->
SetupParse(l->Name(), l->Value()))
556 if (!
Parse(l->Name(), l->Value()))
560 esyslog(
"ERROR: unknown config parameter: %s%s%s = %s", l->Plugin() ? l->Plugin() :
"", l->Plugin() ?
"." :
"", l->Name(), l->Value());
593 strn0cpy(buffer, Value,
sizeof(buffer));
597 if ((Value = strchr(Value,
' ')) != NULL)
609 else if (!strcasecmp(Name,
"PrimaryDVB"))
PrimaryDVB = atoi(Value);
611 else if (!strcasecmp(Name,
"TimeoutRequChInfo"))
TimeoutRequChInfo = atoi(Value);
612 else if (!strcasecmp(Name,
"MenuScrollPage"))
MenuScrollPage = atoi(Value);
613 else if (!strcasecmp(Name,
"MenuScrollWrap"))
MenuScrollWrap = atoi(Value);
614 else if (!strcasecmp(Name,
"MenuKeyCloses"))
MenuKeyCloses = atoi(Value);
615 else if (!strcasecmp(Name,
"MarkInstantRecord"))
MarkInstantRecord = atoi(Value);
617 else if (!strcasecmp(Name,
"InstantRecordTime"))
InstantRecordTime = atoi(Value);
618 else if (!strcasecmp(Name,
"LnbSLOF"))
LnbSLOF = atoi(Value);
619 else if (!strcasecmp(Name,
"LnbFrequLo"))
LnbFrequLo = atoi(Value);
620 else if (!strcasecmp(Name,
"LnbFrequHi"))
LnbFrequHi = atoi(Value);
621 else if (!strcasecmp(Name,
"DiSEqC"))
DiSEqC = atoi(Value);
622 else if (!strcasecmp(Name,
"UsePositioner"))
UsePositioner = atoi(Value);
623 else if (!strcasecmp(Name,
"SiteLat"))
SiteLat = atoi(Value);
624 else if (!strcasecmp(Name,
"SiteLon"))
SiteLon = atoi(Value);
625 else if (!strcasecmp(Name,
"PositionerSpeed"))
PositionerSpeed = atoi(Value);
626 else if (!strcasecmp(Name,
"PositionerSwing"))
PositionerSwing = atoi(Value);
627 else if (!strcasecmp(Name,
"PositionerLastLon"))
PositionerLastLon = atoi(Value);
628 else if (!strcasecmp(Name,
"SetSystemTime"))
SetSystemTime = atoi(Value);
630 else if (!strcasecmp(Name,
"TimeTransponder"))
TimeTransponder = atoi(Value);
632 else if (!strcasecmp(Name,
"MarginStart"))
MarginStart = atoi(Value);
633 else if (!strcasecmp(Name,
"MarginStop"))
MarginStop = atoi(Value);
635 else if (!strcasecmp(Name,
"DisplaySubtitles"))
DisplaySubtitles = atoi(Value);
637 else if (!strcasecmp(Name,
"SubtitleOffset"))
SubtitleOffset = atoi(Value);
641 else if (!strcasecmp(Name,
"EPGScanTimeout"))
EPGScanTimeout = atoi(Value);
642 else if (!strcasecmp(Name,
"EPGScanMaxChannel"))
EPGScanMaxChannel = atoi(Value);
643 else if (!strcasecmp(Name,
"EPGPauseAfterScan"))
EPGPauseAfterScan = atoi(Value);
644 else if (!strcasecmp(Name,
"EPGBugfixLevel"))
EPGBugfixLevel = atoi(Value);
645 else if (!strcasecmp(Name,
"EPGLinger"))
EPGLinger = atoi(Value);
646 else if (!strcasecmp(Name,
"SVDRPTimeout"))
SVDRPTimeout = atoi(Value);
647 else if (!strcasecmp(Name,
"SVDRPPeering"))
SVDRPPeering = atoi(Value);
650 else if (!strcasecmp(Name,
"ZapTimeout"))
ZapTimeout = atoi(Value);
652 else if (!strcasecmp(Name,
"RcRepeatDelay"))
RcRepeatDelay = atoi(Value);
653 else if (!strcasecmp(Name,
"RcRepeatDelta"))
RcRepeatDelta = atoi(Value);
654 else if (!strcasecmp(Name,
"DefaultPriority"))
DefaultPriority = atoi(Value);
655 else if (!strcasecmp(Name,
"DefaultLifetime"))
DefaultLifetime = atoi(Value);
656 else if (!strcasecmp(Name,
"RecordKeyHandling"))
RecordKeyHandling = atoi(Value);
657 else if (!strcasecmp(Name,
"PauseKeyHandling"))
PauseKeyHandling = atoi(Value);
658 else if (!strcasecmp(Name,
"PausePriority"))
PausePriority = atoi(Value);
659 else if (!strcasecmp(Name,
"PauseLifetime"))
PauseLifetime = atoi(Value);
660 else if (!strcasecmp(Name,
"UseSubtitle"))
UseSubtitle = atoi(Value);
661 else if (!strcasecmp(Name,
"UseVps"))
UseVps = atoi(Value);
662 else if (!strcasecmp(Name,
"VpsMargin"))
VpsMargin = atoi(Value);
663 else if (!strcasecmp(Name,
"RecordingDirs"))
RecordingDirs = atoi(Value);
669 else if (!strcasecmp(Name,
"ColorKey0"))
ColorKey0 = atoi(Value);
670 else if (!strcasecmp(Name,
"ColorKey1"))
ColorKey1 = atoi(Value);
671 else if (!strcasecmp(Name,
"ColorKey2"))
ColorKey2 = atoi(Value);
672 else if (!strcasecmp(Name,
"ColorKey3"))
ColorKey3 = atoi(Value);
674 else if (!strcasecmp(Name,
"VideoFormat"))
VideoFormat = atoi(Value);
675 else if (!strcasecmp(Name,
"UpdateChannels"))
UpdateChannels = atoi(Value);
676 else if (!strcasecmp(Name,
"UseDolbyDigital"))
UseDolbyDigital = atoi(Value);
677 else if (!strcasecmp(Name,
"ChannelInfoPos"))
ChannelInfoPos = atoi(Value);
678 else if (!strcasecmp(Name,
"ChannelInfoTime"))
ChannelInfoTime = atoi(Value);
679 else if (!strcasecmp(Name,
"OSDLeftP"))
OSDLeftP =
atod(Value);
680 else if (!strcasecmp(Name,
"OSDTopP"))
OSDTopP =
atod(Value);
683 else if (!strcasecmp(Name,
"OSDLeft"))
OSDLeft = atoi(Value);
684 else if (!strcasecmp(Name,
"OSDTop"))
OSDTop = atoi(Value);
685 else if (!strcasecmp(Name,
"OSDWidth")) {
OSDWidth = atoi(Value);
OSDWidth &= ~0x07; }
686 else if (!strcasecmp(Name,
"OSDHeight"))
OSDHeight = atoi(Value);
687 else if (!strcasecmp(Name,
"OSDAspect"))
OSDAspect =
atod(Value);
688 else if (!strcasecmp(Name,
"OSDMessageTime"))
OSDMessageTime = atoi(Value);
689 else if (!strcasecmp(Name,
"UseSmallFont"))
UseSmallFont = atoi(Value);
690 else if (!strcasecmp(Name,
"AntiAlias"))
AntiAlias = atoi(Value);
697 else if (!strcasecmp(Name,
"FontOsdSize"))
FontOsdSize = atoi(Value);
698 else if (!strcasecmp(Name,
"FontSmlSize"))
FontSmlSize = atoi(Value);
699 else if (!strcasecmp(Name,
"FontFixSize"))
FontFixSize = atoi(Value);
700 else if (!strcasecmp(Name,
"MaxVideoFileSize"))
MaxVideoFileSize = atoi(Value);
701 else if (!strcasecmp(Name,
"SplitEditedFiles"))
SplitEditedFiles = atoi(Value);
702 else if (!strcasecmp(Name,
"DelTimeshiftRec"))
DelTimeshiftRec = atoi(Value);
703 else if (!strcasecmp(Name,
"MinEventTimeout"))
MinEventTimeout = atoi(Value);
704 else if (!strcasecmp(Name,
"MinUserInactivity"))
MinUserInactivity = atoi(Value);
705 else if (!strcasecmp(Name,
"NextWakeupTime"))
NextWakeupTime = atoi(Value);
706 else if (!strcasecmp(Name,
"MultiSpeedMode"))
MultiSpeedMode = atoi(Value);
707 else if (!strcasecmp(Name,
"ShowReplayMode"))
ShowReplayMode = atoi(Value);
708 else if (!strcasecmp(Name,
"ShowRemainingTime"))
ShowRemainingTime = atoi(Value);
710 else if (!strcasecmp(Name,
"PauseOnMarkSet"))
PauseOnMarkSet = atoi(Value);
711 else if (!strcasecmp(Name,
"PauseOnMarkJump"))
PauseOnMarkJump = atoi(Value);
712 else if (!strcasecmp(Name,
"SkipEdited"))
SkipEdited = atoi(Value);
713 else if (!strcasecmp(Name,
"PauseAtLastMark"))
PauseAtLastMark = atoi(Value);
718 else if (!strcasecmp(Name,
"SkipSeconds"))
SkipSeconds = atoi(Value);
719 else if (!strcasecmp(Name,
"SkipSecondsRepeat"))
SkipSecondsRepeat = atoi(Value);
720 else if (!strcasecmp(Name,
"ResumeID"))
ResumeID = atoi(Value);
721 else if (!strcasecmp(Name,
"CurrentChannel"))
CurrentChannel = atoi(Value);
722 else if (!strcasecmp(Name,
"CurrentVolume"))
CurrentVolume = atoi(Value);
723 else if (!strcasecmp(Name,
"CurrentDolby"))
CurrentDolby = atoi(Value);
724 else if (!strcasecmp(Name,
"InitialChannel"))
InitialChannel = Value;
725 else if (!strcasecmp(Name,
"VolumeSteps"))
VolumeSteps = atoi(Value);
726 else if (!strcasecmp(Name,
"VolumeLinearize"))
VolumeLinearize = atoi(Value);
727 else if (!strcasecmp(Name,
"InitialVolume"))
InitialVolume = atoi(Value);
728 else if (!strcasecmp(Name,
"DeviceBondings"))
DeviceBondings = Value;
729 else if (!strcasecmp(Name,
"ChannelsWrap"))
ChannelsWrap = atoi(Value);
731 else if (!strcasecmp(Name,
"EmergencyExit"))
EmergencyExit = atoi(Value);
const char * FileName(void)
bool Load(const char *FileName=NULL, bool AllowComments=false, bool MustExist=false)
void Del(cListObject *Object, bool DeleteObject=true)
void Add(cListObject *Object, cListObject *After=NULL)
cListObject(const cListObject &ListObject)
cListObject * Next(void) const
const cSVDRPhost * First(void) const
cList(const char *NeedsLocking=NULL)
const cSetupLine * Next(const cSetupLine *Object) const
bool Write(FILE *f, cList< cNestedItem > *List, int Indent=0)
virtual ~cNestedItemList() override
bool Parse(FILE *f, cList< cNestedItem > *List, int &Line)
bool Load(const char *FileName)
void SetText(const char *Text)
void AddSubItem(cNestedItem *Item)
void SetSubItems(bool On)
virtual int Compare(const cListObject &ListObject) const override
Must return 0 if this object is equal to ListObject, a positive value if it is "greater",...
virtual ~cNestedItem() override
cNestedItem(const char *Text, bool WithSubItems=false)
cList< cNestedItem > * SubItems(void)
cList< cNestedItem > * subItems
const char * Text(void) const
static cPlugin * GetPlugin(int Index)
virtual bool SetupParse(const char *Name, const char *Value)
static void SetRecording(const char *FileName)
static const char * LastReplayed(void)
bool Parse(const char *s)
bool Accepts(in_addr_t Address)
bool Acceptable(in_addr_t Address)
cSatCableNumbers(int Size, const char *s=NULL)
bool FromString(const char *s)
int FirstDeviceIndex(int DeviceIndex) const
Returns the first device index (starting at 0) that uses the same sat cable number as the device with...
virtual int Compare(const cListObject &ListObject) const override
Must return 0 if this object is equal to ListObject, a positive value if it is "greater",...
virtual ~cSetupLine() override
const char * Plugin(void)
int SubtitleFgTransparency
char SVDRPDefaultHost[HOST_NAME_MAX]
char OSDTheme[MaxThemeName]
int SubtitleLanguages[I18N_MAX_LANGUAGES+1]
int EPGLanguages[I18N_MAX_LANGUAGES+1]
char OSDSkin[MaxSkinName]
int AlwaysSortFoldersFirst
char OSDLanguage[I18N_MAX_LOCALE_LEN]
int ShowChannelNamesWithSource
cSetup & operator=(const cSetup &s)
bool Parse(const char *Name, const char *Value)
bool Load(const char *FileName)
cSetupLine * Get(const char *Name, const char *Plugin=NULL)
int SubtitleBgTransparency
int AdaptiveSkipAlternate
void StoreLanguages(const char *Name, int *Values)
bool ParseLanguages(const char *Value, int *Values)
int AudioLanguages[I18N_MAX_LANGUAGES+1]
char NameInstantRecord[NAME_MAX+1]
char FontOsd[MAXFONTNAME]
void Store(const char *Name, const char *Value, const char *Plugin=NULL, bool AllowMultiple=false)
char FontSml[MAXFONTNAME]
char FontFix[MAXFONTNAME]
char SVDRPHostName[HOST_NAME_MAX]
static int FromString(const char *s)
static cString ToString(int Code)
static cString sprintf(const char *fmt,...) __attribute__((format(printf
#define ChkDoublePlausibility(Variable, Default)
cNestedItemList RecordingCommands
#define TIMERMACRO_EPISODE
const char * DefaultFontOsd
const char * DefaultFontSml
const char * DefaultFontFix
const cStringList * I18nLanguages(void)
Returns the list of available languages.
int I18nLanguageIndex(const char *Code)
Returns the index of the language with the given three letter language Code.
void I18nSetLocale(const char *Locale)
Sets the current locale to Locale.
const char * I18nLanguageCode(int Language)
Returns the three letter language code of the given Language (which is an index as returned by I18nCu...
#define MAXVIDEOFILESIZEDEFAULT