Update cron to use u64 config and add error output on pyepg xml parse error.

This commit is contained in:
Adam Sutton 2012-05-23 16:26:00 +01:00
parent dc58e97ec9
commit bc10bb4a00
2 changed files with 8 additions and 7 deletions

View file

@ -23,8 +23,7 @@ int cron_is_time ( cron_t *cron )
void cron_pack ( cron_t *cron, htsmsg_t *msg )
{
htsmsg_add_u32(msg, "min0", cron->min & 0xFFFFFFFF);
htsmsg_add_u32(msg, "min1", cron->min >> 32);
htsmsg_add_u64(msg, "min", cron->min);
htsmsg_add_u32(msg, "hour", cron->hour);
htsmsg_add_u32(msg, "dom", cron->dom);
htsmsg_add_u32(msg, "mon", cron->mon);
@ -34,10 +33,7 @@ void cron_pack ( cron_t *cron, htsmsg_t *msg )
void cron_unpack ( cron_t *cron, htsmsg_t *msg )
{
uint32_t u32 = 0;
htsmsg_get_u32(msg, "min0", &u32);
cron->min = u32;
htsmsg_get_u32(msg, "min1", &u32);
cron->min += ((uint64_t)u32 << 32);
htsmsg_get_u64(msg, "min", &cron->min);
htsmsg_get_u32(msg, "hour", &cron->hour);
htsmsg_get_u32(msg, "dom", &cron->dom);
htsmsg_get_u32(msg, "mon", &u32);

View file

@ -364,6 +364,7 @@ static htsmsg_t* _pyepg_grab ( const char *iopts )
const char *argv[32]; // 32 args max!
char *toksave, *tok;
char *opts = NULL;
htsmsg_t *ret;
/* TODO: do something (much) better! */
if (iopts) opts = strdup(iopts);
@ -382,6 +383,7 @@ static htsmsg_t* _pyepg_grab ( const char *iopts )
tvhlog(LOG_DEBUG, "pyepg", "grab %s %s", argv[0], iopts ? iopts : "");
/* Grab */
// TODO: HACK: use static input
outlen = spawn_and_store_stdout(argv[0], (char *const*)argv, &outbuf);
free(opts);
if ( outlen < 1 ) {
@ -390,7 +392,10 @@ static htsmsg_t* _pyepg_grab ( const char *iopts )
}
/* Extract */
return htsmsg_xml_deserialize(outbuf, errbuf, sizeof(errbuf));
ret = htsmsg_xml_deserialize(outbuf, errbuf, sizeof(errbuf));
if (!ret)
tvhlog(LOG_ERR, "pyepg", "htsmsg_xml_deserialize error %s", errbuf);
return ret;
}
epggrab_module_t* pyepg_init ( void )