diff options
author | horchi <vdr@jwendel.de> | 2017-03-23 18:43:07 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2017-03-23 18:43:07 +0100 |
commit | ea3f8c5d050192b06cab9eaf70e19b544c09b8c5 (patch) | |
tree | ae50c481e279be57bf396cb35ca2167c4e71ac24 /update.c | |
parent | 4ce37758aa8e7ff1faea6aea5d19c953f89247b7 (diff) | |
download | vdr-plugin-epg2vdr-ea3f8c5d050192b06cab9eaf70e19b544c09b8c5.tar.gz vdr-plugin-epg2vdr-ea3f8c5d050192b06cab9eaf70e19b544c09b8c5.tar.bz2 |
2017-03-22 version 1.1.53 (horchi)\n - change: Removed old patches for vdr < 2.2.0\n - added: Patch to extend cEvent with aux field like cTimer\n - change: Moved user defines from Makefile to Make.config\n\n1.1.54
Diffstat (limited to 'update.c')
-rw-r--r-- | update.c | 116 |
1 files changed, 111 insertions, 5 deletions
@@ -10,11 +10,66 @@ #include <vdr/videodir.h> #include <vdr/tools.h> +#include "lib/xml.h" #include "epg2vdr.h" #include "update.h" #include "handler.h" //*************************************************************************** +// Events AUX Fields - stored as XML in cEvent:aux +//*************************************************************************** + +const char* cUpdate::auxFields[] = +{ +// field name type max size + + "imagecount", // int + "scrseriesid", // int + "scrseriesepisode", // int + "scrmovieid", // int + "numrating", // int + + "year", // ascii 10 + "category", // ascii 50 + "country", // ascii 50 + "audio", // ascii 50 + + "txtrating", // ascii 100 + "genre", // ascii 100 + "flags", // ascii 100 + "commentator", // ascii 200 + "tipp", // ascii 250 + "rating", // ascii 250 + "moderator", // ascii 250 + "music", // ascii 250 + "screenplay", // ascii 500 + "shortreview", // ascii 500 + + "guest", // text 1000 + "producer", // text 1000 + "camera", // text 1000 + "director", // text 1000 + "topic", // ascii 1000 + + "other", // text 2000 + "shortdescription", // mtext 3000 + "actor", // mtext 5000 + + "episodename", // ascii 100 + "episodeshortname", // ascii 100 + "episodepartname", // ascii 300 + "episodeextracol1", // ascii 250 + "episodeextracol2", // ascii 250 + "episodeextracol3", // ascii 250 + "episodeseason", // int + "episodepart", // int + "episodeparts", // int + "episodenumber", // int + + 0 +}; + +//*************************************************************************** // ctor //*************************************************************************** @@ -84,7 +139,9 @@ cUpdate::cUpdate(cPluginEPG2VDR* aPlugin) selectMaxUpdSp = 0; selectPendingTimerActions = 0; - dvbDescription = 0; + viewDescription = 0; + viewMergeSource = 0; + viewLongDescription = 0; // @@ -271,7 +328,9 @@ int cUpdate::initDb() // ------------------------------------------- // init db values - dvbDescription = new cDbValue("description", cDBS::ffText, 50000); + viewDescription = new cDbValue("description", cDBS::ffText, 50000); + viewMergeSource = new cDbValue("mergesource", cDBS::ffAscii, 25); + viewLongDescription = new cDbValue("longdescription", cDBS::ffText, 50000); // ------------------------------------------- // init statements @@ -403,7 +462,9 @@ int cUpdate::initDb() selectUpdEvents->bind("PARENTALRATING", cDBS::bndOut, ", "); selectUpdEvents->bind("VPS", cDBS::bndOut, ", "); selectUpdEvents->bind("CONTENTS", cDBS::bndOut, ", "); - selectUpdEvents->bind(dvbDescription, cDBS::bndOut, ", "); + selectUpdEvents->bind(viewDescription, cDBS::bndOut, ", "); + selectUpdEvents->bind(viewMergeSource, cDBS::bndOut, ", "); + selectUpdEvents->bind(viewLongDescription, cDBS::bndOut, ", "); selectUpdEvents->build(" from eventsview where "); selectUpdEvents->bind("CHANNELID", cDBS::bndIn | cDBS::bndSet); selectUpdEvents->bindCmp(0, "UPDSP", 0, ">", " and "); @@ -704,7 +765,9 @@ int cUpdate::exitDb() delete recordingDirDb; recordingDirDb = 0; delete recordingListDb; recordingListDb = 0; - delete dvbDescription; dvbDescription = 0; + delete viewDescription; viewDescription = 0; + delete viewMergeSource; viewMergeSource = 0; + delete viewLongDescription; viewLongDescription = 0; delete connection; connection = 0; @@ -1538,9 +1601,10 @@ cEvent* cUpdate::createEventFromRow(const cDbRow* row) e->SetDuration(row->getIntValue("DURATION")); e->SetParentalRating(row->getIntValue("PARENTALRATING")); e->SetVps(row->getIntValue("VPS")); - e->SetDescription(dvbDescription->getStrValue()); + e->SetDescription(viewDescription->getStrValue()); e->SetComponents(0); + // ------------ // contents uchar contents[MaxEventContents] = { 0 }; @@ -1556,6 +1620,7 @@ cEvent* cUpdate::createEventFromRow(const cDbRow* row) e->SetContents(contents); + // ------------ // components if (row->hasValue("SOURCE", "vdr")) @@ -1583,6 +1648,47 @@ cEvent* cUpdate::createEventFromRow(const cDbRow* row) delete components; } +#if (defined (APIVERSNUM) && (APIVERSNUM >= 20303)) || (WITH_AUX_PATCH) + + // ------------ + // aux + + useeventsDb->clear(); + useeventsDb->setValue("USEID", row->getIntValue("USEID")); + + if (selectEventById->find()) + { + cXml xml; + + xml.create("epg2vdr"); + + for (int i = 0; auxFields[i]; i++) + { + cDbValue* value = useeventsDb->getValue(auxFields[i]); + + if (!value || value->isEmpty()) + continue; + + if (value->getField()->hasFormat(cDBS::ffAscii) || value->getField()->hasFormat(cDBS::ffText) || value->getField()->hasFormat(cDBS::ffMText)) + xml.appendElement(auxFields[i], value->getStrValue()); + else + xml.appendElement(auxFields[i], value->getIntValue()); + } + + // finally add some fields of the view + + xml.appendElement("source", viewMergeSource->getStrValue()); + xml.appendElement("longdescription", viewLongDescription->getStrValue()); + + // set to events aux field + + e->SetAux(xml.toText()); + } + + selectEventById->freeResult(); + +#endif // WITH_AUX_PATCH + return e; } |