X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/43eacf2ca5189458bd43ca947242ec3b3bc5a5f4..5c4cd1a455e924e578478c97d00b799ef3192ef0:/lib/service/event.cpp diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 07c92c52..4dda5779 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -10,6 +10,9 @@ #include #include +#include +#include + // static members / methods std::string eServiceEvent::m_language = "de_DE"; @@ -185,6 +188,27 @@ RESULT eServiceEvent::parseFrom(Event *evt, int tsidonid) return 0; } +RESULT eServiceEvent::parseFrom(const std::string filename, int tsidonid) +{ + if (!filename.empty()) + { + int fd = ::open( filename.c_str(), O_RDONLY ); + if ( fd > -1 ) + { + __u8 buf[4096]; + int rd = ::read(fd, buf, 4096); + ::close(fd); + if ( rd > 12 /*EIT_LOOP_SIZE*/ ) + { + Event ev(buf); + parseFrom(&ev, tsidonid); + return 0; + } + } + } + return -1; +} + std::string eServiceEvent::getBeginTimeString() const { tm t;