Browse Source

support descriptor 126

master
hummypkg 5 years ago
committed by HummyPkg
parent
commit
f31cfea03b
  1. 3
      descriptor.h
  2. 8
      epg.c
  3. 67
      main.c

3
descriptor.h

@ -20,7 +20,8 @@
#define PARSER_CRID_SERIES 4
#define PARSER_CRID_REC 5
#define PARSER_EXTENDED_EVENT 6
#define PARSER_MAX 7
#define PARSER_FTA_CONTENT_MGMT 7
#define PARSER_MAX 8
#define CRIDT_EVENT '1'
#define CRIDT_SERIES '2'

8
epg.c

@ -343,13 +343,15 @@ parse(char *epgpath,
dslist[PARSER_CONTENT] = ds;
break;
/*
case DS_FTA_CONTENT_MGMT:
if (!(ds = read_descriptor_header(epg)))
break;
read_descriptor(epg, ds);
dump_descriptor(ds, 1);
free_descriptor(ds);
dslist[PARSER_FTA_CONTENT_MGMT] = ds;
break;
/*
case DS_LINKAGE:
read_descriptor(epg, ds);
dump_descriptor(ds, 1);

67
main.c

@ -1,6 +1,6 @@
/*
* Humax EPG Tool
* by af123, 2011 - 2015
* by af123, 2011 - 2016
*/
#include <stdio.h>
@ -21,7 +21,7 @@
#include "lint.h"
int debug = 0;
const char *version = "1.2.0";
const char *version = "1.2.1";
unsigned long sysopts = 0;
unsigned long filterflags = 0;
static time_t latest_stamp = 0;
@ -34,7 +34,7 @@ sqlite3_stmt *stmt;
int
syntax()
{
fprintf(stderr, "Humax EPG Tool v%s, by af123, 2011-2015.\n\n",
fprintf(stderr, "Humax EPG Tool v%s, by af123, 2011-2016.\n\n",
version);
fprintf(stderr,
"Syntax: epg [options] [filters] <command>...\n\n");
@ -91,6 +91,7 @@ syntax()
" Service ID, Event ID, Start, Duration, Encrypted,\n"
" Title, Synopsis, Warning, Content Code, Content Type,\n"
" Event CRID, Series CRID, Recommended CRID, Guidance Mode\n"
" Content Mgmt\n"
);
fprintf(stderr, "\n");
@ -174,6 +175,8 @@ dumpraw(struct epg *epg __attribute__((unused)),
dump_descriptor(ds[PARSER_CRID_SERIES], 1);
if (ds[PARSER_CRID_REC])
dump_descriptor(ds[PARSER_CRID_REC], 1);
if (ds[PARSER_FTA_CONTENT_MGMT])
dump_descriptor(ds[PARSER_FTA_CONTENT_MGMT], 1);
}
/* Strings should all be safe now the huffman module is in place... */
@ -261,6 +264,7 @@ sqlitedumpstart(char *file)
"[start] integer, [end] integer, [duration] integer, "
"[name] text, [text] text, [warning] text, [warning_mode] integer, "
"[content_code] integer, [content_type] text, "
"[content_mgmt] integer, "
"[event_crid] text, [series_crid] text, [rec_crid] text)"
);
EXEC("create index tm on epg(start,end)");
@ -268,7 +272,7 @@ sqlitedumpstart(char *file)
EXEC("create index service_id on epg(service_id)");
if (sqlite3_prepare_v2(db,
"insert into epg values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
"insert into epg values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
-1, &stmt, NULL) != SQLITE_OK)
{
fprintf(stderr,
@ -318,6 +322,7 @@ sqlitedump(struct epg *epg __attribute__((unused)),
sqlite3_bind_text(stmt, 6, d->content.d77.name, -1, NULL);
sqlite3_bind_text(stmt, 7, d->content.d77.text, -1, NULL);
}
if (ds[PARSER_USER_DEFINED])
{
struct descriptor *d = ds[PARSER_USER_DEFINED];
@ -326,6 +331,7 @@ sqlitedump(struct epg *epg __attribute__((unused)),
sqlite3_bind_text(stmt, 8, d->content.d137.warning, -1, NULL);
sqlite3_bind_int(stmt, 9, d->content.d137.guidance_mode);
}
if (ds[PARSER_CONTENT])
{
sqlite3_bind_int(stmt, 10,
@ -334,24 +340,32 @@ sqlitedump(struct epg *epg __attribute__((unused)),
-1, NULL);
}
if (ds[PARSER_FTA_CONTENT_MGMT])
{
sqlite3_bind_int(stmt, 12,
!ds[PARSER_FTA_CONTENT_MGMT]->content.d126.no_scramble);
}
else
sqlite3_bind_int(stmt, 12, 0);
if (ds[PARSER_CRID_EVENT])
{
struct descriptor *d = ds[PARSER_CRID_EVENT];
sqlite3_bind_text(stmt, 12, d->content.d118.crids[0].crid,
sqlite3_bind_text(stmt, 13, d->content.d118.crids[0].crid,
-1, NULL);
}
if (ds[PARSER_CRID_SERIES])
{
struct descriptor *d = ds[PARSER_CRID_SERIES];
sqlite3_bind_text(stmt, 13, d->content.d118.crids[0].crid,
sqlite3_bind_text(stmt, 14, d->content.d118.crids[0].crid,
-1, NULL);
}
if (ds[PARSER_CRID_REC])
{
struct descriptor *d = ds[PARSER_CRID_REC];
sqlite3_bind_text(stmt, 14, d->content.d118.crids[0].crid,
sqlite3_bind_text(stmt, 15, d->content.d118.crids[0].crid,
-1, NULL);
}
@ -444,6 +458,14 @@ json(struct epg *epg __attribute__((unused)),
content_type(ds[PARSER_CONTENT]));
}
if (ds[PARSER_FTA_CONTENT_MGMT])
{
struct descriptor *d = ds[PARSER_FTA_CONTENT_MGMT];
printf(",\n \"content_mgmt\": \"%d\"",
!d->content.d126.no_scramble);
}
if (ds[PARSER_CRID_EVENT])
{
struct descriptor *d = ds[PARSER_CRID_EVENT];
@ -487,6 +509,7 @@ sqldumpstart()
printf("guidance_mode tinyint unsigned not null,\n");
printf("content_code bigint unsigned not null,\n");
printf("content_type varchar(255),\n");
printf("content_mgmt bigint unsigned not null default 0,\n");
printf("event_crid varchar(255),\n");
printf("series_crid varchar(255),\n");
printf("rec_crid varchar(255),\n");
@ -561,6 +584,12 @@ sqldump(struct epg *epg __attribute__((unused)),
content_type(ds[PARSER_CONTENT]));
}
if (ds[PARSER_FTA_CONTENT_MGMT])
{
printf(",\n content_mgmt = %d",
!ds[PARSER_CONTENT]->content.d126.no_scramble);
}
if (ds[PARSER_CRID_EVENT])
{
struct descriptor *d = ds[PARSER_CRID_EVENT];
@ -593,6 +622,7 @@ dump(struct epg *epg __attribute__((unused)),
void *var __attribute__((unused)))
{
time_t tm;
int cm;
tm = mjd(d->start_date, d->start_hour, d->start_min, d->start_sec);
@ -613,7 +643,7 @@ dump(struct epg *epg __attribute__((unused)),
/* service_id, event_id, start, duration, encrypted, name, text
* warning, content code, content type,
* event CRID, series CRID, rec CRID,
* guidance mode
* guidance mode, content management
*/
printf("%d\t%d\t%ld\t%d\t%d\t",
s->service_id, d->event_id, tm,
@ -685,6 +715,14 @@ dump(struct epg *epg __attribute__((unused)),
else
printf("\t");
if (ds[PARSER_FTA_CONTENT_MGMT])
{
printf("%d\t", !ds[PARSER_FTA_CONTENT_MGMT]->
content.d126.no_scramble);
}
else
printf("\t");
printf("\n");
return;
}
@ -721,14 +759,21 @@ dump(struct epg *epg __attribute__((unused)),
printf("%30s: %d\n", "Service ID", s->service_id);
printf("%30s: %d\n", "Event ID", d->event_id);
printf("%30s: %#x %d:%02d:%02d (%s)\n", "start_date",
printf("%30s: %#x %d:%02d:%02d (%s)\n", "Start Date",
d->start_date, d->start_hour, d->start_min, d->start_sec,
ctime_nl(&tm));
printf("%30s: %d:%02d:%02d\n", "duration",
printf("%30s: %d:%02d:%02d\n", "Duration",
d->dur_hour, d->dur_min, d->dur_sec);
printf("%30s: %d\n", "encrypted", d->u1.u.free_CA_mode);
printf("%30s: %d\n", "Encrypted", d->u1.u.free_CA_mode);
cm = 1;
if (ds[PARSER_FTA_CONTENT_MGMT])
{
cm = ds[PARSER_FTA_CONTENT_MGMT]->content.d126.no_scramble;
}
printf("%30s: %s\n", "Content Mgmt", cm ? "No" : "Yes");
if (ds[PARSER_SHORT_EVENT])
{

Loading…
Cancel
Save