epggrab: ota - add trigger button to webui

This commit is contained in:
Jaroslav Kysela 2015-01-21 20:56:22 +01:00
parent 1377fad8a0
commit 3077ffa4d3
5 changed files with 49 additions and 8 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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');
}

View file

@ -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);
};