summaryrefslogtreecommitdiff
path: root/update.c
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2018-03-11 14:00:09 +0100
committerhorchi <vdr@jwendel.de>2018-03-11 14:00:09 +0100
commitcc0ddd47a78d451b445cfa7667757400c619cd5b (patch)
tree2cfadc6b53b10ceba0606a59176035af9e7b13a4 /update.c
parent69218e79181c863a92e51d0d0b8f8a31b31c66c2 (diff)
downloadvdr-epg-daemon-cc0ddd47a78d451b445cfa7667757400c619cd5b.tar.gz
vdr-epg-daemon-cc0ddd47a78d451b445cfa7667757400c619cd5b.tar.bz2
2018-03-11: version 1.1.138 (horchi)\n change: Fixed image problem with epgdata\n due to interface change by epgdata (patch by seahawk1986)\n\n1.1.138
Diffstat (limited to 'update.c')
-rw-r--r--update.c90
1 files changed, 75 insertions, 15 deletions
diff --git a/update.c b/update.c
index eb774da..5fa7b58 100644
--- a/update.c
+++ b/update.c
@@ -159,9 +159,7 @@ cEpgd::~cEpgd()
cDbConnection::exit();
- vector<PluginLoader*>::iterator it;
-
- for (it = plugins.begin(); it < plugins.end(); it++)
+ for (auto it = plugins.begin(); it < plugins.end(); it++)
delete *it;
plugins.clear();
@@ -488,6 +486,12 @@ int cEpgd::initDb()
return fail;
}
+ if (lastApi <= 6)
+ {
+ if (migrateFromDbApi6() != success)
+ return fail;
+ }
+
registerMe(); // and update DB_API info at vdrs table
initial = no;
}
@@ -1213,6 +1217,52 @@ int cEpgd::migrateFromDbApi5()
}
//***************************************************************************
+// Migrate From DB API 6
+//***************************************************************************
+
+int cEpgd::migrateFromDbApi6()
+{
+ int status = success;
+
+ imageRefDb = new cDbTable(connection, "imagerefs");
+ if ((status = imageRefDb->open()) != success) return status;
+
+ tell(0, "Migration of table '%s' from version <= 6 ...", imageRefDb->TableName());
+
+ cDbStatement* select = new cDbStatement(imageRefDb);
+
+ select->build("update %s set imagenamefs = imagename where imagenamefs is null",
+ imageRefDb->TableName());
+
+ status += select->prepare();
+
+ if (status == success)
+ select->execute();
+
+ // select->bindAllOut();
+ // select->build(" from %s where %s is null", imageRefDb->TableName(),
+ // imageRefDb->getField("IMGNAMEFS")->getDbName());
+
+ // status += select->prepare();
+
+ // if (status == success)
+ // {
+ // for (int f = select->find(); f; f = select->fetch())
+ // {
+ // imageRefDb->setValue("IMGNAMEFS", imageRefDb->getStrValue("IMGNAME"));
+ // imageRefDb->update();
+ // }
+ // }
+
+ tell(0, "... done");
+
+ delete select;
+ delete imageRefDb; imageRefDb = 0;
+
+ return status;
+}
+
+//***************************************************************************
// Try Fill Empty Rec Table Fields
//***************************************************************************
@@ -2111,6 +2161,24 @@ int cEpgd::storeImageRefs(tEventId evtId, const char* source, const char* images
imageRefDb->setValue("SOURCE", source);
imageRefDb->setValue("FILEREF", fileRef);
+ for (auto it = plugins.begin(); it < plugins.end(); it++)
+ {
+ Plugin* p = (*it)->getPlugin();
+
+ cSystemNotification::check();
+
+ if (p->ready() && p->hasSource(source))
+ {
+ char* fsName = p->fsNameOfPicture(image);
+ imageRefDb->setValue("IMGNAMEFS", fsName);
+ free(fsName);
+ break;
+ }
+ }
+
+ // strReplace(image, '/', '_');
+ // imageRefDb->setValue("IMGNAMEFS", image);
+
imageRefDb->store();
count++;
@@ -2392,9 +2460,7 @@ int cEpgd::loadFromFs(MemoryStruct* data, const char* filename, const char* subP
int cEpgd::cleanupBefore()
{
- vector<PluginLoader*>::iterator it;
-
- for (it = plugins.begin(); it < plugins.end(); it++)
+ for (auto it = plugins.begin(); it < plugins.end(); it++)
{
Plugin* p = (*it)->getPlugin();
@@ -2413,9 +2479,7 @@ int cEpgd::cleanupBefore()
int cEpgd::cleanupAfter()
{
- vector<PluginLoader*>::iterator it;
-
- for (it = plugins.begin(); it < plugins.end(); it++)
+ for (auto it = plugins.begin(); it < plugins.end(); it++)
{
Plugin* p = (*it)->getPlugin();
@@ -2435,9 +2499,7 @@ int cEpgd::cleanupAfter()
int cEpgd::getPicture(const char* source, const char* imagename,
const char* fileRef, MemoryStruct* data)
{
- vector<PluginLoader*>::iterator it;
-
- for (it = plugins.begin(); it < plugins.end(); it++)
+ for (auto it = plugins.begin(); it < plugins.end(); it++)
{
Plugin* p = (*it)->getPlugin();
@@ -2456,9 +2518,7 @@ int cEpgd::getPicture(const char* source, const char* imagename,
int cEpgd::processDay(int day, int fullupdate, Statistic* stat)
{
- vector<PluginLoader*>::iterator it;
-
- for (it = plugins.begin(); it < plugins.end(); it++)
+ for (auto it = plugins.begin(); it < plugins.end(); it++)
{
Plugin* p = (*it)->getPlugin();