From 8d116f4f5ebf11ffa4b8ecc4c26474470bb318b2 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Thu, 26 Jul 2007 12:05:06 +0000 Subject: [PATCH] fix --- lib/dvb/epgcache.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 81b96a82..356bd7c4 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -1508,36 +1508,29 @@ RESULT eEPGCache::lookupEventId(const eServiceReference &service, int event_id, RESULT eEPGCache::startTimeQuery(const eServiceReference &service, time_t begin, int minutes) { const eServiceReferenceDVB &ref = (const eServiceReferenceDVB&)handleGroup(service); + if (begin == -1) + begin = eDVBLocalTimeHandler::getInstance()->nowTime(); Lock(); eventCache::iterator It = eventDB.find(ref); if ( It != eventDB.end() && It->second.second.size() ) { - if ( begin != -1 ) + m_timemap_cursor = It->second.second.lower_bound(begin); + if ( m_timemap_cursor != It->second.second.end() ) { - m_timemap_cursor = It->second.second.lower_bound(begin); - if ( m_timemap_cursor != It->second.second.end() ) + if ( m_timemap_cursor->first != begin ) { - if ( m_timemap_cursor->first != begin ) + timeMap::iterator x = m_timemap_cursor; + --x; + if ( x != It->second.second.end() ) { - timeMap::iterator x = m_timemap_cursor; - --x; - if ( x != It->second.second.end() ) - { - time_t start_time = x->first; - if ( begin > start_time && begin < (start_time+x->second->getDuration())) - m_timemap_cursor = x; - } + time_t start_time = x->first; + if ( begin > start_time && begin < (start_time+x->second->getDuration())) + m_timemap_cursor = x; } } } - else - m_timemap_cursor = It->second.second.begin(); - - if (minutes != -1 && m_timemap_cursor != It->second.second.end()) - m_timemap_end = It->second.second.upper_bound(m_timemap_cursor->first+minutes*60); - else - m_timemap_end = It->second.second.end(); + m_timemap_end = It->second.second.upper_bound(begin+minutes*60); currentQueryTsidOnid = (ref.getTransportStreamID().get()<<16) | ref.getOriginalNetworkID().get(); Unlock(); return 0; @@ -1799,6 +1792,10 @@ PyObject *eEPGCache::lookupEvent(ePyObject list, ePyObject convertFunc) break; } } + + if (minutes && stime == -1) + stime = eDVBLocalTimeHandler::getInstance()->nowTime(); + eServiceReference ref(handleGroup(eServiceReference(PyString_AS_STRING(service)))); if (ref.type != eServiceReference::idDVB) { -- 2.30.2