Jump to content


szaro

Member Since 25 Sep 2015
Offline Last Active 29 Dec 2015 23:24
-----

Posts I've Made

In Topic: Enigma2 EPG location

12 October 2015 - 14:58

OK, now I understand.
But, the main part of software is the same, so may be you can help me.
I ask only about importing module in Python.

In Topic: Enigma2 EPG location

10 October 2015 - 08:36

But, I using OpenPLI 8.6.


In Topic: Enigma2 EPG location

8 October 2015 - 19:06

No one can't help me ?
I try but, but no result, I cant't load module "enigma".
 
nbox:/usr/lib/enigma2/python# python test.py 
Traceback (most recent call last):
File "test.py", line 2, in <module>
 from enigma import eEPGCache
 File "/usr/lib/enigma2/python/enigma.py", line 30, in <module>
 File "/usr/lib/enigma2/python/enigma.py", line 22, in swig_import_helper
ImportError: No module named _enigma
nbox:/usr/lib/enigma2/python#

In Topic: Enigma2 EPG location

29 September 2015 - 21:03

pieterg-> could you explain me how I can use this code 

from enigma import eEPGCache
epgcache = eEPGCache.getInstance()
epgcache.importEvent(serviceref, eventlist)
 
I need to write simple app/plugin to export EPG data to TXT file.

 

sorry for question, but I'm newbie in Enigma and Python 


In Topic: Structure of epg.dat file.

28 September 2015 - 22:33

Hi,
Thanks for good idea:), I tried to write simple app for parse epg.dat file, but I stop on "eventData::load(FILE *f)" event data are not correctly read. For now I can only read - TSID, SID, NID, EventID, StartTime, Duration. 
Someone can help me?
 
#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:)