From d4aab613d5efd6ee2c85c8c60ee1f97848057049 Mon Sep 17 00:00:00 2001 From: horchi Date: Sat, 27 Jan 2018 16:45:29 +0100 Subject: 2018-01-27 version 1.1.80 (horchi)\n - added: Service to check if event has a timer\n\n --- HISTORY.h | 7 +++++-- epg2vdr.c | 34 +++++++++++++++++++++++++++++++++- epg2vdr.h | 1 + service.h | 11 +++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/HISTORY.h b/HISTORY.h index cd79cf0..fedb0f7 100644 --- a/HISTORY.h +++ b/HISTORY.h @@ -5,8 +5,8 @@ * */ -#define _VERSION "1.1.79" -#define VERSION_DATE "24.01.2018" +#define _VERSION "1.1.80" +#define VERSION_DATE "27.01.2018" #define DB_API 5 @@ -19,6 +19,9 @@ /* * ------------------------------------ +2018-01-27 version 1.1.80 (horchi) + - added: Service to check if event has a timer + 2018-01-24 version 1.1.79 (horchi) - change: minor changes, fixes and code cleanup diff --git a/epg2vdr.c b/epg2vdr.c index 96ea846..f56ccb3 100644 --- a/epg2vdr.c +++ b/epg2vdr.c @@ -869,7 +869,7 @@ bool cPluginEPG2VDR::Service(const char* id, void* data) return true; } - if (strcmp(id, EPG2VDR_TIMER_SERVICE) == 0 || strcmp(id, EPG2VDR_REC_DETAIL_SERVICE) == 0) + if (strcmp(id, EPG2VDR_TIMER_SERVICE) == 0 || strcmp(id, EPG2VDR_REC_DETAIL_SERVICE) == 0 || strcmp(id, EPG2VDR_HAS_TIMER) == 0) { // Services with direct db access @@ -884,6 +884,13 @@ bool cPluginEPG2VDR::Service(const char* id, void* data) if (ts) return timerService(ts); } + if (strcmp(id, EPG2VDR_HAS_TIMER) == 0) + { + cHas_Timer_V1* d = (cHas_Timer_V1*)data; + + if (d) + return hasTimerService(d); + } else if (strcmp(id, EPG2VDR_REC_DETAIL_SERVICE) == 0) { cEpgRecording_Details_Service_V1* rd = (cEpgRecording_Details_Service_V1*)data; @@ -899,6 +906,31 @@ bool cPluginEPG2VDR::Service(const char* id, void* data) return false; } +//*************************************************************************** +// Has Timer Service +//*************************************************************************** + +int cPluginEPG2VDR::hasTimerService(cHas_Timer_V1* d) +{ + cMutexLock lock(&mutexTimerService); + + timerDb->clear(); + vdrDb->clear(); + + d->hastimer = no; + + for (int f = selectTimers->find(); f && connection->check() == success; f = selectTimers->fetch()) + { + if (timerDb->hasValue("EVENTID", d->eventid)) + { + d->hastimer = yes; + break; + } + } + + return true; +} + //*************************************************************************** // Timer Service //*************************************************************************** diff --git a/epg2vdr.h b/epg2vdr.h index a34376a..26ab2bd 100644 --- a/epg2vdr.h +++ b/epg2vdr.h @@ -64,6 +64,7 @@ class cPluginEPG2VDR : public cPlugin int exitDb(); int timerService(cEpgTimer_Service_V1* ts); + int hasTimerService(cHas_Timer_V1* d); int recordingDetails(cEpgRecording_Details_Service_V1* rd); private: diff --git a/service.h b/service.h index ffe4072..729f559 100644 --- a/service.h +++ b/service.h @@ -66,6 +66,16 @@ struct cEpgTimer_Service_V1 std::list epgTimers; }; +//*************************************************************************** +// Has Timer +//*************************************************************************** + +struct cHas_Timer_V1 +{ + long eventid; + int hastimer; +}; + //*************************************************************************** // Recording Detail Service Interface //*************************************************************************** @@ -78,6 +88,7 @@ struct cEpgRecording_Details_Service_V1 #define EPG2VDR_TIMER_UPDATED "Epg2Vdr_Timer_Updated-v1.0" #define EPG2VDR_TIMER_SERVICE "Epg2Vdr_Timer_Service-v1.0" +#define EPG2VDR_HAS_TIMER "Epg2Vdr_Has_Timer_Service-v1.0" #define EPG2VDR_REC_DETAIL_SERVICE "Epg2Vdr_RecDetail_Service-v1.0" #ifdef EPG2VDR -- cgit v1.2.3