From 06469e38dc7f21a2587efc181f47fa219efa8e5f Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 4 Jan 2006 21:33:19 +0000 Subject: [PATCH] export eDVBDB to python ( for reloadServicelist and reloadBouquets ) --- lib/dvb/db.cpp | 19 +++++++++++-------- lib/dvb/db.h | 33 ++++++++++++++++++++++----------- lib/python/enigma_python.i | 2 ++ main/enigma.cpp | 6 +----- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 3920053d..ad2996f9 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -229,7 +229,7 @@ void eDVBService::setCachePID(cacheID id, int pid) DEFINE_REF(eDVBDB); /* THIS CODE IS BAD. it should be replaced by somethine better. */ -void eDVBDB::load() +void eDVBDB::reloadServicelist() { eDebug("---- opening lame channel db"); FILE *f=fopen(CONFIGDIR"/enigma2/lamedb", "rt"); @@ -239,7 +239,7 @@ void eDVBDB::load() if ( !stat("lamedb", &s) ) { rename("lamedb", CONFIGDIR"/enigma2/lamedb" ); - load(); + reloadServicelist(); } return; } @@ -406,7 +406,7 @@ void eDVBDB::load() fclose(f); } -void eDVBDB::save() +void eDVBDB::saveServicelist() { eDebug("---- saving lame channel db"); FILE *f=fopen(CONFIGDIR"/enigma2/lamedb", "w"); @@ -583,8 +583,9 @@ void eDVBDB::loadBouquet(const char *path) eDebug("%d entries in Bouquet %s", entries, bouquet_name.c_str()); } -void eDVBDB::loadBouquets() +void eDVBDB::reloadBouquets() { + m_bouquets.clear(); loadBouquet("bouquets.tv"); loadBouquet("bouquets.radio"); // create default bouquets when missing @@ -622,15 +623,17 @@ void eDVBDB::loadBouquets() } } +eDVBDB *eDVBDB::instance; + eDVBDB::eDVBDB() { - load(); - loadBouquets(); + instance = this; + reloadServicelist(); } eDVBDB::~eDVBDB() { -// save(); + instance=NULL; } RESULT eDVBDB::addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm) @@ -681,7 +684,7 @@ RESULT eDVBDB::getService(const eServiceReferenceDVB &reference, ePtr #include #include - class ServiceDescriptionSection; +#endif class eDVBDB: public iDVBChannelList { + static eDVBDB *instance; DECLARE_REF(eDVBDB); friend class eDVBDBQuery; friend class eDVBDBBouquetQuery; friend class eDVBDBSatellitesQuery; friend class eDVBDBProvidersQuery; -private: + + struct channel { ePtr m_frontendParameters; @@ -25,16 +28,13 @@ private: std::map > m_services; std::map m_bouquets; -public: - void load(); - void save(); - - void loadBouquet(const char *path); - void loadBouquets(); - +#ifdef SWIG eDVBDB(); - virtual ~eDVBDB(); - + ~eDVBDB(); +#endif +public: +#ifndef SWIG +// iDVBChannelList RESULT addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm); RESULT removeChannel(const eDVBChannelID &id); @@ -47,8 +47,18 @@ public: RESULT startQuery(ePtr &query, eDVBChannelQuery *query, const eServiceReference &source); RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet); +////// + void saveServicelist(); + void loadBouquet(const char *path); + eDVBDB(); + virtual ~eDVBDB(); +#endif + static eDVBDB *getInstance() { return instance; } + void reloadServicelist(); + void reloadBouquets(); }; +#ifndef SWIG // we have to add a possibility to invalidate here. class eDVBDBQueryBase: public iDVBChannelListQuery { @@ -100,5 +110,6 @@ class eDVBDBProvidersQuery: public eDVBDBListQuery public: eDVBDBProvidersQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query); }; +#endif // SWIG #endif diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 8d18e416..54a5bcf3 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -68,6 +68,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include #include #include #include @@ -175,6 +176,7 @@ typedef long time_t; %include %include %include +%include /************** eptr **************/ %template(eActionMapPtr) ePtr; diff --git a/main/enigma.cpp b/main/enigma.cpp index b6c57304..2003a452 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -128,15 +128,11 @@ public: m_locale_time_handler = new eDVBLocalTimeHandler(); m_epgcache = new eEPGCache(); m_mgr->setChannelList(m_dvbdb); - -// m_scan = new eComponentScan(); -// m_scan->start(); - } ~eMain() { - m_dvbdb->save(); + m_dvbdb->saveServicelist(); m_scan = 0; } }; -- 2.30.2