summaryrefslogtreecommitdiff
path: root/config.c
blob: 2be9d2681d91914b176af33f613b9a37d398b598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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;
}