diff options
author | horchi <vdr@jwendel.de> | 2017-03-16 19:00:50 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2017-03-16 19:00:50 +0100 |
commit | 6ab5ecddeb666f5a01742ed63f585979096302f5 (patch) | |
tree | 3a3eb19200b3e2dfc98e494dbd1cbca2464352a0 /epg2vdr.c | |
parent | 484b744d47a901e2537edcab5f4b10bbc5e9b22e (diff) | |
download | vdr-plugin-epg2vdr-6ab5ecddeb666f5a01742ed63f585979096302f5.tar.gz vdr-plugin-epg2vdr-6ab5ecddeb666f5a01742ed63f585979096302f5.tar.bz2 |
2017-03-16: version 1.1.48 (horchi)\n - added: Further improvement of extended skins interface\n\n1.1.48
Diffstat (limited to 'epg2vdr.c')
-rw-r--r-- | epg2vdr.c | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -415,6 +415,9 @@ cPluginEPG2VDR::cPluginEPG2VDR() connection = 0; timerDb = 0; vdrDb = 0; + useeventsDb = 0; + selectTimers = 0; + selectEventById = 0; } cPluginEPG2VDR::~cPluginEPG2VDR() @@ -437,6 +440,9 @@ int cPluginEPG2VDR::initDb() vdrDb = new cDbTable(connection, "vdrs"); if (vdrDb->open() != success) return fail; + useeventsDb = new cDbTable(connection, "useevents"); + if (useeventsDb->open() != success) return fail; + // ---------- // select // t.*, @@ -466,6 +472,23 @@ int cPluginEPG2VDR::initDb() status += selectTimers->prepare(); + // select event by useid + // select * from eventsview + // where useid = ? + // and updflg in (.....) + + selectEventById = new cDbStatement(useeventsDb); + + selectEventById->build("select "); + selectEventById->bindAllOut(); + selectEventById->build(" from %s where ", useeventsDb->TableName()); + selectEventById->bind("USEID", cDBS::bndIn | cDBS::bndSet); + selectEventById->build(" and %s in (%s)", + useeventsDb->getField("UPDFLG")->getDbName(), + Us::getNeeded()); + + status += selectEventById->prepare(); + return status; } @@ -473,8 +496,13 @@ int cPluginEPG2VDR::exitDb() { if (connection) { + delete selectEventById; selectEventById = 0; + delete selectTimers; selectTimers = 0; + + delete useeventsDb; useeventsDb = 0; delete timerDb; timerDb = 0; delete vdrDb; vdrDb = 0; + delete connection; connection = 0; } @@ -831,6 +859,14 @@ bool cPluginEPG2VDR::Service(const char* id, void* data) return timerService(ts); } + else if (strcmp(id, EPG2VDR_EVENT_SERVICE) == 0) + { + cEpgEvent_Service_V1* es = (cEpgEvent_Service_V1*)data; + + if (es) + return eventService(es); + } + return false; } @@ -872,6 +908,35 @@ int cPluginEPG2VDR::timerService(cEpgTimer_Service_V1* ts) } //*************************************************************************** +// Event Service +//*************************************************************************** + +int cPluginEPG2VDR::eventService(cEpgEvent_Service_V1* es) +{ + int status = false; + + es->out = 0; + + if (!es->in) + return false; + + if ((status = initDb()) == success) + { + es->out = createEventCopy(es->in); + + useeventsDb->clear(); + useeventsDb->setValue("USEID", (int)es->in->EventID()); + + enrichEvent((cEpgEvent*)es->out, useeventsDb, selectEventById); + status = true; + } + + exitDb(); + + return status; +} + +//*************************************************************************** // Initialize //*************************************************************************** |