libenigma_dvb_a_SOURCES = dvb.cpp demux.cpp frontend.cpp esection.cpp db.cpp \
sec.cpp scan.cpp crc32.cpp pmt.cpp decoder.cpp eit.cpp rotor_calc.cpp \
- epgcache.cpp dvbtime.cpp
+ epgcache.cpp dvbtime.cpp metaparser.cpp
--- /dev/null
+#include <lib/dvb/metaparser.h>
+#include <errno.h>
+
+int eDVBMetaParser::parseFile(const std::string &tsname)
+{
+ /* if it's a PVR channel, recover service id. */
+ std::string filename = tsname + ".meta";
+
+ FILE *f = fopen(filename.c_str(), "r");
+ if (!f)
+ return -ENOENT;
+
+ int linecnt = 0;
+
+ while (1)
+ {
+ char line[1024];
+ if (!fgets(line, 1024, f))
+ break;
+ if (*line && line[strlen(line)-1] == '\n')
+ line[strlen(line)-1] = 0;
+
+ if (*line && line[strlen(line)-1] == '\r')
+ line[strlen(line)-1] = 0;
+
+ switch (linecnt)
+ {
+ case 0:
+ m_ref = (eServiceReferenceDVB&)eServiceReference(line);
+ break;
+ case 1:
+ m_name = line;
+ break;
+ case 2:
+ m_description = line;
+ break;
+ default:
+ break;
+ }
+ ++linecnt;
+ }
+ fclose(f);
+ return 0;
+}
--- /dev/null
+#ifndef __lib_dvb_metaparser_h
+#define __lib_dvb_metaparser_h
+
+#include <string>
+#include <lib/dvb/idvb.h>
+
+class eDVBMetaParser
+{
+public:
+ int parseFile(const std::string &filename);
+
+ eServiceReferenceDVB m_ref;
+ std::string m_name, m_description;
+};
+
+#endif
#include <lib/dvb/pmt.h>
#include <lib/dvb/specs.h>
#include <lib/dvb/dvb.h>
+#include <lib/dvb/metaparser.h>
eDVBServicePMTHandler::eDVBServicePMTHandler()
{
res = m_resourceManager->allocateChannel(chid, m_channel);
} else
{
+ eDVBMetaParser parser;
+
+ if (parser.parseFile(ref.path))
+ eWarning("no .meta file found, trying original service ref.");
+ else
+ m_reference = parser.m_ref;
+
eDebug("alloc PVR");
/* allocate PVR */
res = m_resourceManager->allocatePVRChannel(m_pvr_channel);
self.movemode = False
self.bouquet_mark_edit = False
- self["list"] = MovieList(eServiceReference("2:0:1:0:0:0:0:0:0:0:/"))
+ self["list"] = MovieList(eServiceReference("2:0:1:0:0:0:0:0:0:0:/hdd/movies/"))
#self["okbutton"] = Button("ok", [self.channelSelected])
self["actions"].csel = self
def movieSelected(self):
-# self.session.nav.playService(self["list"].getCurrent())
+ self.session.nav.playService(self["list"].getCurrent()[0])
self.close()
#include <lib/dvb/db.h>
#include <lib/service/servicedvbrecord.h>
+#include <lib/dvb/metaparser.h>
+
+class eStaticServiceDVBPVRInformation: public iStaticServiceInformation
+{
+ DECLARE_REF(eStaticServiceDVBPVRInformation);
+ eServiceReference m_ref;
+ eDVBMetaParser m_parser;
+public:
+ eStaticServiceDVBPVRInformation(const eServiceReference &ref);
+ RESULT getName(const eServiceReference &ref, std::string &name);
+};
+
+DEFINE_REF(eStaticServiceDVBPVRInformation);
+
+eStaticServiceDVBPVRInformation::eStaticServiceDVBPVRInformation(const eServiceReference &ref)
+{
+ m_ref = ref;
+ m_parser.parseFile(ref.path);
+}
+
+RESULT eStaticServiceDVBPVRInformation::getName(const eServiceReference &ref, std::string &name)
+{
+ ASSERT(ref == m_ref);
+ name = m_parser.m_name.size() ? m_parser.m_name : ref.path;
+}
DEFINE_REF(eServiceFactoryDVB)
RESULT eServiceFactoryDVB::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
{
- ePtr<eDVBService> service;
- int r = lookupService(service, ref);
- if (r)
- return r;
- /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */
- ptr = service;
- return 0;
+ /* do we have a PVR service? */
+ if (ref.path.size())
+ {
+ ptr = new eStaticServiceDVBPVRInformation(ref);
+ return 0;
+ } else
+ {
+ ePtr<eDVBService> service;
+ int r = lookupService(service, ref);
+ if (r)
+ return r;
+ /* eDVBService has the iStaticServiceInformation interface, so we pass it here. */
+ ptr = service;
+ return 0;
+ }
}
RESULT eServiceFactoryDVB::lookupService(ePtr<eDVBService> &service, const eServiceReference &ref)
#include <errno.h>
#include <lib/service/servicefs.h>
#include <lib/service/service.h>
+#include <lib/service/servicedvb.h>
#include <lib/base/init_num.h>
#include <lib/base/init.h>
#include <dirent.h>
list.push_back(service);
} else
{
- eServiceReference service(eServiceFactoryFS::id,
- eServiceReference::isDirectory|
- eServiceReference::canDescent|eServiceReference::mustDescent|
- eServiceReference::shouldSort|eServiceReference::sort1,
- filename);
- service.data[0] = 0;
- list.push_back(service);
+ /* FIIIIIX ME */
+ if (filename.substr(filename.size()-3) == ".ts")
+ {
+ eServiceReference service(eServiceFactoryDVB::id,
+ 0,
+ filename);
+ service.data[0] = 0;
+ list.push_back(service);
+ }
}
}
return 0;