X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/e80fbff7f23ad6eefda6331a150b9fe57f6c9302..aa3fdc5321e50af5b79085a0942e9b5cf2d82e30:/lib/dvb/epgcache.cpp diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 6c950279..189fcfc4 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -701,15 +701,17 @@ void eEPGCache::thread() void eEPGCache::load() { + singleLock s(cache_lock); FILE *f = fopen("/hdd/epg.dat", "r"); if (f) { - unsigned char md5_saved[16]; - unsigned char md5[16]; int size=0; int cnt=0; - bool md5ok=false; #if 0 + unsigned char md5_saved[16]; + unsigned char md5[16]; + bool md5ok=false; + if (!md5_file("/hdd/epg.dat", 1, md5)) { FILE *f = fopen("/hdd/epg.dat.md5", "r"); @@ -724,9 +726,17 @@ void eEPGCache::load() if ( md5ok ) #endif { + unsigned int magic=0; + fread( &magic, sizeof(int), 1, f); + if (magic != 0x98765432) + { + eDebug("epg file has incorrect byte order.. dont read it"); + fclose(f); + return; + } char text1[13]; fread( text1, 13, 1, f); - if ( !strncmp( text1, "ENIGMA_EPG_V4", 13) ) + if ( !strncmp( text1, "ENIGMA_EPG_V5", 13) ) { fread( &size, sizeof(int), 1, f); while(size--) @@ -822,7 +832,9 @@ void eEPGCache::save() int cnt=0; if ( f ) { - const char *text = "ENIGMA_EPG_V4"; + unsigned int magic = 0x98765432; + fwrite( &magic, sizeof(int), 1, f); + const char *text = "ENIGMA_EPG_V5"; fwrite( text, 13, 1, f ); int size = eventDB.size(); fwrite( &size, sizeof(int), 1, f ); @@ -1434,25 +1446,28 @@ PyObject *handleEvent(ePtr &ptr, PyObject *dest_list, char* argst return 0; } -// here we get a list with tuples -// first tuple entry is the servicereference -// the second is the type of query (0 = time, 1 = event_id) -// the third -// when type is eventid it is the event_id -// when type is time then it is the start_time ( 0 for now_time ) -// the fourth is the end_time .. ( optional ) - -/* argv is a python string - I = Event Id - B = Event Begin Time - D = Event Duration - T = Event Title - S = Event Short Description - E = Event Extended Description - C = Current Time - R = Service Reference - N = Service Name -*/ +// here we get a python list +// the first entry in the list is a python string to specify the format of the returned tuples (in a list) +// I = Event Id +// B = Event Begin Time +// D = Event Duration +// T = Event Title +// S = Event Short Description +// E = Event Extended Description +// C = Current Time +// R = Service Reference +// N = Service Name +// then for each service follows a tuple +// first tuple entry is the servicereference (as string... use the ref.toString() function) +// the second is the type of query +// 2 = event_id +// -1 = event before given start_time +// 0 = event intersects given start_time +// +1 = event after given start_time +// the third +// when type is eventid it is the event_id +// when type is time then it is the start_time ( 0 for now_time ) +// the fourth is the end_time .. ( optional .. for query all events in time range) PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc) { @@ -1530,7 +1545,7 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc) if (!PyString_Check(entry)) { eDebug("tuple entry 0 is no a string"); - continue; + goto skip_entry; } service = entry; break; @@ -1540,7 +1555,7 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc) if (type < -1 || type > 2) { eDebug("unknown type %d", type); - continue; + goto skip_entry; } break; case 2: @@ -1612,6 +1627,8 @@ PyObject *eEPGCache::lookupEvent(PyObject *list, PyObject *convertFunc) if (service_name) Py_DECREF(service_name); } +skip_entry: + ; } if (convertFuncArgs) Py_DECREF(convertFuncArgs); @@ -1882,9 +1899,9 @@ void eEPGCache::channel_data::readPrivateData( const __u8 *data) eDebug("get Null pointer from section reader !!"); else { -#ifdef NEED_DEMUX_WORKAROUND if ( seenPrivateSections.find( data[6] ) == seenPrivateSections.end() ) { +#ifdef NEED_DEMUX_WORKAROUND int version = data[5]; version = ((version & 0x3E) >> 1); can_delete = 0;