From: Andreas Monzner Date: Fri, 11 Nov 2005 15:14:42 +0000 (+0000) Subject: add some get methods for python X-Git-Tag: 2.6.0~5327 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/cbaa4012ef5481091ac9b206e29e4c396859abe2 add some get methods for python --- diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 19df5fc6..d8f49f7e 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -78,6 +78,15 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang) m_extended_description += convertDVBUTF8(eed->getText()); retval=1; } + const ExtendedEventList *itemlist = eed->getItems(); + const ExtendedEventConstIterator it = itemlist->begin(); + int num=0; + while(it != itemlist->end()) + { + eDebug("%d %s : %s", ++num, + convertDVBUTF8((*it)->getItem()).c_str(), + convertDVBUTF8((*it)->getItemDescription()).c_str()); + } // TODO handling for extended event items? ( producer... ) break; } @@ -92,7 +101,7 @@ RESULT eServiceEvent::parseFrom(Event *evt) { uint16_t stime_mjd = evt->getStartTimeMjd(); uint32_t stime_bcd = evt->getStartTimeBcd(); - uint16_t duration = evt->getDuration(); + uint32_t duration = evt->getDuration(); m_begin = parseDVBtime( stime_mjd >> 8, stime_mjd&0xFF, @@ -100,7 +109,7 @@ RESULT eServiceEvent::parseFrom(Event *evt) (stime_bcd >> 8)&0xFF, stime_bcd & 0xFF ); - m_duration = ((duration & 0xFF) + (duration >> 8) & 0xFF) * 24 * 60; + 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]) @@ -113,4 +122,15 @@ RESULT eServiceEvent::parseFrom(Event *evt) return 0; } +std::string eServiceEvent::getBeginTimeString() +{ + tm t; + localtime_r(&m_begin, &t); + char tmp[13]; + snprintf(tmp, 13, "%02d.%02d, %02d:%02d", + t.tm_mday, t.tm_mon+1, + t.tm_hour, t.tm_min); + return std::string(tmp, 12); +} + DEFINE_REF(eDebugClass); diff --git a/lib/service/event.h b/lib/service/event.h index 6993d815..3a71f7b7 100644 --- a/lib/service/event.h +++ b/lib/service/event.h @@ -1,24 +1,35 @@ #ifndef __lib_service_event_h #define __lib_service_event_h +#ifndef PYTHON + #include #include #include class Event; +#endif class eServiceEvent: public iObject { DECLARE_REF(eServiceEvent); public: +#ifndef PYTHON time_t m_begin; int m_duration; std::string m_event_name, m_short_description, m_extended_description; // .. additional info - bool loadLanguage(Event *event, std::string lang); RESULT parseFrom(Event *evt); +#endif + time_t getBeginTime() { return m_begin; } + int getDuration() { return m_duration; } + std::string getEventName() { return m_event_name; } + std::string getShortDescription() { return m_short_description; } + std::string getExtendedDescription() { return m_extended_description; } + std::string getBeginTimeString(); }; +#ifndef PYTHON TEMPLATE_TYPEDEF(ePtr, eServiceEventPtr); class eDebugClass: public iObject @@ -32,5 +43,6 @@ public: }; // TEMPLATE_TYPEDEF(ePtr, eDebugClassPtr); +#endif #endif