summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-12-24 10:27:40 +0100
committerhorchi <vdr@jwendel.de>2017-12-24 10:27:40 +0100
commit8e7b2dba8e61966445416a239c9f54a84f91730d (patch)
treeaa8280b7b8b5932753927253a3a7981fb3e89286
parentec257583c911ab914b67ccac45e935ecca65b9cd (diff)
downloadvdr-epg-daemon-1.1.125.tar.gz
vdr-epg-daemon-1.1.125.tar.bz2
2017-12-22: version 1.1.125 (horchi)\n - change: new field in 'recordinglist' to store the original description\n\n1.1.125
-rw-r--r--HISTORY.h7
-rw-r--r--configs/epg.dat2
-rw-r--r--epgd.h1
-rw-r--r--update.c117
4 files changed, 112 insertions, 15 deletions
diff --git a/HISTORY.h b/HISTORY.h
index 00fc31e..b47b128 100644
--- a/HISTORY.h
+++ b/HISTORY.h
@@ -4,9 +4,9 @@
* -----------------------------------
*/
-#define _VERSION "1.1.124"
+#define _VERSION "1.1.125"
#define VERSION_DATE "21.12.2017"
-#define DB_API 4
+#define DB_API 5
#ifdef GIT_REV
# define VERSION _VERSION "-GIT" GIT_REV
@@ -18,6 +18,9 @@
* ------------------------------------
*
+2017-12-22: version 1.1.125 (horchi)
+ - change: new field in 'recordinglist' to store the original description
+
2017-12-21: version 1.1.124 (horchi)
- change: gcc 7 porting
diff --git a/configs/epg.dat b/configs/epg.dat
index 8832bc8..1b3884d 100644
--- a/configs/epg.dat
+++ b/configs/epg.dat
@@ -502,7 +502,7 @@ Table recordinglist
TITLE "" title Ascii 200 Data,
SHORTTEXT "" shorttext Ascii 300 Data,
LONGDESCRIPTION "" longdescription MText 25000 Data,
- ORGDESCRIPTION "" orgdescription MText 25000 Data,
+ DESCRIPTION "" description MText 25000 Data,
DURATION "" duration UInt 0 Data,
FSK "" fsk UInt 1 Data,
diff --git a/epgd.h b/epgd.h
index 0e9f912..ad1d0b6 100644
--- a/epgd.h
+++ b/epgd.h
@@ -201,6 +201,7 @@ class cEpgd : public cFrame, public cSystemNotification
int initDb();
int exitDb();
+ int migrateFromDbApi4();
int checkProcedure(const char* name, cDBS::ProcType type, cDbProcedure* fp = 0);
int checkView(const char* name, const char* file);
int registerMe();
diff --git a/update.c b/update.c
index e666996..861d77b 100644
--- a/update.c
+++ b/update.c
@@ -459,9 +459,26 @@ int cEpgd::initDb()
if (initial)
{
- if (registerMe() != success)
+ if (!dbConnected())
return fail;
+ vdrDb->clear();
+ vdrDb->setValue("UUID", "epgd");
+ vdrDb->find();
+
+ int lastApi = vdrDb->getIntValue("DBAPI");
+
+ // migration some specials
+
+ if (lastApi <= 4)
+ {
+ // we have to migrate the recording description
+
+ if (migrateFromDbApi4() != success)
+ return fail;
+ }
+
+ registerMe(); // and update DB_API info at vdrs table
initial = no;
}
@@ -1054,6 +1071,87 @@ int cEpgd::exitDb()
}
//***************************************************************************
+// migrateFromDbApi4
+//***************************************************************************
+
+int startWith(const char* buf, const char* token)
+{
+ return strncmp(buf, token, strlen(token)) == 0;
+}
+
+int cEpgd::migrateFromDbApi4()
+{
+ int status = success;
+
+ recordingListDb = new cDbTable(connection, "recordinglist");
+ if ((status = recordingListDb->open()) != success) return status;
+
+ tell(0, "Migration of table '%s' from version <= 4 ...", recordingListDb->TableName());
+
+ // we have to port the longdescription ito description
+ // and create a longdescription by best guess of it :o
+
+ cDbStatement* select = new cDbStatement(recordingListDb);
+ select->build("select ");
+ select->bindAllOut();
+ select->build(" from %s where %s is null", recordingListDb->TableName(),
+ recordingListDb->getField("DESCRIPTION")->getDbName());
+
+ status += select->prepare();
+
+ if (status == success)
+ {
+ for (int f = select->find(); f; f = select->fetch())
+ {
+ const char* longDesc = recordingListDb->getStrValue("LONGDESCRIPTION");
+ recordingListDb->setValue("DESCRIPTION", longDesc);
+
+ // try patching the 'description' created by the view to likely the real original event description
+
+ const char* p = longDesc;
+
+ while (true)
+ {
+ int toSkip = startWith(p, "Kategorie: ") ||
+ startWith(p, "Genre: ") ||
+ startWith(p, "Land: ") ||
+ startWith(p, "Jahr: ") ||
+ startWith(p, "Bewertung: ") ||
+ startWith(p, "Thema: ") ||
+ startWith(p, "Serie: ") ||
+ startWith(p, "Quelle: ") ||
+ startWith(p, "Audio: ") ||
+ startWith(p, "Flags: ") ||
+ startWith(p, "Originaltitel: ") ||
+ startWith(p, "TagesTipp") ||
+ startWith(p, "Tagestipp") ||
+ startWith(p, "TopTipp") ||
+ startWith(p, "Toptipp") ||
+ startWith(p, "Tipp") ||
+ startWith(p, "[") ||
+ *p == '\n';
+
+ if (!toSkip)
+ break;
+
+ if (!(p = strchr(p, '\n')) || !*(p++))
+ break;
+ }
+
+ recordingListDb->setValue("LONGDESCRIPTION", p);
+ recordingListDb->update();
+ }
+ }
+
+ tell(0, "... done");
+
+ delete select;
+ delete recordingListDb; recordingListDb = 0;
+
+ return status;
+}
+
+//***************************************************************************
// Check Function
//***************************************************************************
@@ -1166,16 +1264,6 @@ int cEpgd::registerMe()
vdrDb->setValue("UUID", "epgd");
vdrDb->find();
- if (!vdrDb->isNull("DBAPI") &&
- vdrDb->getIntValue("DBAPI") != DB_API)
- {
- tell(0, "Fatal: Found dbapi %ld, expected %d, please alter the tables first! Aborting now.",
- vdrDb->getIntValue("DBAPI"), DB_API);
- free(v);
-
- return fail;
- }
-
vdrDb->setValue("IP", getIpOf(EpgdConfig.netDevice));
vdrDb->setValue("NAME", getHostName());
vdrDb->setValue("DBAPI", DB_API);
@@ -2445,6 +2533,8 @@ int cEpgd::cleanupSeriesAndMovies()
void cEpgd::scrapNewRecordings(int count)
{
+ int total = 0;
+
if (!tvdbManager || !movieDbManager)
return ;
@@ -2477,6 +2567,8 @@ void cEpgd::scrapNewRecordings(int count)
cSystemNotification::check();
+ total++;
+
tell(1, "-------------------------------------------------------");
tell(1, "Found new recording '%s'/'%s'", recTitle.c_str(), recSubtitle.c_str());
@@ -2614,7 +2706,8 @@ void cEpgd::scrapNewRecordings(int count)
connection->commit();
- tell(0, "SCRAP: Scraping new recordings done");
+ tell(1, "-------------------------------------------------------");
+ tell(0, "SCRAP: Scraping %d new recordings done", total);
}
//***************************************************************************