#1
Posted 25 September 2015 - 21:13
Re: Structure of epg.dat file. #2
Posted 25 September 2015 - 21:57
The file has a custom format that requires parsing, it's not a standad file type.
A simple search on the codebase like https://github.com/O...tf8=✓&q=epg.dat will show you the eEPGCache::load() method in /lib/dvb/epgcache.cpp that takes care of loading the file when Enigma2 starts.
Alternatively look for the source of CrossEPG, I believe that can read the epg.dat file too.
Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)
Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.
Many answers to your question can be found in our new and improved wiki.
Re: Structure of epg.dat file. #3
Posted 28 September 2015 - 22:33
#include <iostream> #include <cstdio> #include <cstring> #include <cstdint> #include "timex.h" using namespace std; struct eventData { uint8_t rawEITdata[10]; uint8_t n_crc; uint8_t type; static uint8_t data[]; int getEventID() const { return (rawEITdata[0] << 8) | rawEITdata[1]; } time_t getStartTime() const { return parseDVBtime(&rawEITdata[2]); } int getDuration() const { return fromBCD(rawEITdata[7])*3600+fromBCD(rawEITdata[8])*60+fromBCD(rawEITdata[9]); } }; struct DescriptorPair { int reference_count; uint8_t* data; DescriptorPair() {} DescriptorPair(int c, uint8_t* d): reference_count(c), data(d) {} }; int main() { FILE *f; f = fopen("epg.dat", "rb"); if (f == NULL) { printf("File not found.\n"); } else { printf("File opened!.\n"); } int size=0,cnt=0; unsigned int magic=0; fread( &magic, sizeof(int), 1, f); if (magic != 0x98765432) { printf("[eEPGCache] epg file has incorrect byte order.. dont read it"); fclose(f); return 0; } char text1[13]; fread( text1, 13, 1, f); printf("%s\n",text1); if ( !memcmp( text1, "ENIGMA_EPG_V7", 13) ) { printf("OK - ENIGMA EPG\n",text1); fread( &size, sizeof(int), 1, f); printf("%d\n",size); while(size--) { int size = 0; int nid = 0; int tsid = 0; int sid = 0; fread(&sid, sizeof(int), 1, f); fread(&nid, sizeof(int), 1, f); fread(&tsid, sizeof(int), 1, f); fread(&size, sizeof(int), 1, f); printf("NID: %d, TSID: %d, SID: %d, Titles count: %d . \n",nid,tsid,sid,size); cnt++; //getchar(); while(size--) { uint8_t len= 0 ; uint8_t type= 0 ; uint8_t text[128]; int event = 0; eventData eventt; fread(&type, sizeof(uint8_t), 1, f); fread(&len, sizeof(uint8_t), 1, f); event = (len-10) / sizeof(uint32_t); fread(eventt.rawEITdata,10,1,f); //getchar(); printf("SID: %d ,Event ID: %d, Start time : %d, Duration : %d . \n",sid,eventt.getEventID(),eventt.getStartTime(),eventt.getDuration()/60); if(event) { fread(&text,sizeof(uint32_t), event,f); //printf(" %s \n ",text); } //printf("Type: %d, len: %d.\n",type,len); } } // eventData::load(FILE *f) int size = 0; int id = 0; int ref = 0 ; DescriptorPair p; uint8_t header[2],buf[256]; fread(&size,sizeof(int),1,f); printf(" size = %d",size); getchar(); while(size) { fread(&id , sizeof(uint32_t), 1, f); fread(&p.reference_count, sizeof(int), 1, f); fread(header, 2, 1, f); int bytes = header[1]+2; p.data = new uint8_t[bytes]; p.data[0] = header[0]; p.data[1] = header[1]; fread(p.data+2, bytes-2,1,f); getchar(); printf("h[0] = %d, h[1] = %d, ref= %d, id=%d ,data= %s \n",header[0],header[1],p.reference_count,id, p.data); --size; } } fclose(f); printf("Total ch: %d\n",cnt); return 0; }
Thanks:)
Also tagged with one or more of these keywords: EPG, database, export
OpenWebif: EPG is not displayed correctly (distorted)Started by Spittek, 8 Nov 2023 OpenWebif, EPG, Mac, Chrome |
|
|||
EPG word niet ververstStarted by PliPi, 16 Oct 2023 epg |
|
|||
NHK World TV missing?Started by fullerand, 18 Apr 2023 rytec, epg, nhk, nhktv |
|
|||
EPG
Assigning EPG to IPTV radio channelStarted by george kildare, 9 Oct 2022 EPG, IPTV Radio |
|
|||
Tempest EPG GeneratorStarted by kvanc_tempest, 16 May 2022 xmltv, epg, php, gui, generator |
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users