]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
api/webui: show hbbtv info in the service info dialog
authorJaroslav Kysela <perex@perex.cz>
Mon, 22 May 2017 11:53:12 +0000 (13:53 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 22 May 2017 11:53:12 +0000 (13:53 +0200)
src/api/api_service.c
src/webui/static/app/mpegts.js

index 9ad85512658c7de03c14c92efb9b544440c54d7f..d2d730e3ed1a5ba507c18b38934af4fcfbdf986b 100644 (file)
@@ -112,7 +112,7 @@ api_service_streams
   ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
 {
   const char *uuid;
-  htsmsg_t *e, *st, *stf;
+  htsmsg_t *e, *st, *stf, *hbbtv = NULL;
   service_t *s;
   elementary_stream_t *es;
 
@@ -153,9 +153,14 @@ api_service_streams
     htsmsg_add_msg(stf, NULL, api_service_streams_get_one(es, 1));
   *resp = htsmsg_create_map();
   htsmsg_add_str(*resp, "name", s->s_nicename);
+  if (s->s_hbbtv)
+    hbbtv = htsmsg_copy(s->s_hbbtv);
+  pthread_mutex_unlock(&s->s_stream_mutex);
+
   htsmsg_add_msg(*resp, "streams", st);
   htsmsg_add_msg(*resp, "fstreams", stf);
-  pthread_mutex_unlock(&s->s_stream_mutex);
+  if (hbbtv)
+    htsmsg_add_msg(*resp, "hbbtv", hbbtv);
 
   /* Done */
   pthread_mutex_unlock(&global_lock);
index 51d4d0e821bda27523a9d3d295eeffd687f15591..6e827826c93e52f9bab7e9144852d80f3daf89df 100644 (file)
@@ -159,7 +159,7 @@ tvheadend.show_service_streams = function(data) {
         return r;
     }
 
-    function header( ) {
+    function header() {
         html += '<table style="font-size:8pt;font-family:monospace;padding:2px"';
         html += '<tr>';
         html += '<th style="width:50px;font-weight:bold">' + _('Index') + '</th>';
@@ -171,6 +171,10 @@ tvheadend.show_service_streams = function(data) {
 
     }
 
+    function footer() {
+        html += '</table>';
+    }
+
     function single(s) {
         html += '<tr><td colspan="5">' + s + '</td></tr>';
     }
@@ -198,22 +202,49 @@ tvheadend.show_service_streams = function(data) {
     }
 
     header();
-
     if (data.streams.length) {
         for (i = 0; i < data.streams.length; i++)
             stream(data.streams[i]);
     } else
         single(_('None'));
+    footer();
 
-    single('&nbsp;');
     single('<h3>' + _('After filtering and reordering (without PCR and PMT)') + '</h3>');
-    header();
 
+    header();
     if (data.fstreams.length)
         for (i = 0; i < data.fstreams.length; i++)
             stream(data.fstreams[i]);
     else
-        single('<p>' + _('None') + '</p>');
+        single(_('None'));
+    footer();
+
+    if (data.hbbtv) {
+        html += '<h3>' + _('HbbTv') + '</h3>';
+        html += '<table style="font-size:8pt;font-family:monospace;padding:2px"';
+        html += '<tr>';
+        html += '<th style="width:50px;font-weight:bold">' + _('Section') + '</th>';
+        html += '<th style="width:50px;font-weight:bold">' + _('Language') + '</th>';
+        html += '<th style="width:200px;font-weight:bold">' + _('Name') + '</th>';
+        html += '<th style="width:310px;font-weight:bold">' + _('Link') + '</th>';
+        html += '</tr>';
+        for (var sect in data.hbbtv) {
+            for (var appidx in data.hbbtv[sect]) {
+                var app = data.hbbtv[sect][appidx];
+                if (!app.title) continue;
+                for (var titleidx = 0; titleidx < app.title.length; titleidx++) {
+                    var title = app.title[titleidx];
+                    html += '<tr>';
+                    html += '<td>' + sect + '</td>';
+                    html += '<td>' + title.lang + '</td>';
+                    html += '<td>' + title.name + '</td>';
+                    html += '<td><a href="' + app.url + '" target="_blank">' + app.url + '</td>';
+                    html += '</tr>';
+                }
+            }
+        }
+        html += '</table>';
+    }
 
     var win = new Ext.Window({
         title: _('Service details for') + ' ' + data.name,