X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4cdeb9ebe328382bb4ef6a01b67ff840adcc84ad..b5d81255af4c93441b5b86386dde544e2fa15e05:/lib/service/event.cpp diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 2d0f83a4..4dda5779 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -10,6 +10,18 @@ #include #include +#include +#include + +// static members / methods +std::string eServiceEvent::m_language = "de_DE"; + +void eServiceEvent::setEPGLanguage( const std::string language ) +{ + m_language = language; +} +/////////////////////////// + DEFINE_REF(eServiceEvent); DEFINE_REF(eComponentData); @@ -165,9 +177,8 @@ RESULT eServiceEvent::parseFrom(Event *evt, int tsidonid) ); m_event_id = evt->getEventId(); m_duration = fromBCD(duration>>16)*3600+fromBCD(duration>>8)*60+fromBCD(duration); - std::string country="de_DE"; // TODO use local data here for (int i=0; i < MAX_LANG; i++) - if (country==ISOtbl[i][0]) + if (m_language==ISOtbl[i][0]) if (loadLanguage(evt, ISOtbl[i][1], tsidonid)) return 0; if (loadLanguage(evt, "eng", tsidonid)) @@ -177,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;