From 01d8689f9260fb063de7712681b243fb48ef513a Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Thu, 28 Feb 2008 20:29:47 +0100 Subject: changes for new service interface version in epgsearch --- epgsearch/services.h | 39 +++++++++++++++++++++++++++++++++++++-- timerconflict.cpp | 23 +++++++++++++++-------- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/epgsearch/services.h b/epgsearch/services.h index 62bf696..91b1d5b 100644 --- a/epgsearch/services.h +++ b/epgsearch/services.h @@ -1,3 +1,26 @@ +/* +Copyright (C) 2004-2007 Christian Wieninger + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + +The author can be reached at cwieninger@gmx.de + +The project's page is at http://winni.vdr-developer.org/epgsearch +*/ + #ifndef EPGSEARCHSERVICES_INC #define EPGSEARCHSERVICES_INC @@ -129,16 +152,28 @@ class cServiceHandler virtual std::string ReadSetupValue(const std::string& entry) = 0; // Write a setup value virtual bool WriteSetupValue(const std::string& entry, const std::string& value) = 0; +}; + +struct Epgsearch_services_v1_0 +{ +// in/out + std::auto_ptr handler; +}; + +// Data structures for service "Epgsearch-services-v1.0" +class cServiceHandler_v1_1 : public cServiceHandler +{ + public: // Get timer conflicts virtual std::list TimerConflictList(bool relOnly=false) = 0; // Check if a conflict check is advised virtual bool IsConflictCheckAdvised() = 0; }; -struct Epgsearch_services_v1_0 +struct Epgsearch_services_v1_1 { // in/out - std::auto_ptr handler; + std::auto_ptr handler; }; #endif diff --git a/timerconflict.cpp b/timerconflict.cpp index 4943d54..99005d4 100644 --- a/timerconflict.cpp +++ b/timerconflict.cpp @@ -17,7 +17,7 @@ namespace vdrlive { using namespace std; - static char ServiceInterface[] = "Epgsearch-services-v1.0"; + static char ServiceInterface[] = "Epgsearch-services-v1.1"; bool operator<( TimerConflict const& left, TimerConflict const& right ) { @@ -68,21 +68,28 @@ namespace vdrlive { TimerConflicts::TimerConflicts() { - Epgsearch_services_v1_0 service; + Epgsearch_services_v1_1 service; if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) throw HtmlError( tr("EPGSearch version outdated! Please update.") ); - - list< string > conflicts = service.handler->TimerConflictList(); - m_conflicts.assign( conflicts.begin(), conflicts.end() ); - m_conflicts.sort(); + cServiceHandler_v1_1* handler = dynamic_cast(service.handler.get()); + if (handler) + { + list< string > conflicts = service.handler->TimerConflictList(); + m_conflicts.assign( conflicts.begin(), conflicts.end() ); + m_conflicts.sort(); + } } bool TimerConflicts::CheckAdvised() { - Epgsearch_services_v1_0 service; + Epgsearch_services_v1_1 service; if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) throw HtmlError( tr("EPGSearch version outdated! Please update.") ); - return service.handler->IsConflictCheckAdvised(); + cServiceHandler_v1_1* handler = dynamic_cast(service.handler.get()); + if (!handler) + return false; + else + return handler->IsConflictCheckAdvised(); } TimerConflictNotifier::TimerConflictNotifier() -- cgit v1.2.3 From ae21d7d32eff88f3384887ebcd8341039681b223 Mon Sep 17 00:00:00 2001 From: Christian Wieninger Date: Thu, 28 Feb 2008 22:47:08 +0100 Subject: removed throw in timer conflict check if epgsearch is too old --- timerconflict.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/timerconflict.cpp b/timerconflict.cpp index 99005d4..01f473a 100644 --- a/timerconflict.cpp +++ b/timerconflict.cpp @@ -69,27 +69,31 @@ namespace vdrlive { TimerConflicts::TimerConflicts() { Epgsearch_services_v1_1 service; - if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) - throw HtmlError( tr("EPGSearch version outdated! Please update.") ); - cServiceHandler_v1_1* handler = dynamic_cast(service.handler.get()); - if (handler) + if ( CheckEpgsearchVersion() && cPluginManager::CallFirstService(ServiceInterface, &service)) { - list< string > conflicts = service.handler->TimerConflictList(); - m_conflicts.assign( conflicts.begin(), conflicts.end() ); - m_conflicts.sort(); + cServiceHandler_v1_1* handler = dynamic_cast(service.handler.get()); + if (handler) + { + list< string > conflicts = service.handler->TimerConflictList(); + m_conflicts.assign( conflicts.begin(), conflicts.end() ); + m_conflicts.sort(); + } } } bool TimerConflicts::CheckAdvised() { Epgsearch_services_v1_1 service; - if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) - throw HtmlError( tr("EPGSearch version outdated! Please update.") ); - cServiceHandler_v1_1* handler = dynamic_cast(service.handler.get()); - if (!handler) + if (CheckEpgsearchVersion() && cPluginManager::CallFirstService(ServiceInterface, &service)) + { + cServiceHandler_v1_1* handler = dynamic_cast(service.handler.get()); + if (!handler) + return false; + else + return handler->IsConflictCheckAdvised(); + } + else return false; - else - return handler->IsConflictCheckAdvised(); } TimerConflictNotifier::TimerConflictNotifier() -- cgit v1.2.3