From e195725a31d06049cf66c6c93136ea12f0c32c32 Mon Sep 17 00:00:00 2001
From: etherware-novice <73374039+etherware-novice@users.noreply.github.com>
Date: Sat, 10 Aug 2024 22:13:57 -0500
Subject: [PATCH] makes it internet radio instead!
---
_includes/mplayer.html | 36 ++++++++++++++++++++++++------------
_layouts/default.html | 1 -
assets/js/icystream.js | 24 ++++++++++++++++++++++++
3 files changed, 48 insertions(+), 13 deletions(-)
create mode 100644 assets/js/icystream.js
diff --git a/_includes/mplayer.html b/_includes/mplayer.html
index 72fb157..ac677f1 100644
--- a/_includes/mplayer.html
+++ b/_includes/mplayer.html
@@ -1,19 +1,31 @@
-
+
+
diff --git a/_layouts/default.html b/_layouts/default.html
index 50fe00d..a1aab85 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -8,7 +8,6 @@ navbar: topnav
{{ page.title }}
-
diff --git a/assets/js/icystream.js b/assets/js/icystream.js
new file mode 100644
index 0000000..696a91f
--- /dev/null
+++ b/assets/js/icystream.js
@@ -0,0 +1,24 @@
+async function readConstant(readableStream) {
+ const reader = readableStream.getReader();
+ const re = /StreamTitle='(.*)'/;
+
+ while (true) {
+ const { done, value } = await reader.read();
+ if (done) {break;}
+
+ let cur = new TextDecoder("utf-8").decode(value);
+ var fin = re.exec(cur);
+ if (!fin) { continue; }
+
+ fin = fin[1].split('\'')[0];
+ document.getElementById("player-text").innerHTML = fin;
+ }
+}
+
+
+var opts = { headers: {} };
+opts["headers"]["Icy-Metadata"] = "1";
+// we're using the 64kbps version to save a bit of bandwidth
+let mustr = fetch("https://radio.erb.pw/listen/subspace/radio-64.mp3", opts)
+mustr.then((res) => { readConstant(res.body);})
+