return i->second->info(ref, ptr);
}
+RESULT eServiceCenter::offlineOperations(const eServiceReference &ref, ePtr<iServiceOfflineOperations> &ptr)
+{
+ std::map<int,ePtr<iServiceHandler> >::iterator i = handler.find(ref.type);
+ if (i == handler.end())
+ {
+ ptr = 0;
+ return -1;
+ }
+ return i->second->offlineOperations(ref, ptr);
+}
+
RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd)
{
handler.insert(std::pair<int,ePtr<iServiceHandler> >(id, hnd));
RESULT record(const eServiceReference &, iRecordableServicePtr &ptr);
RESULT list(const eServiceReference &, iListableServicePtr &ptr);
RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
+ RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
// eServiceCenter
static RESULT getInstance(eServiceCenterPtr &ptr) { ptr = instance; return 0; }
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()
}
}
+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
RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
+ RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
private:
RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
};
#include <sys/stat.h>
#include <unistd.h>
-
class eStaticServiceFSInformation: public iStaticServiceInformation
{
DECLARE_REF(eStaticServiceFSInformation);
return 0;
}
+RESULT eServiceFactoryFS::offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr)
+{
+ ptr = 0;
+ return -1;
+}
+
// eServiceFS
DEFINE_REF(eServiceFS);
}
if (!m_list.size())
+ {
+ ptr = eServiceReference();
return -ERANGE;
+ }
ptr = m_list.front();
m_list.pop_front();
RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
+ RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
private:
ePtr<iStaticServiceInformation> m_service_information;
};
return 0;
}
+RESULT eServiceFactoryMP3::offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr)
+{
+ ptr = 0;
+ return -1;
+}
+
+
// eStaticServiceMP3Info
RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
+ RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
private:
ePtr<eStaticServiceMP3Info> m_service_info;
};