summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2018-02-17 15:34:01 +0100
committerhorchi <vdr@jwendel.de>2018-02-17 15:34:01 +0100
commit9408390609806ebc450e3fb19dacfd86db92b708 (patch)
tree16baf3271cebd3b374889d58312390858d02a1f8
parent4b3df4033c73b48e764d1f893f29a9d6b8883bdc (diff)
downloadvdr-plugin-epg2vdr-9408390609806ebc450e3fb19dacfd86db92b708.tar.gz
vdr-plugin-epg2vdr-9408390609806ebc450e3fb19dacfd86db92b708.tar.bz2
2018-02-17 version 1.1.86 (horchi)\n - bugfix: Fix for 1.1.85\n\n1.1.86
-rw-r--r--HISTORY.h5
-rw-r--r--epg2vdr.c43
-rw-r--r--epg2vdr.h1
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;