diff options
author | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2012-04-12 19:25:00 +0300 |
---|---|---|
committer | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2012-04-12 19:25:00 +0300 |
commit | c31263388a5dbdc5150595b328d50fa486b4dce5 (patch) | |
tree | 130d8ba9d3f3eb9b29d3070024e4f95ef285ed31 /config.c | |
download | vdr-plugin-epgfixer-c31263388a5dbdc5150595b328d50fa486b4dce5.tar.gz vdr-plugin-epgfixer-c31263388a5dbdc5150595b328d50fa486b4dce5.tar.bz2 |
Import version 0.0.4 to git.
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/config.c b/config.c new file mode 100644 index 0000000..2be9d26 --- /dev/null +++ b/config.c @@ -0,0 +1,66 @@ +/* + * config.c: Global configuration and user settings + * + * See the README file for copyright information and how to reach the author. + * + */ + +#include "config.h" +#include <string.h> + +/* Global instance */ +cEpgfixerSetup EpgfixerSetup; + +cEpgfixerSetup::cEpgfixerSetup() +{ + quotedshorttext = 0; + blankbeforedescription = 0; + repeatedtitle = 0; + doublequotedshorttext = 0; + removeformatting = 0; + longshorttext = 0; + equalshorttextanddescription = 0; + nobackticks = 0; + components = 0; +} + +cString cEpgfixerSetup::m_ProcessedArgs; + +bool cEpgfixerSetup::ProcessArg(const char *Name, const char *Value) +{ + if (SetupParse(Name, Value)) { + m_ProcessedArgs = cString::sprintf("%s%s ", *m_ProcessedArgs ? *m_ProcessedArgs : " ", Name); + return true; + } + return false; +} + + +bool cEpgfixerSetup::ProcessArgs(int argc, char *argv[]) +{ + return true; +} + +bool cEpgfixerSetup::SetupParse(const char *Name, const char *Value) +{ + const char *pt; + if (*m_ProcessedArgs && NULL != (pt=strstr(m_ProcessedArgs+1, Name)) && + *(pt-1) == ' ' && *(pt+strlen(Name)) == ' ') { + dsyslog("Skipping configuration entry %s=%s (overridden in command line)", Name, Value); + return true; + } + + if (!strcasecmp(Name, "RemoveQuotesFromShortText")) quotedshorttext = atoi(Value); + else if (!strcasecmp(Name, "MoveDescriptionFromShortText")) blankbeforedescription = atoi(Value); + else if (!strcasecmp(Name, "RemoveRepeatedTitleFromShortText")) repeatedtitle = atoi(Value); + else if (!strcasecmp(Name, "RemoveDoubleQuotesFromShortText")) doublequotedshorttext = atoi(Value); + else if (!strcasecmp(Name, "RemoveUselessFormatting")) removeformatting = atoi(Value); + else if (!strcasecmp(Name, "MoveLongShortTextToDescription")) longshorttext = atoi(Value); + else if (!strcasecmp(Name, "PreventEqualShortTextAndDescription")) equalshorttextanddescription = atoi(Value); + else if (!strcasecmp(Name, "ReplaceBackticksWithSingleQuotes")) nobackticks = atoi(Value); + else if (!strcasecmp(Name, "FixStreamComponentDescriptions")) components = atoi(Value); + else + return false; + + return true; +} |