summaryrefslogtreecommitdiff
path: root/config.c
blob: 1fe1016438fb26fe7848d5df9461490d87d2f3d6 (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
#include "lib/common.h"
#include "config.h"

cScraper2VdrConfig::cScraper2VdrConfig() {
    mainMenuEntry = 1;
    headless = false;
    uuid = "";
    imgDirSet = false;
    mysqlHost = "localhost";
    mysqlPort = 3306;
    mysqlDBName = "epg2vdr";
    mysqlDBUser = "epg2vdr";
    mysqlDBPass = "epg";
    recScrapInfoName = "scrapinfo";
    debug = 0;
}

cScraper2VdrConfig::~cScraper2VdrConfig() {
}

void cScraper2VdrConfig::SetUuid(cPlugin *plug) {
    if (uuid.size() == 0) {
        uuid = getUniqueId();
        plug->SetupStore("uuid", uuid.c_str());
    }
    tell(0, "epgd uuid: %s", uuid.c_str());
}

void cScraper2VdrConfig::SetImageDir(cString dir) {
    imageDir = *dir;
    imgDirSet = true;
}

void cScraper2VdrConfig::SetDefaultImageDir(void) {
    if (!imgDirSet) {
        imageDir = cPlugin::CacheDirectory(PLUGIN_NAME_I18N);
    }
    tell (0, "using image directory %s", imageDir.c_str());
}

void cScraper2VdrConfig::SetMode(string mode) {
    if (!mode.compare("headless"))
        headless = true;
}

bool cScraper2VdrConfig::SetupParse(const char *Name, const char *Value) {
    if      (strcmp(Name, "uuid") == 0)               uuid = Value;
    else if (strcmp(Name, "mainMenuEntry") == 0)      mainMenuEntry = atoi(Value);
    else if (strcmp(Name, "mysqlHost") == 0)          mysqlHost = Value;
    else if (strcmp(Name, "mysqlPort") == 0)          mysqlPort = atoi(Value);
    else if (strcmp(Name, "mysqlDBName") == 0)        mysqlDBName = Value;
    else if (strcmp(Name, "mysqlDBUser") == 0)        mysqlDBUser = Value;
    else if (strcmp(Name, "mysqlDBPass") == 0)        mysqlDBPass = Value;
    else if (strcmp(Name, "debug") == 0)              debug = atoi(Value);
    else
        return false;
    return true;
}