diff --git a/src/epggrab.h b/src/epggrab.h index 17ea2075..3617ba19 100644 --- a/src/epggrab.h +++ b/src/epggrab.h @@ -292,6 +292,7 @@ int epggrab_enable_module_by_id ( const char *id, uint8_t e ); int epggrab_ota_set_cron ( const char *cron, int lock ); int epggrab_ota_set_timeout ( uint32_t e ); int epggrab_ota_set_initial ( uint32_t e ); +void epggrab_ota_trigger ( int secs ); /* * Load/Save diff --git a/src/epggrab/otamux.c b/src/epggrab/otamux.c index 3caacff0..fabb33b3 100644 --- a/src/epggrab/otamux.c +++ b/src/epggrab/otamux.c @@ -812,6 +812,16 @@ epggrab_ota_init ( void ) } } +void +epggrab_ota_trigger ( int secs ) +{ + /* notify another system layers, that we will do EPG OTA */ + secs = MIN(1, MAX(secs, 7*24*3600)); + dbus_emit_signal_s64("/epggrab/ota", "next", time(NULL) + secs); + epggrab_ota_pending_flag = 1; + epggrab_ota_kick(secs); +} + void epggrab_ota_post ( void ) { @@ -819,10 +829,7 @@ epggrab_ota_post ( void ) /* Init timer (call after full init - wait for network tuners) */ if (epggrab_ota_initial) { - /* notify another system layers, that we will do EPG OTA */ - dbus_emit_signal_s64("/epggrab/ota", "next", time(NULL) + 15); - epggrab_ota_pending_flag = 1; - epggrab_ota_kick(15); + epggrab_ota_trigger(15); t = time(NULL); } diff --git a/src/webui/extjs.c b/src/webui/extjs.c index 736cd386..cfe29c73 100755 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -381,6 +381,19 @@ extjs_epggrab(http_connection_t *hc, const char *remain, void *opaque) out = htsmsg_create_map(); htsmsg_add_u32(out, "success", 1); + /* OTA EPG trigger */ + } else if (!strcmp(op, "otaepgTrigger") ) { + + str = http_arg_get(&hc->hc_req_args, "after"); + if (!str) + return HTTP_STATUS_BAD_REQUEST; + + pthread_mutex_lock(&global_lock); + epggrab_ota_trigger(atoi(str)); + pthread_mutex_unlock(&global_lock); + out = htsmsg_create_map(); + htsmsg_add_u32(out, "success", 1); + } else { return HTTP_STATUS_BAD_REQUEST; } diff --git a/src/webui/static/app/config.js b/src/webui/static/app/config.js index ab6b44ef..7f92254e 100644 --- a/src/webui/static/app/config.js +++ b/src/webui/static/app/config.js @@ -236,7 +236,7 @@ tvheadend.miscconf = function(panel, index) { var helpButton = new Ext.Button({ text: 'Help', - iconCls: 'help', + iconCls: 'help', handler: function() { new tvheadend.help('General Configuration', 'config_misc.html'); } diff --git a/src/webui/static/app/epggrab.js b/src/webui/static/app/epggrab.js index 4f3d191a..a9255b78 100644 --- a/src/webui/static/app/epggrab.js +++ b/src/webui/static/app/epggrab.js @@ -4,8 +4,7 @@ tvheadend.epggrabChannels = new Ext.data.JsonStore({ baseParams: { op: 'channelList' }, - fields: ['id', 'mod', 'name', 'icon', 'number', 'channel', 'mod-id', - 'mod-name'] + fields: ['id', 'mod', 'name', 'icon', 'number', 'channel', 'mod-id', 'mod-name'] }); tvheadend.epggrab = function(panel, index) { @@ -296,6 +295,13 @@ tvheadend.epggrab = function(panel, index) { handler: saveChanges }); + var otaepgButton = new Ext.Button({ + text: "Trigger OTA EPG Grabber", + tooltip: 'Tune over-the-air EPG muxes to grab new events now', + iconCls: 'find', + handler: otaepgTrigger + }); + var helpButton = new Ext.Button({ text: 'Help', iconCls: 'help', @@ -317,7 +323,7 @@ tvheadend.epggrab = function(panel, index) { defaultType: 'textfield', autoHeight: true, items: [simplePanel, internalPanel, otaPanel, externalPanel], - tbar: [saveButton, '->', helpButton] + tbar: [saveButton, otaepgButton, '->', helpButton] }); /* **************************************************************** @@ -395,5 +401,19 @@ tvheadend.epggrab = function(panel, index) { }); } + function otaepgTrigger() { + Ext.Ajax.request({ + url: 'epggrab', + params: { + op: 'otaepgTrigger', + after: 1, + }, + waitMsg: 'Triggering...', + failure: function(response, options) { + Ext.Msg.alert('Trigger failed', response.statusText); + } + }); + } + tvheadend.paneladd(panel, confpanel, index); };