Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix epggrab periodic save and timeshift max_period handling (regressi…
…on idnode rewrite), fixes #3149
  • Loading branch information
perexg committed Oct 12, 2015
1 parent 5c8a775 commit 871798d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
25 changes: 24 additions & 1 deletion src/config.c
Expand Up @@ -1323,6 +1323,28 @@ config_migrate_v21 ( void )
}
}

/*
* v21 -> v22 : epggrab missing changes
*/
static void
config_migrate_v22 ( void )
{
htsmsg_t *c;
uint32_t u32;

if ((c = hts_settings_load("epggrab/config")) != NULL) {
if (htsmsg_get_u32(c, "epgdb_periodicsave", &u32) == 0)
htsmsg_set_u32(c, "epgdb_periodicsave", (u32 + 3600 - 1) / 3600);
hts_settings_save(c, "epggrab/config");
htsmsg_destroy(c);
}
if ((c = hts_settings_load("timeshift/config")) != NULL) {
if (htsmsg_get_u32(c, "max_period", &u32) == 0)
htsmsg_set_u32(c, "max_period", (u32 + 60 - 1) / 60);
hts_settings_save(c, "timeshift/config");
htsmsg_destroy(c);
}
}



Expand Down Expand Up @@ -1443,7 +1465,8 @@ static const config_migrate_t config_migrate_table[] = {
config_migrate_v18,
config_migrate_v19,
config_migrate_v20,
config_migrate_v21
config_migrate_v21,
config_migrate_v22
};

/*
Expand Down
2 changes: 1 addition & 1 deletion src/epgdb.c
Expand Up @@ -334,7 +334,7 @@ void epg_save ( void )

if (epggrab_conf.epgdb_periodicsave)
gtimer_arm(&epggrab_save_timer, epg_save_callback, NULL,
epggrab_conf.epgdb_periodicsave);
epggrab_conf.epgdb_periodicsave * 3600);

memset(&stats, 0, sizeof(stats));
if ( _epg_write_sect(sb, "config") ) goto error;
Expand Down
2 changes: 1 addition & 1 deletion src/htsp_server.c
Expand Up @@ -2083,7 +2083,7 @@ htsp_method_subscribe(htsp_connection_t *htsp, htsmsg_t *in)
if (timeshift_conf.enabled) {
timeshiftPeriod = htsmsg_get_u32_or_default(in, "timeshiftPeriod", 0);
if (!timeshift_conf.unlimited_period)
timeshiftPeriod = MIN(timeshiftPeriod, timeshift_conf.max_period);
timeshiftPeriod = MIN(timeshiftPeriod, timeshift_conf.max_period * 60);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/timeshift.c
Expand Up @@ -58,7 +58,7 @@ void timeshift_init ( void )
/* Defaults */
memset(&timeshift_conf, 0, sizeof(timeshift_conf));
timeshift_conf.idnode.in_class = &timeshift_conf_class;
timeshift_conf.max_period = 3600; // 1Hr
timeshift_conf.max_period = 60; // Hr (60mins)
timeshift_conf.max_size = 10000 * (size_t)1048576; // 10G

/* Load settings */
Expand Down

0 comments on commit 871798d

Please sign in to comment.