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");
if ( !stat("lamedb", &s) )
{
rename("lamedb", CONFIGDIR"/enigma2/lamedb" );
- load();
+ reloadServicelist();
}
return;
}
fclose(f);
}
-void eDVBDB::save()
+void eDVBDB::saveServicelist()
{
eDebug("---- saving lame channel db");
FILE *f=fopen(CONFIGDIR"/enigma2/lamedb", "w");
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
}
}
+eDVBDB *eDVBDB::instance;
+
eDVBDB::eDVBDB()
{
- load();
- loadBouquets();
+ instance = this;
+ reloadServicelist();
}
eDVBDB::~eDVBDB()
{
-// save();
+ instance=NULL;
}
RESULT eDVBDB::addChannelToList(const eDVBChannelID &id, iDVBFrontendParameters *feparm)
RESULT eDVBDB::flush()
{
- save();
+ saveServicelist();
return 0;
}
#ifndef __db_h
#define __db_h
+#ifndef SWIG
#include <lib/base/eptrlist.h>
#include <lib/dvb/idvb.h>
#include <set>
-
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<iDVBFrontendParameters> m_frontendParameters;
std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_services;
std::map<std::string, eBouquet> 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);
RESULT startQuery(ePtr<iDVBChannelListQuery> &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
{
public:
eDVBDBProvidersQuery(eDVBDB *db, const eServiceReference &source, eDVBChannelQuery *query);
};
+#endif // SWIG
#endif
#include <lib/actions/action.h>
#include <lib/gdi/gfont.h>
#include <lib/gdi/epng.h>
+#include <lib/dvb/db.h>
#include <lib/dvb/volume.h>
#include <lib/dvb/sec.h>
#include <lib/dvb/epgcache.h>
%include <lib/driver/etimezone.h>
%include <lib/gdi/lcd.h>
%include <lib/dvb_ci/dvbci_ui.h>
+%include <lib/dvb/db.h>
/************** eptr **************/
%template(eActionMapPtr) ePtr<eActionMap>;
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;
}
};