aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/db.cpp
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-11-14 02:40:16 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2005-11-14 02:40:16 +0000
commit059982cc102de394ac316abc3ee0806673d003d5 (patch)
tree8066c48f450395c0966177834add07e1f196d82f /lib/dvb/db.cpp
parentb84057facdcc2e242611c312240f389fd2c11c99 (diff)
downloadenigma2-059982cc102de394ac316abc3ee0806673d003d5.tar.gz
enigma2-059982cc102de394ac316abc3ee0806673d003d5.zip
working on move, edit mode and add remove service to context menu
Diffstat (limited to 'lib/dvb/db.cpp')
-rw-r--r--lib/dvb/db.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp
index 153f5804..93b13cc6 100644
--- a/lib/dvb/db.cpp
+++ b/lib/dvb/db.cpp
@@ -10,7 +10,6 @@
DEFINE_REF(eDVBService);
-// the following three methodes are declared in idvb.h
RESULT eBouquet::addService(const eServiceReference &ref)
{
list::iterator it =
@@ -389,6 +388,49 @@ void eDVBDB::save()
fclose(f);
}
+RESULT eBouquet::flushChanges()
+{
+ FILE *f=fopen(m_path.c_str(), "wt");
+ if (!f)
+ return -1;
+ if ( fprintf(f, "#NAME %s\r\n", m_bouquet_name.c_str()) < 0 )
+ goto err;
+ for (list::iterator i(m_services.begin()); i != m_services.end(); ++i)
+ {
+ eServiceReference tmp = *i;
+ std::string str = tmp.path;
+ if ( (i->flags&eServiceReference::flagDirectory) == eServiceReference::flagDirectory )
+ {
+ unsigned int p1 = str.find("FROM BOUQUET \"");
+ if (p1 == std::string::npos)
+ {
+ eDebug("doof... kaputt");
+ continue;
+ }
+ str.erase(0, p1+14);
+ p1 = str.find("\"");
+ if (p1 == std::string::npos)
+ {
+ eDebug("doof2... kaputt");
+ continue;
+ }
+ str.erase(p1);
+ tmp.path=str;
+ }
+ if ( fprintf(f, "#SERVICE %s\r\n", tmp.toString().c_str()) < 0 )
+ goto err;
+ if ( i->name.length() )
+ if ( fprintf(f, "#DESCRIPTION %s\r\n", i->name.c_str()) < 0 )
+ goto err;
+ }
+ fclose(f);
+ return 0;
+err:
+ fclose(f);
+ eDebug("couldn't write file %s", m_path.c_str());
+ return -1;
+}
+
void eDVBDB::loadBouquet(const char *path)
{
std::string bouquet_name = path;