From: Jaroslav Kysela Date: Wed, 6 May 2015 20:01:24 +0000 (+0200) Subject: SAT>IP Client: add 'discover SAT>IP servers' button to the main config X-Git-Tag: v4.1~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00d792a6b3740309a739200218495d4db54122dc;p=thirdparty%2Ftvheadend.git SAT>IP Client: add 'discover SAT>IP servers' button to the main config --- diff --git a/src/api/api_input.c b/src/api/api_input.c index a892c4b54..f731154b6 100644 --- a/src/api/api_input.c +++ b/src/api/api_input.c @@ -36,10 +36,33 @@ api_input_hw_tree ( void ) return is; } +#if ENABLE_SATIP_CLIENT +static int +api_input_satip_discover + ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp ) +{ + int err = 0; + + if (strcmp(op, "all")) + return -EINVAL; + + tvhinfo("satip", "Triggered new server discovery"); + + pthread_mutex_lock(&global_lock); + satip_device_discovery_start(); + pthread_mutex_unlock(&global_lock); + + return err; +} +#endif + void api_input_init ( void ) { static api_hook_t ah[] = { { "hardware/tree", ACCESS_ADMIN, api_idnode_tree, api_input_hw_tree }, +#if ENABLE_SATIP_CLIENT + { "hardware/satip/discover", ACCESS_ADMIN, api_input_satip_discover, NULL }, +#endif { NULL }, }; diff --git a/src/input/mpegts/satip/satip.c b/src/input/mpegts/satip/satip.c index d4454a59b..7e67c789e 100644 --- a/src/input/mpegts/satip/satip.c +++ b/src/input/mpegts/satip/satip.c @@ -35,8 +35,6 @@ #include #endif -static void satip_device_discovery_start( void ); - /* * */ @@ -1114,7 +1112,7 @@ satip_discovery_timer_cb(void *aux) gtimer_arm(&satip_discovery_timer, satip_discovery_timer_cb, NULL, 3600); } -static void +void satip_device_discovery_start( void ) { gtimer_arm(&satip_discovery_timer, satip_discovery_timer_cb, NULL, 1); diff --git a/src/input/mpegts/satip/satip.h b/src/input/mpegts/satip/satip.h index 59d035ebf..538ac476e 100644 --- a/src/input/mpegts/satip/satip.h +++ b/src/input/mpegts/satip/satip.h @@ -20,6 +20,8 @@ #ifndef __TVH_SATIP_H__ #define __TVH_SATIP_H__ +void satip_device_discovery_start( void ); + void satip_init( str_list_t *clients ); void satip_done( void ); diff --git a/src/main.c b/src/main.c index 48d27a7e2..ea3b83c6e 100644 --- a/src/main.c +++ b/src/main.c @@ -145,6 +145,9 @@ const tvh_caps_t tvheadend_capabilities[] = { #if ENABLE_V4L || ENABLE_LINUXDVB || ENABLE_SATIP_CLIENT || ENABLE_HDHOMERUN_CLIENT { "tvadapters", NULL }, #endif +#if ENABLE_SATIP_CLIENT + { "satip_client", NULL }, +#endif #if ENABLE_SATIP_SERVER { "satip_server", NULL }, #endif diff --git a/src/webui/static/app/config.js b/src/webui/static/app/config.js index 03adc0536..af0fa769e 100644 --- a/src/webui/static/app/config.js +++ b/src/webui/static/app/config.js @@ -302,6 +302,18 @@ tvheadend.miscconf = function(panel, index) { handler: cleanImagecache }); + if (tvheadend.capabilities.indexOf('satip_client') !== -1) { + var satipButton = new Ext.Button({ + text: "Discover SAT>IP servers", + tooltip: 'Look for new SAT>IP servers', + iconCls: 'find', + handler: satipDiscover, + }); + } else { + var satipButton = null; + } + + var helpButton = new Ext.Button({ text: 'Help', iconCls: 'help', @@ -332,6 +344,14 @@ tvheadend.miscconf = function(panel, index) { if (imagecache_form) _items.push(imagecache_form); + var _tbar = [saveButton, '-', imagecacheButton]; + if (satipButton) { + _tbar.push('-'); + _tbar.push(satipButton); + } + _tbar.push('->'); + _tbar.push(helpButton); + var mpanel = new Ext.Panel({ title: 'General', iconCls: 'general', @@ -340,7 +360,7 @@ tvheadend.miscconf = function(panel, index) { bodyStyle: 'padding:15px', layout: 'form', items: _items, - tbar: [saveButton, '-', imagecacheButton, '->', helpButton] + tbar: _tbar, }); tvheadend.paneladd(panel, mpanel, index); @@ -400,4 +420,11 @@ tvheadend.miscconf = function(panel, index) { function cleanImagecache() { saveChangesImagecache({'clean': 1}); } + + function satipDiscover() { + Ext.Ajax.request({ + url: 'api/hardware/satip/discover', + params: { op: 'all' }, + }); + } };