diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-09-29 22:12:32 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-09-29 22:12:32 +0000 |
| commit | d0899514fa9495013cb73c8ead8c5a5baaf49111 (patch) | |
| tree | 85967f5ac0aa005cea828373fba8e429ae41e69b /lib/service/servicedvb.cpp | |
| parent | 2ee3a3e99c59ec6441cb26f083124726f12e1fa5 (diff) | |
| download | enigma2-d0899514fa9495013cb73c8ead8c5a5baaf49111.tar.gz enigma2-d0899514fa9495013cb73c8ead8c5a5baaf49111.zip | |
add offline operations to services
Diffstat (limited to 'lib/service/servicedvb.cpp')
| -rw-r--r-- | lib/service/servicedvb.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index cb5b4b72..64e62cac 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -54,6 +54,55 @@ int eStaticServiceDVBPVRInformation::getLength(const eServiceReference &ref) return len / 90000; } + + +class eDVBPVRServiceOfflineOperations: public iServiceOfflineOperations +{ + DECLARE_REF(eDVBPVRServiceOfflineOperations); + eServiceReferenceDVB m_ref; +public: + eDVBPVRServiceOfflineOperations(const eServiceReference &ref); + + RESULT deleteFromDisk(int simulate); + RESULT getListOfFilenames(std::list<std::string> &); +}; + +DEFINE_REF(eDVBPVRServiceOfflineOperations); + +eDVBPVRServiceOfflineOperations::eDVBPVRServiceOfflineOperations(const eServiceReference &ref): m_ref((const eServiceReferenceDVB&)ref) +{ +} + +RESULT eDVBPVRServiceOfflineOperations::deleteFromDisk(int simulate) +{ + if (simulate) + return 0; + else + { + std::list<std::string> res; + if (getListOfFilenames(res)) + return -1; + + /* TODO: deferred removing.. */ + for (std::list<std::string>::iterator i(res.begin()); i != res.end(); ++i) + { + eDebug("Removing %s...", i->c_str()); + ::unlink(i->c_str()); + } + + return 0; + } +} + +RESULT eDVBPVRServiceOfflineOperations::getListOfFilenames(std::list<std::string> &res) +{ + res.clear(); + res.push_back(m_ref.path); + return 0; +} + + + DEFINE_REF(eServiceFactoryDVB) eServiceFactoryDVB::eServiceFactoryDVB() @@ -169,6 +218,12 @@ RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServic } } +RESULT eServiceFactoryDVB::offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr) +{ + ptr = 0; + return -1; +} + RESULT eServiceFactoryDVB::lookupService(ePtr<eDVBService> &service, const eServiceReference &ref) { // TODO: handle the listing itself |
