]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
SAT>IP Client: add 'discover SAT>IP servers' button to the main config
authorJaroslav Kysela <perex@perex.cz>
Wed, 6 May 2015 20:01:24 +0000 (22:01 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 6 May 2015 20:01:24 +0000 (22:01 +0200)
src/api/api_input.c
src/input/mpegts/satip/satip.c
src/input/mpegts/satip/satip.h
src/main.c
src/webui/static/app/config.js

index a892c4b5497b97e2a62545a29deb180722d76465..f731154b66b6a0f3dd8c762a55dee56667d849fc 100644 (file)
@@ -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 },
   };
 
index d4454a59b43b6a42dd9f6bb76269389877c56bae..7e67c789eec6c7cd0416f7a71068ea46e698925a 100644 (file)
@@ -35,8 +35,6 @@
 #include <sys/socket.h>
 #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);
index 59d035ebf40c8a7a497e75ea4ca8a568673b411d..538ac476e8887fdb43a783117b742471a56f0fb5 100644 (file)
@@ -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 );
 
index 48d27a7e2e511944729c37747c843238d17a5ec5..ea3b83c6ed398c327332a63643c58ea6154900c3 100644 (file)
@@ -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
index 03adc0536603f77d049f3217259e5a8c88af0629..af0fa769efdfff5fdba10f8703d36d045e18e2ac 100644 (file)
@@ -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' },
+        });
+    }
 };