vdr-plugin-scraper2vdr/config.c

59 lines
1.7 KiB
C
Raw Normal View History

2014-04-12 17:10:43 +02:00
#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";
2014-04-27 12:39:56 +02:00
debug = 0;
2014-04-12 17:10:43 +02:00
}
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;
2014-04-27 12:39:56 +02:00
else if (strcmp(Name, "debug") == 0) debug = atoi(Value);
2014-04-12 17:10:43 +02:00
else
return false;
return true;
}