This commit is contained in:
hummypkg 2011-08-25 19:51:00 +00:00 committed by HummyPkg
parent 1ce97801b6
commit 18b82bf36f
2 changed files with 38 additions and 2 deletions

9
epg.c
View File

@ -120,7 +120,14 @@ check_filter_range(struct epgfilter *f, enum epgfiltertype type,
for (; f; f = f->next)
{
if (f->type == type && (f->num < idl || f->num > idh))
if (f->type != type)
continue;
if (f->match == FT_RANGE)
{
if (idl < f->num || idl > f->num2)
return 0;
}
else if (f->num < idl || f->num > idh)
return 0;
}
return 1;

31
main.c
View File

@ -43,8 +43,12 @@ syntax()
" -E<event id> Show only selected event.\n"
" -R<SCRID> Show only events with this Series ID.\n"
" -S<service id> Show only selected service.\n"
);
fprintf(stderr,
" -T<content type> Show only selected content types.\n"
" -@<unix timestamp> Show only programmes at time.\n"
" -/<unix timestamp> Show only programmes on day.\n"
" -/<days> Show only programmes on day.\n"
"\n"
);
fprintf(stderr,
@ -126,7 +130,7 @@ sqldumpstart()
printf("(\n");
printf("service_id bigint unsigned not null default 0,\n");
printf("event_id bigint unsigned not null default 0,\n");
printf("start datetime not null,\n");
printf("start bigint unsigned not null,\n");
printf("duration bigint unsigned not null,\n");
printf("name varchar(255),\n");
printf("text varchar(255),\n");
@ -138,6 +142,7 @@ sqldumpstart()
printf("rec_crid varchar(255),\n");
printf("primary key (service_id, event_id),\n");
printf("index name (name),\n");
printf("index start (start),\n");
printf("index text (text)\n");
printf(") engine=innodb;\n");
printf("truncate epg;\n");
@ -525,6 +530,30 @@ main(int argc, char **argv)
atoi(cp), 0, NULL, FT_EQUAL);
goto nextopt;
case '/':
{
unsigned long dstart, dend, dat;
struct tm *tm;
GETOPT;
dat = atoi(cp);
/* If specified as number of days, then convert
* to timestamp. */
if (dat < 1000)
dat = (unsigned long)time(NULL) +
dat * 86400;
tm = localtime((time_t *)&dat);
tm->tm_hour = tm->tm_min = tm->tm_sec = 0;
dstart = mktime(tm);
tm->tm_hour = 23;
tm->tm_min = tm->tm_sec = 59;
dend = mktime(tm);
add_epgfilter(&filter, FILTER_TIMESTAMP,
dstart, dend, NULL, FT_RANGE);
goto nextopt;
}
case 'C':
GETOPT;
add_epgfilter(&filter, FILTER_CRID,