From 9408390609806ebc450e3fb19dacfd86db92b708 Mon Sep 17 00:00:00 2001 From: horchi Date: Sat, 17 Feb 2018 15:34:01 +0100 Subject: 2018-02-17 version 1.1.86 (horchi)\n - bugfix: Fix for 1.1.85\n\n --- HISTORY.h | 5 ++++- epg2vdr.c | 43 ++++++++++++++++++++++++++++++++----------- epg2vdr.h | 1 + 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/HISTORY.h b/HISTORY.h index bd56308..cbc9075 100644 --- a/HISTORY.h +++ b/HISTORY.h @@ -5,7 +5,7 @@ * */ -#define _VERSION "1.1.85" +#define _VERSION "1.1.86" #define VERSION_DATE "17.02.2018" #define DB_API 6 @@ -19,6 +19,9 @@ /* * ------------------------------------ +2018-02-17 version 1.1.86 (horchi) + - bugfix: Fix for 1.1.85 + 2018-02-17 version 1.1.85 (horchi) - added: Timer type and location to timer detail service diff --git a/epg2vdr.c b/epg2vdr.c index 612664f..654ccd3 100644 --- a/epg2vdr.c +++ b/epg2vdr.c @@ -422,6 +422,7 @@ cPluginEPG2VDR::cPluginEPG2VDR() vdrDb = 0; useeventsDb = 0; selectTimers = 0; + selectTimerByEvent = 0; selectEventById = 0; recordingListDb = 0; } @@ -485,6 +486,23 @@ int cPluginEPG2VDR::initDb() status += selectTimers->prepare(); + // select id, eventid, channelid, starttime, state, endtime + // from timers where + // eventid = ? and channelid = ? and vdruuid = ? + + selectTimerByEvent = new cDbStatement(timerDb); + + selectTimerByEvent->build("select "); + selectTimerByEvent->bindAllOut(); + selectTimerByEvent->build(" from %s where %s and (%s in ('P','R') or %s is null)", + timerDb->TableName(), + timerDb->getField("ACTIVE")->getDbName(), + timerDb->getField("STATE")->getDbName(), + timerDb->getField("STATE")->getDbName()); + selectTimerByEvent->bind("EVENTID", cDBS::bndIn | cDBS::bndSet, " and "); + + status += selectTimerByEvent->prepare(); + // select event by useid // select * from eventsview // where useid = ? @@ -511,6 +529,7 @@ int cPluginEPG2VDR::exitDb() { delete selectEventById; selectEventById = 0; delete selectTimers; selectTimers = 0; + delete selectTimerByEvent; selectTimerByEvent = 0; delete useeventsDb; useeventsDb = 0; delete timerDb; timerDb = 0; @@ -916,25 +935,25 @@ int cPluginEPG2VDR::hasTimerService(cTimer_Detail_V1* d) { cMutexLock lock(&mutexTimerService); - timerDb->clear(); - vdrDb->clear(); - d->hastimer = no; d->local = yes; d->type = ttRecord; - for (int f = selectTimers->find(); f && connection->check() == success; f = selectTimers->fetch()) + timerDb->clear(); + timerDb->setValue("EVENTID", d->eventid); + + if (selectTimerByEvent->find()) { - if (timerDb->hasValue("EVENTID", d->eventid)) - { - d->hastimer = yes; - d->local = timerDb->hasValue("VDRUUID", Epg2VdrConfig.uuid); - d->type = timerDb->getValue("TYPE")->getCharValue(); + d->hastimer = yes; + d->local = timerDb->hasValue("VDRUUID", Epg2VdrConfig.uuid); + d->type = timerDb->getValue("TYPE")->getCharValue(); - break; - } + tell(3, "timer service found '%s' timer (%ld) for event (%ld) type '%c'", + d->local ? "local" : "remote", timerDb->getIntValue("ID"), d->eventid, d->type); } + selectTimerByEvent->freeResult(); + return true; } @@ -962,6 +981,8 @@ int cPluginEPG2VDR::timerService(cEpgTimer_Service_V1* ts) delete epgTimer; } + selectTimers->freeResult(); + tell(1, "Answer '%s' call with %zd timers, duration was (%s)", EPG2VDR_TIMER_SERVICE, ts->epgTimers.size(), diff --git a/epg2vdr.h b/epg2vdr.h index 7e5de45..f97497d 100644 --- a/epg2vdr.h +++ b/epg2vdr.h @@ -76,6 +76,7 @@ class cPluginEPG2VDR : public cPlugin cDbTable* useeventsDb; cDbTable* recordingListDb; cDbStatement* selectTimers; + cDbStatement* selectTimerByEvent; cDbStatement* selectEventById; cMutex mutexTimerService; cMutex mutexServiceWithDb; -- cgit v1.2.3