add content type filter

This commit is contained in:
hummypkg 2011-06-06 13:56:53 +00:00 committed by HummyPkg
parent d3e30600bb
commit 26872b9920
4 changed files with 29 additions and 6 deletions

20
epg.c
View File

@ -283,11 +283,21 @@ parse(char *epgpath,
}
}
if (!(sysopts & SYSOPT_CRIDFILTER) ||
(dslist[PARSER_CRID_EVENT] &&
check_filter(filter, FILTER_CRID, 0,
dslist[PARSER_CRID_EVENT]->content.d118.
crids[0].crid)))
if (
(
!(sysopts & SYSOPT_CRIDFILTER) ||
(dslist[PARSER_CRID_EVENT] &&
check_filter(filter, FILTER_CRID, 0,
dslist[PARSER_CRID_EVENT]->content.d118.
crids[0].crid))
) & (
!(sysopts & SYSOPT_CONTENTFILTER) ||
(dslist[PARSER_CONTENT] &&
check_filter(filter, FILTER_CONTENT,
dslist[PARSER_CONTENT]->content.d84.level1,
NULL))
)
)
callback(epg, s, d, dslist, val);
for (i = 0; i < PARSER_MAX; i++)

3
epg.h
View File

@ -68,7 +68,8 @@ enum epgfiltertype {
FILTER_EVENT,
FILTER_DESCRIPTOR,
FILTER_TIMESTAMP,
FILTER_CRID
FILTER_CRID,
FILTER_CONTENT
};
enum matchtype { FT_EQUAL, FT_RANGE, FT_GREATER, FT_LESS };

1
lint.h
View File

@ -11,6 +11,7 @@
#define SYSOPT_BRIEF 0x2
#define SYSOPT_TIMESTAMP 0x4
#define SYSOPT_CRIDFILTER 0x8
#define SYSOPT_CONTENTFILTER 0x10
extern int debug;
extern const char *version;

11
main.c
View File

@ -41,6 +41,7 @@ syntax()
" -D<descriptor type> Show only selected descriptor type.\n"
" -E<event id> Show only selected event.\n"
" -S<service id> Show only selected service.\n"
" -T<content type> Show only selected content types.\n"
" -@<unix timestamp> Show only programmes at time.\n"
"\n"
);
@ -93,6 +94,9 @@ dumpraw(struct epg *epg __attribute__((unused)),
dump_descriptor(ds[PARSER_CRID_REC], 1);
}
/* Strings should all be safe now the huffman module is in place... */
#define safeprintf printf
void
dump(struct epg *epg __attribute__((unused)),
struct section *s, struct data *d, struct descriptor **ds,
@ -415,6 +419,13 @@ main(int argc, char **argv)
add_epgfilter(&filter, FILTER_SERVICE,
atoi(cp), 0, NULL, FT_EQUAL);
goto nextopt;
case 'T':
GETOPT;
add_epgfilter(&filter, FILTER_CONTENT,
atoi(cp), 0, NULL, FT_EQUAL);
sysopts |= SYSOPT_CONTENTFILTER;
goto nextopt;
}
}
nextopt: