57 lines
925 B
C
57 lines
925 B
C
/*
|
|
* Humax EPG Tool
|
|
* by af123, 2011
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <unistd.h>
|
|
#include <time.h>
|
|
#include <strings.h>
|
|
#include <sqlite3.h>
|
|
|
|
#include "lint.h"
|
|
|
|
int
|
|
channel(void *arg, int cols, char **columns, char **colnames)
|
|
{
|
|
printf("%s: %s (%s)\n", columns[0], columns[1], columns[2]);
|
|
return 0;
|
|
}
|
|
|
|
void
|
|
read_channels()
|
|
{
|
|
sqlite3 *db;
|
|
char *error;
|
|
|
|
sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
|
|
|
|
printf("Opening.\n");
|
|
if (sqlite3_open_v2("/var/lib/humaxtv/channel.db", &db,
|
|
SQLITE_OPEN_READONLY | SQLITE_OPEN_PRIVATECACHE, NULL) != SQLITE_OK)
|
|
return;
|
|
|
|
printf("Opened.\n");
|
|
|
|
if (sqlite3_exec(db,
|
|
"select usSvcId, usLcn, szSvcName from TBL_SVC "
|
|
"order by usLcn", channel, NULL, &error) != SQLITE_OK)
|
|
{
|
|
printf("ERROR: %s\n", error);
|
|
sqlite3_free(error);
|
|
}
|
|
|
|
sqlite3_close(db);
|
|
}
|
|
|
|
int
|
|
main()
|
|
{
|
|
read_channels();
|
|
}
|
|
|