git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add optional notification of childs when parent moves
[enigma2.git]
/
lib
/
dvb
/
epgcache.cpp
diff --git
a/lib/dvb/epgcache.cpp
b/lib/dvb/epgcache.cpp
index c5110f9b7b8a062e87806545408e7a648d57c9cc..79012d387e5bcf04fc9de41f800cb849d4da74f0 100644
(file)
--- a/
lib/dvb/epgcache.cpp
+++ b/
lib/dvb/epgcache.cpp
@@
-177,12
+177,11
@@
eEPGCache::eEPGCache()
void eEPGCache::timeUpdated()
{
void eEPGCache::timeUpdated()
{
- if (
!thread_running()
)
+ if (
!sync()
)
{
eDebug("[EPGC] time updated.. start EPG Mainloop");
run();
{
eDebug("[EPGC] time updated.. start EPG Mainloop");
run();
- }
- else
+ } else
messages.send(Message(Message::timeChanged));
}
messages.send(Message(Message::timeChanged));
}
@@
-692,6
+691,7
@@
void eEPGCache::gotMessage( const Message &msg )
void eEPGCache::thread()
{
void eEPGCache::thread()
{
+ hasStarted();
nice(4);
load();
cleanLoop();
nice(4);
load();
cleanLoop();
@@
-1713,7
+1713,7
@@
void fillTuple2(PyObject *tuple, const char *argstring, int argcount, eventData
// 1 = search events with exactly title name (EXAKT_TITLE_SEARCH)
// 2 = search events with text in title name (PARTIAL_TITLE_SEARCH)
// when type is 0 (SIMILAR_BROADCASTINGS_SEARCH)
// 1 = search events with exactly title name (EXAKT_TITLE_SEARCH)
// 2 = search events with text in title name (PARTIAL_TITLE_SEARCH)
// when type is 0 (SIMILAR_BROADCASTINGS_SEARCH)
-// the fourth is the servicereference tring
+// the fourth is the servicereference
s
tring
// the fifth is the eventid
// when type is 1 or 2 (EXAKT_TITLE_SEARCH or PARTIAL_TITLE_SEARCH)
// the fourth is the search text
// the fifth is the eventid
// when type is 1 or 2 (EXAKT_TITLE_SEARCH or PARTIAL_TITLE_SEARCH)
// the fourth is the search text
@@
-1728,6
+1728,7
@@
PyObject *eEPGCache::search(PyObject *arg)
__u32 descr[512];
int eventid = -1;
const char *argstring=0;
__u32 descr[512];
int eventid = -1;
const char *argstring=0;
+ char *refstr=0;
int argcount=0;
int querytype=-1;
bool needServiceEvent=false;
int argcount=0;
int querytype=-1;
bool needServiceEvent=false;
@@
-1772,7
+1773,7
@@
PyObject *eEPGCache::search(PyObject *arg)
PyObject *obj = PyTuple_GET_ITEM(arg, 3);
if (PyString_Check(obj))
{
PyObject *obj = PyTuple_GET_ITEM(arg, 3);
if (PyString_Check(obj))
{
-
const char *
refstr = PyString_AS_STRING(obj);
+ refstr = PyString_AS_STRING(obj);
eServiceReferenceDVB ref(refstr);
if (ref.valid())
{
eServiceReferenceDVB ref(refstr);
if (ref.valid())
{
@@
-1929,22
+1930,32
@@
PyObject *eEPGCache::search(PyObject *arg)
if (descridx > -1)
{
int maxcount=maxmatches;
if (descridx > -1)
{
int maxcount=maxmatches;
+ eServiceReferenceDVB ref(refstr?refstr:"");
+ // ref is only valid in SIMILAR_BROADCASTING_SEARCH
+ // in this case we start searching with the base service
+ bool first = ref.valid() ? true : false;
singleLock s(cache_lock);
singleLock s(cache_lock);
- // check all services
-
for( eventCache::iterator cit(eventDB.begin()); cit != eventDB.end() && maxcount; ++ci
t)
+ eventCache::iterator cit(ref.valid() ? eventDB.find(ref) : eventDB.begin());
+
while(cit != eventDB.end() && maxcoun
t)
{
{
+ if ( ref.valid() && !first && cit->first == ref )
+ {
+ // do not scan base service twice ( only in SIMILAR BROADCASTING SEARCH )
+ ++cit;
+ continue;
+ }
PyObject *service_name=0;
PyObject *service_reference=0;
PyObject *service_name=0;
PyObject *service_reference=0;
-
eventMap &evmap = cit->second.first
;
+
timeMap &evmap = cit->second.second
;
// check all events
// check all events
- for (
event
Map::iterator evit(evmap.begin()); evit != evmap.end() && maxcount; ++evit)
+ for (
time
Map::iterator evit(evmap.begin()); evit != evmap.end() && maxcount; ++evit)
{
{
+ if (evit->second->getEventID() == eventid)
+ continue;
__u8 *data = evit->second->EITdata;
int tmp = evit->second->ByteSize-12;
__u32 *p = (__u32*)(data+12);
// check if any of our descriptor used by this event
__u8 *data = evit->second->EITdata;
int tmp = evit->second->ByteSize-12;
__u32 *p = (__u32*)(data+12);
// check if any of our descriptor used by this event
- if (evit->first == eventid )
- continue;
int cnt=-1;
while(tmp>0)
{
int cnt=-1;
while(tmp>0)
{
@@
-2012,6
+2023,14
@@
PyObject *eEPGCache::search(PyObject *arg)
Py_DECREF(service_name);
if (service_reference)
Py_DECREF(service_reference);
Py_DECREF(service_name);
if (service_reference)
Py_DECREF(service_reference);
+ if (first)
+ {
+ // now start at first service in epgcache database ( only in SIMILAR BROADCASTING SEARCH )
+ first=false;
+ cit=eventDB.begin();
+ }
+ else
+ ++cit;
}
}
}
}