summaryrefslogtreecommitdiff
path: root/update.c
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2018-02-09 17:12:59 +0100
committerhorchi <vdr@jwendel.de>2018-02-09 17:12:59 +0100
commita7d8f609094cb81040c6a836a784c50429615866 (patch)
tree4fc13711a4a61bbe3cf41e0299d39112f55e26bc /update.c
parent063d587d5868356abc6550e504c5a75eb34dd772 (diff)
downloadvdr-epg-daemon-a7d8f609094cb81040c6a836a784c50429615866.tar.gz
vdr-epg-daemon-a7d8f609094cb81040c6a836a784c50429615866.tar.bz2
2018-02-09: version 1.1.129 (horchi)\n - added: Table for recording images\n\n1.1.129
Diffstat (limited to 'update.c')
-rw-r--r--update.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/update.c b/update.c
index 9eab690..78a8854 100644
--- a/update.c
+++ b/update.c
@@ -482,6 +482,12 @@ int cEpgd::initDb()
return fail;
}
+ if (lastApi <= 5)
+ {
+ if (migrateFromDbApi5() != success)
+ return fail;
+ }
+
registerMe(); // and update DB_API info at vdrs table
initial = no;
}
@@ -1162,6 +1168,54 @@ int cEpgd::migrateFromDbApi4()
return status;
}
+//***************************************************************************
+// Migrate From DB API 5
+//***************************************************************************
+
+int cEpgd::migrateFromDbApi5()
+{
+ int status = success;
+
+ recordingListDb = new cDbTable(connection, "recordinglist");
+ if ((status = recordingListDb->open()) != success) return status;
+
+ tell(0, "Migration of table '%s' from version <= 5 ...", recordingListDb->TableName());
+
+ cDbStatement* select = new cDbStatement(recordingListDb);
+ select->build("select ");
+ select->bindAllOut();
+ select->build(" from %s where %s is null", recordingListDb->TableName(),
+ recordingListDb->getField("IMGID")->getDbName());
+
+ status += select->prepare();
+
+ if (status == success)
+ {
+ md5Buf md5Id;
+
+ for (int f = select->find(); f; f = select->fetch())
+ {
+ std::string text = std::string(recordingListDb->getStrValue("TITLE"))
+ + std::string(recordingListDb->getStrValue("SHORTTEXT"));
+ createMd5(text.c_str(), md5Id);
+
+ recordingListDb->setValue("IMGID", md5Id);
+ recordingListDb->update();
+ }
+ }
+
+ tell(0, "... done");
+
+ delete select;
+ delete recordingListDb; recordingListDb = 0;
+
+ return status;
+}
+
+//***************************************************************************
+// Try Fill Empty Rec Table Fields
+//***************************************************************************
+
const char* getLine(const char* buf, const char* startChar = 0, const char* endChar = 0)
{
static char line[100+TB];