diff --git a/main.c b/main.c index d2eb67b..ef8cec2 100644 --- a/main.c +++ b/main.c @@ -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)