]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epggrab: ota - add trigger button to webui
authorJaroslav Kysela <perex@perex.cz>
Wed, 21 Jan 2015 19:56:22 +0000 (20:56 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 21 Jan 2015 19:56:22 +0000 (20:56 +0100)
src/epggrab.h
src/epggrab/otamux.c
src/webui/extjs.c
src/webui/static/app/config.js
src/webui/static/app/epggrab.js

index 17ea20753ccfb7df8c18c26115eb79446e11e791..3617ba19e2b42f43d008f527770381a73db531ee 100644 (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
index 3caacff005e72413af513df2c1c65f9111eec3d2..fabb33b3611462e616f1e02b4ab6f5854a9bb3a7 100644 (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);
   }
 
index 736cd386a4eb34356eea3f9603137fa0b3a923ed..cfe29c73a8208184c8f12cd57d292b2462548298 100755 (executable)
@@ -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;
   }
index ab6b44ef14f1e3841e83c0adc78ed5bceec708f3..7f92254e03f7321a6d5fded51331a7ef7677f5f1 100644 (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');
         }
index 4f3d191a4aa378a7dc4328557159b0e220ba7bfd..a9255b785b56a7a7226f48f7264412c17284cd86 100644 (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);
 };