sync
[enigma2.git] / lib / service / servicedvb.cpp
index cb5b4b727ea1255cdc8bf5b4b86d60feda45319d..ca08d481bd52c1b6c012aada84b1154bf1e7e3ea 100644 (file)
@@ -54,13 +54,62 @@ 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()
 {
        ePtr<eServiceCenter> sc;
        
-       eServiceCenter::getInstance(sc);
+       eServiceCenter::getPrivInstance(sc);
        if (sc)
                sc->addServiceFactory(eServiceFactoryDVB::id, this);
 }
@@ -69,7 +118,7 @@ eServiceFactoryDVB::~eServiceFactoryDVB()
 {
        ePtr<eServiceCenter> sc;
        
-       eServiceCenter::getInstance(sc);
+       eServiceCenter::getPrivInstance(sc);
        if (sc)
                sc->removeServiceFactory(eServiceFactoryDVB::id);
 }
@@ -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