summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Wieninger <cwieninger (at) gmx (dot) de>2008-03-22 13:31:47 +0100
committerChristian Wieninger <cwieninger (at) gmx (dot) de>2008-03-22 13:31:47 +0100
commit027f859c2c3ddbe3906d98599f8d1e2d18ecbe39 (patch)
treee2bd6fecaebed61ada51af1958f1609a9842a2fc
parentf4b7a6023a61c7a1300896b84c3569d985551046 (diff)
downloadvdr-plugin-epgsearch-027f859c2c3ddbe3906d98599f8d1e2d18ecbe39.tar.gz
vdr-plugin-epgsearch-027f859c2c3ddbe3906d98599f8d1e2d18ecbe39.tar.bz2
support for [epgsearchcats] in conf.d and small fixes
-rw-r--r--blacklist.c8
-rw-r--r--confdloader.h10
-rw-r--r--epgsearch.c9
-rw-r--r--epgsearchext.c2
-rw-r--r--menu_searchedit.c4
-rw-r--r--templatefile.c1
-rw-r--r--uservars.c8
-rw-r--r--uservars.h2
8 files changed, 28 insertions, 16 deletions
diff --git a/blacklist.c b/blacklist.c
index a6ae2d7..2db89a4 100644
--- a/blacklist.c
+++ b/blacklist.c
@@ -71,7 +71,7 @@ cBlacklist::cBlacklist(void)
catvalues = (char**) malloc(SearchExtCats.Count() * sizeof(char*));
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat)
{
catvalues[index] = (char*)malloc(MaxFileName);
*catvalues[index] = 0;
@@ -92,7 +92,7 @@ cBlacklist::~cBlacklist(void)
{
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat && index < (int)(sizeof(catvalues)/sizeof(char*)))
{
free(catvalues[index]);
SearchExtCat = SearchExtCats.Next(SearchExtCat);
@@ -109,7 +109,7 @@ cBlacklist& cBlacklist::operator= (const cBlacklist &Blacklist)
catvalues = (char**) malloc(SearchExtCats.Count() * sizeof(char*));
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat)
{
catvalues[index] = (char*)malloc(MaxFileName);
*catvalues[index] = 0;
@@ -141,7 +141,7 @@ void cBlacklist::CopyFromTemplate(const cSearchExt* templ)
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat)
{
strcpy(catvalues[index], templ->catvalues[index]);
SearchExtCat = SearchExtCats.Next(SearchExtCat);
diff --git a/confdloader.h b/confdloader.h
index 37eff1a..6a36324 100644
--- a/confdloader.h
+++ b/confdloader.h
@@ -24,6 +24,7 @@ The project's page is at http://winni.vdr-developer.org/epgsearch
#include "uservars.h"
#include "menu_dirselect.h"
#include "templatefile.h"
+#include "epgsearchcats.h"
class cConfDLoader {
public:
@@ -64,7 +65,14 @@ class cConfDLoader {
if (T.Parse(s))
cTemplFile::Parse(T.Name(), T.Value());
}
-
+ if (EqualsNoCase(section, "[epgsearchcats]"))
+ {
+ cSearchExtCat* cat = new cSearchExtCat;
+ if (cat && cat->Parse(s))
+ SearchExtCats.Add(cat);
+ else
+ delete cat;
+ }
}
}
}
diff --git a/epgsearch.c b/epgsearch.c
index 84fa052..f942a6f 100644
--- a/epgsearch.c
+++ b/epgsearch.c
@@ -437,6 +437,11 @@ bool cPluginEpgsearch::Start(void)
gl_timerStatusMonitor = new cTimerStatusMonitor;
SearchExtCats.Load(AddDirectory(CONFIGDIR, "epgsearchcats.conf"), true);
+
+ LoadMenuTemplates();
+ LoadUserVars();
+ LoadConfD();
+
ChannelGroups.Load(AddDirectory(CONFIGDIR, "epgsearchchangrps.conf"), true);
Blacklists.Load(AddDirectory(CONFIGDIR, "epgsearchblacklists.conf"));
SearchExts.Load(AddDirectory(CONFIGDIR, "epgsearch.conf"));
@@ -447,10 +452,6 @@ bool cPluginEpgsearch::Start(void)
DefTimerCheckModes.Load(AddDirectory(CONFIGDIR, "deftimerchkmodes.conf"));
TimersDone.Load(AddDirectory(CONFIGDIR, "timersdone.conf"));
- LoadMenuTemplates();
- LoadUserVars();
- LoadConfD();
-
cSearchTimerThread::Init(this);
cSwitchTimerThread::Init();
cConflictCheckThread::Init(this);
diff --git a/epgsearchext.c b/epgsearchext.c
index 604107c..488c76c 100644
--- a/epgsearchext.c
+++ b/epgsearchext.c
@@ -132,7 +132,7 @@ cSearchExt::~cSearchExt(void)
{
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat && index < (int)(sizeof(catvalues)/sizeof(char*)))
{
free(catvalues[index]);
SearchExtCat = SearchExtCats.Next(SearchExtCat);
diff --git a/menu_searchedit.c b/menu_searchedit.c
index d1d9bd1..4dc1009 100644
--- a/menu_searchedit.c
+++ b/menu_searchedit.c
@@ -152,7 +152,7 @@ cMenuEditSearchExt::cMenuEditSearchExt(cSearchExt *SearchExt, bool New, bool Tem
catvaluesNumeric = (int*) malloc(SearchExtCats.Count() * sizeof(int));
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat && index < (int)(sizeof(SearchExt->catvalues)/sizeof(char*)))
{
catarrayAvoidRepeats[index] = (SearchExt->catvaluesAvoidRepeat & (1<<index))?1:0;
catvaluesNumeric[index] = atol(SearchExt->catvalues[index]);
@@ -224,7 +224,7 @@ void cMenuEditSearchExt::Set()
{
cSearchExtCat *SearchExtCat = SearchExtCats.First();
int index = 0;
- while (SearchExtCat)
+ while (SearchExtCat)
{
if (SearchExtCat->searchmode >= 10)
Add(new cMenuEditIntItem(IndentMenuItem(SearchExtCat->menuname), &catvaluesNumeric[index], 0, 999999, ""));
diff --git a/templatefile.c b/templatefile.c
index a43a2da..2e63e65 100644
--- a/templatefile.c
+++ b/templatefile.c
@@ -186,6 +186,7 @@ bool cTemplFile::Parse(const char *Name, const char *Value)
cMenuTemplate* TemplOld = GetTemplateByName(Name);
if (TemplOld)
{
+ LogFile.Log(2, "menu template '%s' gets overwritten", Name);
menuTemplates.erase(TemplOld);
delete TemplOld;
}
diff --git a/uservars.c b/uservars.c
index 66abbd6..7494b5f 100644
--- a/uservars.c
+++ b/uservars.c
@@ -267,9 +267,10 @@ bool cUserVarLine::Parse(char *s)
cUserVar* userVar = new cUserVar;
if (userVar->varparser.Parse(s))
{
- cUserVar* oldVar = UserVars.GetFromName(userVar->Name());
+ cUserVar* oldVar = UserVars.GetFromName(userVar->Name(), false);
if (oldVar) // allow redefintion of existing vars
{
+ LogFile.Log(2, "variable '%s' gets overwritten", oldVar->Name());
UserVars.userVars.erase(oldVar);
delete oldVar;
}
@@ -281,7 +282,7 @@ bool cUserVarLine::Parse(char *s)
}
// cUserVars
-cUserVar* cUserVars::GetFromName(const string& varName)
+cUserVar* cUserVars::GetFromName(const string& varName, bool log)
{
string VarName = Strip(varName);
std::transform(VarName.begin(), VarName.end(), VarName.begin(), tolower);
@@ -299,7 +300,8 @@ cUserVar* cUserVars::GetFromName(const string& varName)
if (evar != extEPGVars.end())
return evar->second;
- LogFile.eSysLog("var '%s' not defined!", VarName.c_str());
+ if (log)
+ LogFile.eSysLog("var '%s' not defined!", VarName.c_str());
return NULL;
}
diff --git a/uservars.h b/uservars.h
index c16cd00..9677818 100644
--- a/uservars.h
+++ b/uservars.h
@@ -670,7 +670,7 @@ class cUserVars : public cList<cUserVar> {
delete (*uvar);
userVars.clear();
}
- cUserVar* GetFromName(const string& varName);
+ cUserVar* GetFromName(const string& varName, bool log = true);
};
extern cUserVars UserVars;