From 4b7ffc058fc1a8222d60fb43b265a79aa40a65e4 Mon Sep 17 00:00:00 2001 From: andyb2000 Date: Thu, 7 Mar 2013 21:35:15 +0000 Subject: [PATCH] Changed gui parameter to take a numeric value which is the number of hours to write data to disk --- docs/html/config_epggrab.html | 7 ++++--- src/epgdb.c | 4 ++-- src/webui/extjs.c | 4 ++-- src/webui/static/app/epggrab.js | 14 ++++++++++---- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/html/config_epggrab.html b/docs/html/config_epggrab.html index 822348fa..7fbb33c2 100644 --- a/docs/html/config_epggrab.html +++ b/docs/html/config_epggrab.html @@ -61,11 +61,12 @@
Update channel name
Automatically update channel icons using information provided by the enabled EPG providers. -
Periodic save EPG to disk -
Writes the current in-memory EPG database to disk every 8 Hours - when checked, so should a crash/unexpected shutdown occur EPG +
Periodic save EPG to disk Interval +
Writes the current in-memory EPG database to disk every x Hours + (user defined), so should a crash/unexpected shutdown occur EPG data is saved periodically to the database (Re-read on next startup) + Set to 0 to disable.

Internal Grabber

diff --git a/src/epgdb.c b/src/epgdb.c index 71a3ff26..bb61fbc1 100644 --- a/src/epgdb.c +++ b/src/epgdb.c @@ -148,14 +148,14 @@ static void *_epgdbsave_thread ( void *p ) ts.tv_nsec = 0; tvhlog(LOG_DEBUG, "epgdb", "epgdbsave setting: %i", epggrab_epgdb_periodicsave); while (1) { - if (epggrab_epgdb_periodicsave) { + if (epggrab_epgdb_periodicsave != 0) { tvhlog(LOG_DEBUG, "epgdb", "epgdbsave setting: %i", epggrab_epgdb_periodicsave); epg_save(); }; pthread_mutex_lock(&epgdbsave_mutex); time(&ts.tv_sec); - ts.tv_sec += 28800; /* Every 8 hours */ + ts.tv_sec += epggrab_epgdb_periodicsave * 3600; /* User defined in hours */ pthread_cond_timedwait(&_epgdbsave_cond, &epgdbsave_mutex, &ts); pthread_mutex_unlock(&epgdbsave_mutex); }; diff --git a/src/webui/extjs.c b/src/webui/extjs.c index 9546ef7b..07673914 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -620,8 +620,8 @@ extjs_epggrab(http_connection_t *hc, const char *remain, void *opaque) save |= epggrab_set_channel_renumber(str ? 1 : 0); str = http_arg_get(&hc->hc_req_args, "channel_reicon"); save |= epggrab_set_channel_reicon(str ? 1 : 0); - str = http_arg_get(&hc->hc_req_args, "epgdb_periodicsave"); - save |= epggrab_set_periodicsave(str ? 1 : 0); + if ( (str = http_arg_get(&hc->hc_req_args, "epgdb_periodicsave")) ) + save |= epggrab_set_periodicsave(atoi(str)); if ( (str = http_arg_get(&hc->hc_req_args, "interval")) ) save |= epggrab_set_interval(atoi(str)); if ( (str = http_arg_get(&hc->hc_req_args, "module")) ) diff --git a/src/webui/static/app/epggrab.js b/src/webui/static/app/epggrab.js index af18c6df..e8fc3738 100644 --- a/src/webui/static/app/epggrab.js +++ b/src/webui/static/app/epggrab.js @@ -184,10 +184,16 @@ tvheadend.epggrab = function() { fieldLabel : 'Update channel icon' }); - var epgPeriodicSave = new Ext.form.Checkbox({ - name : 'epgdb_periodicsave', - fieldLabel : 'Periodic save EPG to disk' - }); + var epgPeriodicSave = new Ext.form.NumberField({ + width : 30, + allowNegative : false, + allowDecimals : false, + minValue : 0, + maxValue : 24, + value : 0, + fieldLabel : 'Periodic save EPG to disk', + name : 'epgdb_periodicsave', + }); /* * Simple fields