add dumpraw, update parseable

This commit is contained in:
hummypkg 2011-06-03 21:36:58 +00:00 committed by HummyPkg
parent e20b183f2e
commit 992e0114aa
1 changed files with 35 additions and 12 deletions

47
main.c
View File

@ -54,6 +54,22 @@ syntax()
return 0;
}
void
dumpraw(struct epg *epg __attribute__((unused)),
struct section *s, struct data *d, struct descriptor **ds,
void *var __attribute__((unused)))
{
dump_section(s);
dump_data(d);
if (ds[PARSER_SHORT_EVENT])
dump_descriptor(ds[PARSER_SHORT_EVENT], 1);
if (ds[PARSER_USER_DEFINED])
dump_descriptor(ds[PARSER_USER_DEFINED], 1);
if (ds[PARSER_CONTENT_ID])
dump_descriptor(ds[PARSER_CONTENT_ID], 1);
}
void
dump(struct epg *epg __attribute__((unused)),
struct section *s, struct data *d, struct descriptor **ds,
@ -94,47 +110,52 @@ dump(struct epg *epg __attribute__((unused)),
if (sysopts & SYSOPT_PARSABLE)
{
printf("ServiceID:%d\n", s->service_id);
printf("EventID:%d\n", d->event_id);
printf("Start:%ld\n", tm);
printf("Duration:%d\n",
d->dur_hour * 3600 + d->dur_min * 60 + d->dur_sec);
printf("Encrypted:%d\n", d->u1.u.free_CA_mode);
/* service_id, event_id, start, duration, encrypted, name, text
* warning, num_crids, crid_type, crid, ...
*/
printf("%d\t%d\t%ld\t%d\t%d\t",
s->service_id, d->event_id, tm,
d->dur_hour * 3600 + d->dur_min * 60 + d->dur_sec,
d->u1.u.free_CA_mode);
if (ds[PARSER_SHORT_EVENT])
{
struct descriptor *d77 = ds[PARSER_SHORT_EVENT];
safeprintf("Name:%.*s\n",
safeprintf("%.*s\t",
d77->content.d77.namelen, d77->content.d77.name);
safeprintf("Text:%.*s\n",
safeprintf("%.*s\t",
d77->content.d77.textlen, d77->content.d77.text);
}
else
printf("\t\t");
if (ds[PARSER_USER_DEFINED])
{
struct descriptor *d137 = ds[PARSER_USER_DEFINED];
safeprintf("Warning:%.*s\n",
d137->content.d137.warninglen,
safeprintf("%.*s\t", d137->content.d137.warninglen,
d137->content.d137.warning);
}
else
printf("\t");
if (ds[PARSER_CONTENT_ID])
{
struct descriptor *d118 = ds[PARSER_CONTENT_ID];
int i;
printf("nCRIDs:%d\n", d118->content.d118.i);
printf("%d\t", d118->content.d118.i);
for (i = 0; i < d118->content.d118.i; i++)
{
struct crid *crid =
&d118->content.d118.crids[i];
printf("CRID:%d:%.*s\n", crid->type,
printf("%d\t%.*s\t", crid->type,
crid->cridlen, crid->crid);
}
}
printf("\n");
return;
}
@ -311,6 +332,8 @@ nextopt:
if (!strcmp(argv[0], "dump"))
parse(epgpath, dump, NULL, filter);
else if (!strcmp(argv[0], "dumpraw"))
parse(epgpath, dumpraw, NULL, filter);
else if (!strcmp(argv[0], "now"))
parse(epgpath, now, NULL, filter);
else if (!strcmp(argv[0], "search") && argc > 1)