Skip to content

Commit

Permalink
Insert link to stream url on web terminal when -M metadata is active
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbod committed Jan 6, 2019
1 parent b99c72a commit 16dee87
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
13 changes: 13 additions & 0 deletions README-rpi3-liquidsoap
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ sudo apt-get install liquidsoap liquidsoap-plugin-all
---------------------
sudo apt-get install pulseaudio pulseaudio-utils

5. Install Icecase (optional)
-----------------------------
sudo apt-get install icecast2
Follow prompts and set up appropriate passwords
Edit /etc/icecast/icecast.xml and define your mount point(s):
sudo vi /etc/icecast2/icecast.xml
<!-- You may have multiple <listener> elements -->
<listen-socket>
<port>8000</port>
<shoutcast-mount>/op25</shoutcast-mount>
</listen-socket>


5. Configure op25
-----------------
Set up rx.py command line options, trunk.tsv, meta.json and other files necessary to
Expand Down
8 changes: 8 additions & 0 deletions op25/gr-op25_repeater/apps/rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def __init__(self, options):
self.target_freq = 0.0
self.last_freq_params = {'freq' : 0.0, 'tgid' : None, 'tag' : "", 'tdma' : None}
self.meta_server = None
self.stream_url = ""

self.src = None
if (not options.input) and (not options.audio) and (not options.audio_if):
Expand Down Expand Up @@ -204,6 +205,12 @@ def __init__(self, options):
if self.options.metacfg is not None:
from icemeta import meta_server
self.meta_server = meta_server(self.meta_q, self.options.metacfg)
try:
with open(self.options.metacfg) as json_file:
meta_cfg = json.load(json_file)
self.stream_url = "http://" + meta_cfg['icecastServerAddress'] + "/" + meta_cfg['icecastMountpoint'] + ".xspf"
except (ValueError, KeyError):
sys.stderr.write("%f rx.py: Error reading metadata config file: %s\n" % (time.time(), self.options.metacfg))
else:
self.meta_server = None

Expand Down Expand Up @@ -390,6 +397,7 @@ def freq_update(self):
params = self.last_freq_params
params['json_type'] = 'change_freq'
params['fine_tune'] = self.options.fine_tune
params['stream_url'] = self.stream_url
js = json.dumps(params)
msg = gr.message().make_from_string(js, -4, 0, 0)
self.input_q.insert_tail(msg)
Expand Down
23 changes: 15 additions & 8 deletions op25/gr-op25_repeater/www/www-static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,46 +160,53 @@ function change_freq(d) {
c_system = d['system'];
current_tgid = d['tgid'];
c_tag = d['tag'];
c_stream_url = d['stream_url'];
channel_status();
}

function channel_status() {
var html
var html;
var s2_freq = document.getElementById("s2_freq");
var s2_tg = document.getElementById("s2_tg");
var s2_grp = document.getElementById("s2_grp");
var s2_src = document.getElementById("s2_src");

html = ""
html = "";
if (c_stream_url != "") {
html += "<a href=\"" + c_stream_url + "\">";
}
if (c_freq != 0) {
html += "<span class=\"value\">" + c_freq / 1000000.0 + "</span>";
}
if (c_system != null)
{
html += "<span class=\"value\"> &nbsp;" + c_system + "</span>";
}
if (c_stream_url != "") {
html += "</a>"
}
s2_freq.innerHTML = html

html = ""
html = "";
if (current_tgid != null) {
html += "<span class=\"value\">" + c_tag + "</span>";
if (c_encrypted) {
html += "<span class=\"label\">[ENCRYPTED]</span>";
}
}
s2_tg.innerHTML = html
s2_tg.innerHTML = html;

html = ""
html = "";
if (current_tgid != null)
html += "<span class=\"value\">" + current_tgid + "</span>";
else if (c_grpaddr != 0)
html += "<span class=\"value\">" + c_grpaddr + "</span>";
s2_grp.innerHTML = html
s2_grp.innerHTML = html;

html = ""
html = "";
if ((c_srcaddr != 0) && (c_srcaddr != 0xffffff))
html += "<span class=\"value\">" + c_srcaddr + "</span>";
s2_src.innerHTML = html
s2_src.innerHTML = html;
}

// adjacent sites table
Expand Down

0 comments on commit 16dee87

Please sign in to comment.