summaryrefslogtreecommitdiffstats
path: root/radio/radio.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-03-17 21:08:58 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-03-17 21:08:58 +0100
commit8708bd0fe27077115de254e71b51e7192ff58f74 (patch)
treef07622077d548ec045853b55098e537dea188d83 /radio/radio.php
parentfixes on z for radio -- now works (diff)
downloadtravnik-8708bd0fe27077115de254e71b51e7192ff58f74.tar
travnik-8708bd0fe27077115de254e71b51e7192ff58f74.tar.gz
travnik-8708bd0fe27077115de254e71b51e7192ff58f74.tar.bz2
travnik-8708bd0fe27077115de254e71b51e7192ff58f74.tar.lz
travnik-8708bd0fe27077115de254e71b51e7192ff58f74.tar.xz
travnik-8708bd0fe27077115de254e71b51e7192ff58f74.tar.zst
travnik-8708bd0fe27077115de254e71b51e7192ff58f74.zip
Diffstat (limited to 'radio/radio.php')
-rw-r--r--radio/radio.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/radio/radio.php b/radio/radio.php
new file mode 100644
index 0000000..4c8bf3f
--- /dev/null
+++ b/radio/radio.php
@@ -0,0 +1,38 @@
+<?php
+$sock = stream_socket_client("unix:///tmp/ls", $errno, $errstr);
+if (!empty($_REQUEST["s"])) {
+ fwrite($sock, "travnik.skip\r\n");
+ header("location: ?p=1");
+ exit("preusmeritev na ?p=1");
+}
+fwrite($sock, "uptime\r\n");
+usleep(100000);
+$uptime = trim(str_replace("END", "", fread($sock, 256)));
+fwrite($sock, "travnik.remaining\r\n");
+usleep(100000);
+$remaining = trim(str_replace("END", "", fread($sock, 256)));
+fwrite($sock, "travnik.metadata\r\n");
+usleep(100000);
+$metadata = str_replace("\r", "", trim(str_replace("END", "", fread($sock, 65536))));
+fwrite($sock, "quit\r\n");
+?>
+radijski pretok neprestano teče že <?= htmlspecialchars($uptime) ?>
+<br>
+do konca komada je še <?= gmdate("H:i:s", intval($remaining)) ?>.
+<br>
+<form method=post>
+<input type=submit name=s value="preskoči na naslednji komad" />
+</form>
+<?php
+if (!empty($_REQUEST["p"])) {
+?>
+<b>poročilo: zahteva za preskok komada je bila uspešno poslana. počakaj nekaj sekund, da se zgodi crossfade. preveri, da si na koncu pretoka!</b>
+<?php
+}
+?>
+<br>
+metapodatki o komadu in o prej predvajanih komadih:
+<br>
+<pre>
+<?= htmlspecialchars(implode("\n", array_reverse(explode("\n", $metadata)))) ?>
+</pre>