From f33dfda0055957a3c0199cc4b8afdcd8dec1b4f8 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Wed, 24 Jan 2024 23:01:51 +0100 Subject: [PATCH] first implementation of a station dropdown --- csdr/chain/dablin.py | 5 ++++- htdocs/index.html | 1 + htdocs/lib/MetaPanel.js | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/csdr/chain/dablin.py b/csdr/chain/dablin.py index 80e79a70..d451a248 100644 --- a/csdr/chain/dablin.py +++ b/csdr/chain/dablin.py @@ -40,7 +40,10 @@ class MetaProcessor(PickleModule): if "programmes" in data: result["programmes"] = data["programmes"] # don't send out data if there was nothing interesting for the client - return result if result else None + if not result: + return + result["mode"] = "DAB" + return result class Dablin(BaseDemodulatorChain, FixedIfSampleRateChain, FixedAudioRateChain, HdAudio, MetaProvider): diff --git a/htdocs/index.html b/htdocs/index.html index fe0e2aeb..921be5a4 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -150,6 +150,7 @@ +
diff --git a/htdocs/lib/MetaPanel.js b/htdocs/lib/MetaPanel.js index 7b83ecee..e84a29d3 100644 --- a/htdocs/lib/MetaPanel.js +++ b/htdocs/lib/MetaPanel.js @@ -550,6 +550,39 @@ WfmMetaPanel.prototype.clear = function() { this.radiotext_plus = false; }; +function DabMetaPanel(el) { + MetaPanel.call(this, el); + this.modes = ['DAB']; + $(this.el).html( + '' + ) + this.clear(); +} + +DabMetaPanel.prototype = new MetaPanel(); + +DabMetaPanel.prototype.isSupported = function(data) { + return this.modes.includes(data.mode); +} + + +DabMetaPanel.prototype.update = function(data) { + if (!this.isSupported(data)) return; + + if ('programmes' in data) { + var options = Object.entries(data.programmes).map(function(e) { + return ''; + }); + $(this.el).find('#dab-service-id').html(options.join('')); + } + + console.info(data); +} + +DabMetaPanel.prototype.clear = function() { + +} + MetaPanel.types = { dmr: DmrMetaPanel, ysf: YsfMetaPanel, @@ -557,6 +590,7 @@ MetaPanel.types = { nxdn: NxdnMetaPanel, m17: M17MetaPanel, wfm: WfmMetaPanel, + dab: DabMetaPanel, }; $.fn.metaPanel = function() {