X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/855949a917ed8cf65397adc49872c99bdb2123c2..80f0ae4f5b0e4b8d5b8170512b2f9c5071edfcb2:/lib/service/event.cpp diff --git a/lib/service/event.cpp b/lib/service/event.cpp index aa8482a0..e78ddc4e 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -72,7 +72,7 @@ std::string ISOtbl[MAX_LANG][2] = bool eServiceEvent::loadLanguage(Event *evt, std::string lang, int tsidonid) { bool retval=0; - for (DescriptorConstIterator desc = evt->getDescriptors()->begin(); desc != evt->getDescriptors()->end() && !retval; ++desc) + for (DescriptorConstIterator desc = evt->getDescriptors()->begin(); desc != evt->getDescriptors()->end(); ++desc) { switch ((*desc)->getTag()) { @@ -84,7 +84,9 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang, int tsidonid) const ShortEventDescriptor *sed = (ShortEventDescriptor*)*desc; const std::string &cc = sed->getIso639LanguageCode(); int table=encodingHandler.getCountryCodeDefaultMapping(cc); - if (lang.empty() || cc == lang) + if (lang.empty()) + lang = cc; // use first found language + if (cc == lang) { m_event_name = convertDVBUTF8(sed->getEventName(), table, tsidonid); m_short_description = convertDVBUTF8(sed->getText(), table, tsidonid); @@ -97,7 +99,9 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang, int tsidonid) const ExtendedEventDescriptor *eed = (ExtendedEventDescriptor*)*desc; const std::string &cc = eed->getIso639LanguageCode(); int table=encodingHandler.getCountryCodeDefaultMapping(cc); - if (lang.empty() || cc == lang) + if (lang.empty()) + lang = cc; // use first found language + if (cc == lang) { m_extended_description += convertDVBUTF8(eed->getText(), table, tsidonid); retval=1; @@ -236,6 +240,23 @@ RESULT eServiceEvent::getComponentData(ePtr &dest, int tagnum) c return -1; } +PyObject *eServiceEvent::getComponentData() const +{ + ePyObject ret = PyList_New(m_component_data.size()); + int cnt=0; + for (std::list::const_iterator it(m_component_data.begin()); it != m_component_data.end(); ++it) + { + ePyObject tuple = PyTuple_New(5); + PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(it->m_componentTag)); + PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(it->m_componentType)); + PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(it->m_streamContent)); + PyTuple_SET_ITEM(tuple, 3, PyString_FromString(it->m_iso639LanguageCode.c_str())); + PyTuple_SET_ITEM(tuple, 4, PyString_FromString(it->m_text.c_str())); + PyList_SET_ITEM(ret, cnt++, tuple); + } + return ret; +} + RESULT eServiceEvent::getLinkageService(eServiceReference &service, eServiceReference &parent, int num) const { std::list::const_iterator it =